Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executing a symlink to a windows executable does nothing #3999

Closed
bbulkow opened this issue Apr 25, 2019 · 21 comments
Closed

Executing a symlink to a windows executable does nothing #3999

bbulkow opened this issue Apr 25, 2019 · 21 comments
Assignees

Comments

@bbulkow
Copy link

bbulkow commented Apr 25, 2019

Hello, the pathology I am seeing is identical to that reported in the following:
#3424
Except it's a year later and clearly a different underlying issue. I have added a report to that issue, but it's closed, so I thought I would open a new issue. I don't know if you'd prefer to proceed in one or the other. This was working for me as recently as a few weeks ago ( say, 3/31/19 ).

I am running 10.0.18362.53

Please fill out the below information:

  • Your Windows build number: (Type ver at a Windows Command Prompt)
    10.0.18362.53

  • What you're doing and what's happening: (Copy&paste the full set of specific command-line steps necessary to reproduce the behavior, and their output. Include screen shots if that helps demonstrate the problem.)
    I have a windows executable installed in program files
    cd /usr/local/bin
    bin$ sudo ln -s "/mnt/c/Program Files/Sublime Text 3/sublime_text.exe" subl
    bin$ ls -l
    total 0
    lrwxrwxrwx 1 root root 52 Apr 25 12:28 subl -> '/mnt/c/Program Files/Sublime Text 3/sublime_text.exe'
    bin$ ./subl

---> this should pop up a windows window, it doesn't

  • What's wrong / what should be happening instead:
    Executing the soft link should execute the windows program.
    If I execute the command directly, it works fine

  • Strace of the failing command,
    ---> there's an EBADF near the bottom that shows there's a problem instead of a reasonable launch
    ---> sorry about the bad formatting. Not sure what I'm falling afoul of. Carriage returns and line feeds, I expect.

bbulk$ cat subl3.strace                                                                                                                                  2329  execve("/usr/local/bin/subl3", ["subl3"], 0x7fffeb0744e8 /* 26 vars */) = 0                                                                        2329  arch_prctl(ARCH_SET_FS, 0x293820) = 0                                                                                                              2329  set_tid_address(0x293858)         = 2329                                                                                                           2329  brk(NULL)                         = 0xd11000                                                                                                       2329  brk(0xd12000)                     = 0xd12000                                                                                                       2329  sched_getaffinity(0, 128, [0, 1, 2, 3, 4, 5, 6, 7]) = 64                                                                                           2329  uname({sysname="Linux", nodename="ASPARTAME", ...}) = 0                                                                                            2329  getpid()                          = 2329                                                                                                           2329  getcwd("/mnt/c/Users/bbulk", 4096) = 19                                                                                                            2329  open("/dev/lxss", O_RDWR)         = 3                                                                                                              2329  ioctl(3, _IOC(0, 0, 0x2f, 0x22), 0x7fffe43e54c8) = 0                                                                                               2329  getcwd("/mnt/c/Users/bbulk", 4096) = 19                                                                                                            2329  open("/proc/self/mountinfo", O_RDONLY) = 5                                                                                                         2329  readv(5, [{iov_base="", iov_len=0}, {iov_base="2 2 0:2 / / rw,noatime - lxfs ro"..., iov_len=1024}], 2) = 932                                      2329  readv(5, [{iov_base="", iov_len=0}, {iov_base="", iov_len=1024}], 2) = 0                                                                           2329  close(5)                          = 0                                                                                                              2329  getcwd("/mnt/c/Users/bbulk", 4096) = 19                                                                                                            2329  open("/proc/self/mountinfo", O_RDONLY) = 5                                                                                                         2329  readv(5, [{iov_base="", iov_len=0}, {iov_base="2 2 0:2 / / rw,noatime - lxfs ro"..., iov_len=1024}], 2) = 932                                      2329  readv(5, [{iov_base="", iov_len=0}, {iov_base="", iov_len=1024}], 2) = 0                                                                           2329  close(5)                          = 0                                                                                                              2329  ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0                                                                                          2329  ioctl(1, TCGETS, {B38400 opost isig icanon echo ...}) = 0                                                                                          2329  ioctl(2, TCGETS, {B38400 opost isig icanon echo ...}) = 0                                                                                          2329  ioctl(0, TIOCGPGRP, [2327])       = 0                                                                                                              2329  getpgid(0)                        = 2327                                                                                                           2329  fstat(0, {st_mode=S_IFCHR|0660, st_rdev=makedev(4, 1), ...}) = 0                                                                                   2329  fstat(1, {st_mode=S_IFCHR|0660, st_rdev=makedev(4, 1), ...}) = 0                                                                                   2329  fstat(2, {st_mode=S_IFCHR|0660, st_rdev=makedev(4, 1), ...}) = 0                                                                                   2329  ioctl(0, TIOCGWINSZ, {ws_row=30, ws_col=120, ws_xpixel=0, ws_ypixel=0}) = 0                                                                        2329  ioctl(0, SNDCTL_TMR_START or TCSETS, {B38400 -opost -isig -icanon -echo ...}) = 0                                                                  2329  dup(0)                            = 5                                                                                                              2329  ioctl(4, _IOC(0, 0, 0xb7, 0x22), 0x7fffe43e5478) = 0                                                                                               2329  ioctl(4, _IOC(0, 0, 0xb7, 0x22), 0x7fffe43e5478) = 0                                                                                               2329  ioctl(4, _IOC(0, 0, 0xb7, 0x22), 0x7fffe43e5478) = 0                                                                                               2329  write(4, "\0\0\0\0\301\0\0\0\16\0\0\0\0\0\0\0\17\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0"..., 193) = 193                                                    2329  close(0)                          = 0                                                                                                              2329  close(1)                          = 0                                                                                                              2329  close(2)                          = 0                                                                                                              2329  rt_sigprocmask(SIG_BLOCK, [INT WINCH], NULL, 8) = 0                                                                                                2329  signalfd4(-1, [INT WINCH], 8, 0)  = 0                                                                                                              2329  poll([{fd=4, events=POLLIN}, {fd=0, events=POLLIN}], 2, -1) = 1 ([{fd=4, revents=POLLIN}])                                                         2329  read(4, "\10\0\0\0 \0\0\0\26\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 32) = 32                                                              2329  writev(2, [{iov_base="/usr/local/bin/subl3: Invalid ar"..., iov_len=39}, {iov_base=NULL, iov_len=0}], 2) = -1 EBADF (Bad file descriptor)          2329  close(3)                          = 0                                                                                                              2329  close(4)                          = 0                                                                                                              2329  ioctl(5, SNDCTL_TMR_START or TCSETS, {B38400 opost isig icanon echo ...}) = 0                                                                      2329  close(5)                          = 0                                                                                                              2329  exit_group(1)                     = ?                                                                                                              2329  +++ exited with 1 +++                                                                                                                              bbulk$                                   `                                                                                                                                     
@YihaoPeng
Copy link

I have the same issue in my Win10 version 1903 build 18362.53.

I have been running docker.exe via a symbolic link on build 1809, and it doesn't work after upgrading to 1903.

On 1809:
1809

On 1903:
1903


A simply repro:

whereis cmd.exe
ln -s /c/Windows/system32/cmd.exe ./cmd
./cmd

This should get you into cmd but nothing happens after running, and the program doesn't have any output.

@YihaoPeng
Copy link

YihaoPeng commented Apr 29, 2019

Instead, I now need to write a startup shell script.
vim /usr/local/bin/docker

exec '/c/Program Files/Docker/Docker/Resources/bin/docker.exe' $*

This is a problem when the argument is a string with spaces. change to this

exec '/c/Program Files/Docker/Docker/Resources/bin/docker.exe' "$@"

Or you may use /mnt/c/Program Files/Docker/Docker/Resources/bin/docker.exe if you have a default mount point.

@cybtachyon
Copy link

I am able to reproduce with Windows Version 10.0.17758.4 as well.

WSL + Ubuntu 18.04 LTS

Easy repro: Follow https://docksal.io/installation#windows-virtualbox on this setup

@bbulkow
Copy link
Author

bbulkow commented May 5, 2019

Given we've got multiple simple repros on the most common Ubuntu WSL installation, how can we get the prioritity raised? This is a big one for me... there's only one symlink I have but I use it a lot :-) NO assignees no tags no nothing is a bit sad-face

@bbulkow
Copy link
Author

bbulkow commented May 9, 2019

The workaround worked for me of creating a file with an exec. Although there's a typo there, you need to start with '/mnt/c/Program Files/' the MNT was missing.

@slightlyfaulty
Copy link

@bbulkow Not a typo. Most people just change their mount root to / to be more inline with the paths used by Docker, etc.

@zl3one6
Copy link

zl3one6 commented May 21, 2019

Same issue on win10 1903 18362.116 with ubuntu 18.04.2

@LuoZhongYao
Copy link

Instead, I now need to write a startup shell script.
vim /usr/local/bin/docker

exec '/c/Program Files/Docker/Docker/Resources/bin/docker.exe' $*

This is a problem when the argument is a string with spaces. change to this

exec '/c/Program Files/Docker/Docker/Resources/bin/docker.exe' "$@"

@benhillis
Copy link
Member

Working on a fix for this. Will also attempt to get the fix backported to 1903.

@benhillis benhillis self-assigned this May 26, 2019
@gdh1995
Copy link

gdh1995 commented May 27, 2019

I find that absolute file paths in cmd arguments are also not translated...

As a result, I have to add a prefix of env.exe from Git for Windows to translate them - e.g. env.exe notepad.exe /e/my/file.txt.

@benhillis
Copy link
Member

benhillis commented May 28, 2019

I've identified the issue, it's related to us now supporting the 9P paths (\wsl$\distro) in wslpath and am drafting a fix.

@igieon
Copy link

igieon commented Jun 13, 2019

I have same issue after upgrade to 1903. I get error what is interesting when i execute symlink as sudo everything works.

igi@igi-inspiron:~$ ~igi/bin/minikube
igi@igi-inspiron:~$ sudo ~igi/bin/minikube
Minikube is a CLI tool that provisions and manages single-node Kubernetes clusters optimized for development workflows.

@benhillis
Copy link
Member

This is fixed in 18917.

@jstangroome
Copy link

jstangroome commented Aug 6, 2019

Will also attempt to get the fix backported to 1903.

@benhillis Do you know yet whether a backport to 1903 is possible/likely? I assume it would be delivered through standard Windows Update patching.

@bbulkow
Copy link
Author

bbulkow commented Aug 11, 2019

Working great on the insider builds.

@taviso
Copy link

taviso commented Nov 21, 2019

This is still broken in the 1909 update, it used to work in 1809. Frustrating that it just stopped working, and hasn't been fixed for months. Is there any chance a fix can be cherry picked for stable?

@Clovel
Copy link

Clovel commented Jan 21, 2020

This is still broken in the 1909 update, it used to work in 1809. Frustrating that it just stopped working, and hasn't been fixed for months. Is there any chance a fix can be cherry picked for stable?

I too am on 1909, and this doesn't work w/ Ubuntu 18.04 WSL. Either the fix has not been published, or it is broken again.

@benhillis
Copy link
Member

Unfortunately the Windows servicing team would not take this fix to 1903 / 1909. Fixed in builds 18917 and later.

@oferze
Copy link

oferze commented Feb 3, 2020

As of now, the latest OS build released is 18363.628 (and I'm not daring installing Windows Insider builds) so this feature is broken. Heavily.

aarchangel64 added a commit to aarchangel64/qmk_firmware that referenced this issue Mar 5, 2020
WSL needs /c not //c, and symlinks are fully resolved before calling .exes due to this bug: microsoft/WSL#3999
teto pushed a commit to neovim/neovim that referenced this issue Apr 15, 2020
…kip ci] (#12124)

On some versions of Windows, WSL is unable to execute symbolic links to
Windows executables (microsoft/WSL#3999). As a workaround for that problem
this changes to use resolve() on WSL if win32yank was a symbolic link.

fixes #12113.
@alexander-nolan
Copy link

This still isn't working for me on 2004...

@therealkenc
Copy link
Collaborator

This issue is closed. If people are experiencing difficulties on 2004 aka 19041 or better, please spawn a new issue following the template.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests