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

wslpath fails to convert Windows wsl network path to WSL path #5568

Closed
mangelozzi opened this issue Jul 9, 2020 · 4 comments
Closed

wslpath fails to convert Windows wsl network path to WSL path #5568

mangelozzi opened this issue Jul 9, 2020 · 4 comments

Comments

@mangelozzi
Copy link

mangelozzi commented Jul 9, 2020

Microsoft Windows [Version 10.0.19041.329]
WSL2, Ubuntu, lsb_release -r:
Release:        20.04
Linux version 4.19.104-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Feb 19 06:37:35 UTC 2020

Intro

I made a script to open a file from explorer.exe in WSL with vim. It work works fine. However sometimes I am browser within a WSL folder in explorer.exe (i.e. within \\wsl$\Ubuntu-20.04\), and wish to open a file in WSL with vim, then wslpath does not render a wsl path.

Steps to reproduce

michael@DESKTOP-9BB5J32:~$ wslpath "\\wsl$\Ubuntu-20.04\home\michael\foo.txt"
wslpath: \wsl$\Ubuntu-20.04\home\michael\foo.txt

Expected behavior

/home/michael/foo.txt

Actual behavior

wslpath: \wsl$\Ubuntu-20.04\home\michael\foo.txt
@therealkenc
Copy link
Collaborator

You need single quotes ref #5250. I did find however that only one of my distros (focal2 below) is converting while the rest (for example Ubuntu-18.04) does not.

image

@therealkenc therealkenc added the bug label Jul 9, 2020
@mangelozzi
Copy link
Author

Its working for me:

michael@DESKTOP-9BB5J32:~$ wslpath '\\wsl$\Ubuntu-20.04\home\michael\foo bar.txt'
/home/michael/foo bar.txt

It doesnt escape the spaces, and having to manually change double quotes from the ones windows automatically creates to single quotes is clunky, but at least its doable.

@therealkenc
Copy link
Collaborator

Thanks; glad it is working for you. Dropping the bug tag. If someone else hits wslpath difficulties like I did in the screencap it can be filed under a new cover.

@benhillis
Copy link
Member

@therealkenc - that behavior is expected if you are running wslpath from within the focal2 distro. That distro does not have access to the Ubuntu 18.04 filesystem, but agreed the error message could be more clear.

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

3 participants