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 has no "usage" or "help" information #2715

Closed
rodrymbo opened this issue Dec 1, 2017 · 11 comments
Closed

wslpath has no "usage" or "help" information #2715

rodrymbo opened this issue Dec 1, 2017 · 11 comments
Assignees

Comments

@rodrymbo
Copy link

rodrymbo commented Dec 1, 2017

The new wslpath is a wonderful addition. Thank you.

Some sticklers might point out that it lacks the usual --help and --version options. It also responds

$ wslpath
wslpath: Invalid argument

when it should respond

$ wslpath
 wslpath usage:
    -a    force result to absolute path format
    -u    translate from a Windows path to a WSL path (default)
    -w    translate from a WSL path to a Windows path
    -m    translate from a WSL path to a Windows path, with ‘/’ instead of ‘\\’

    EX: wslpath ‘c:\users’

as found in the release notes.

Yeah, I know, no sooner do you add something that lots of people want (and for which we are very grateful) but we start complaining about it. But still, how hard is it to print usage when the program name is entered without parameters? So, yes, I'll be an ungrateful git and say this is a bug that needs to be fixed before it is released.

Yeah, I'm one of those who can't remember parameters exactly from one minute to the next and constantly refer to usage reminders. I'm sure I'll be wasting lots of time hunting for the usage in release-notes every time I need it, or here since I made this entry.

It also needs a man page.

Version 10.0.17046.1000
lrwxrwxrwx 1 root root 5 Nov 28 13:33 /bin/wslpath -> /init

Ah, so it is really /init. Well, /init (as opposed to /sbin/init) needs a man page too. 📦

@jstarks jstarks self-assigned this Dec 9, 2017
@jstarks
Copy link
Member

jstarks commented Dec 9, 2017

Man page is tricky (we don't want to dump a bunch of our own files in /usr or /usr/local), but I agree that we should at least have usage information.

@ketozhang
Copy link

I can wait but yes man page is definitely needed. Took me forever to remember what the command was. Google searching "convert wsl path to windows" doesn't get me to the release notes. Speaking of which it shouldn't just be officially listed in the release note. Put it everywhere it's useful!!

@safelix
Copy link

safelix commented Jan 30, 2018

@jstarks In my eyes, wslpath is a great tool. I understand that a man page is too much, but --help and --version options would be great!

There are many discussions concerning such a tool, but nobody seems to know that there is an official solution to the problem. A blog post would be great to raise awareness. Also, the follwing features would make it enough powerful to deserve a paragraph in the wsl/interop documentation. A simple google search would then reveal the commands and the documentation.

Handle arguments as paths not only as strings

  • Support for relative paths as arguments ('wslpath -w ./' doesnt work) -> use 'realpath'

  • Resolving of symlinks before path translation -> use 'realpath'

  • A call without arguments should print the cwd as a windows path -> use 'realpath'

  • Support for piping and redirection for better communication between Win and WSL

I'm sorry that this is partly a feature request. But it only concerncs the wslpath functionality and doesn't seem to complex, so I decided to post it here.

@mobluse
Copy link

mobluse commented May 3, 2018

I discovered a program called winpath that does not exist in ordinary Ubuntu (Lubuntu 16.04 for Raspberry Pi 2). Is winpath related to wslpath? winpath also has no usage documentation using winpath --help or man winpath.

It's also interesting that both wslpath and winpath both exists in all WSL Linuces. How many WSL-programs are there? i.e. that are added by WSL to all distributions.

@pd93
Copy link

pd93 commented May 3, 2018

@mobluse I have no binary called winpath in my WSL installation of Ubuntu. I'm on fast ring (so the 1803 release). Not sure where that would've come from - unless it's in the RS5 branch?

@mobluse
Copy link

mobluse commented May 3, 2018

@pd93 I have Microsoft Windows [Version 10.0.17134.1] 17134.1.amd64fre.rs4_release.180410-1804. Both wslpath and winpath exists in most updated Ubuntu 16.04 and openSUSE Leap 42.2.

@pd93
Copy link

pd93 commented May 3, 2018

@mobluse Can you run ls -la $(which winpath) to see where it's located and if it's symlinked to anything?

@mobluse
Copy link

mobluse commented May 3, 2018

In WSL Ubuntu:

$ ls -la $(which winpath)
lrwxrwxrwx 1 root root 5 nov  4 15:50 /bin/winpath -> /init

@pd93
Copy link

pd93 commented May 3, 2018

Both my Windows machine are on 17134.5 and neither of them have winpath. However, I do not run openSUSE on either (Both run Ubuntu 16.04), so maybe this has something to do with it?

I get the same results as you when running ls -la $(which wslpath)

lrwxrwxrwx 1 root root 5 Feb  8 19:29 /bin/wslpath -> /init

@jstarks
Copy link
Member

jstarks commented May 3, 2018

Sorry about winpath: originally wslpath was called winpath, but when we decided to rename it, we had already flighted builds with the original name. Perhaps we should have included code to automatically remove it. We will consider doing so in a future build.

So if you see /bin/winpath as a symlink to /init, please rm it manually.

/bin/wslpath and /init are the only binaries we inject into the distributions. We don't currently intend to add anything else; in general we want to leave decisions about what's in the distros to the individual distro packagers.

kergoth added a commit to kergoth/dotfiles that referenced this issue Jul 3, 2018
Usage info comes from microsoft/WSL#2715

Signed-off-by: Christopher Larson <kergoth@gmail.com>
@DarkStar777
Copy link

For the forgetful amongst us here is a temporary hack -- put in your PATH with chmod 755. I called it wslpath (in which case it needs to be in PATH before /bin) but you can call it whatever you want.

Thanks to rodrymbo for the usage content.

#!/bin/sh
if [ "$#" = "0" ]; then
### https://github.com/Microsoft/WSL/issues/2715
cat << '__EOF__'
Usage: wslpath [-a] [-u|-w|-m] path
    -a    output absolute path
    -u    translate from a Windows path to a WSL path (default)
    -w    translate from a WSL path to a Windows path
    -m    translate from a WSL path to a mixed Windows path using slashes
__EOF__
exit 0
fi
exec /bin/wslpath "$@"

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

9 participants