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

Cannot handle path when working from WSL path in Windows #71

Open
alecxvs opened this issue Apr 28, 2019 · 12 comments
Open

Cannot handle path when working from WSL path in Windows #71

alecxvs opened this issue Apr 28, 2019 · 12 comments

Comments

@alecxvs
Copy link

alecxvs commented Apr 28, 2019

The insider build for 1903 has a new functionality that allows browsing files on WSL from explorer. The paths look like \\wsl$\Ubuntu\home\alecxvs\Git\myproject.

Running wslgit from this path gives this error:
thread 'main' panicked at 'Cannot handle path "\\\\wsl$\\Ubuntu\\home\\alecxvs\\Git\\myproject"', src\libcore\option.rs:1008:5

@andy-5
Copy link
Owner

andy-5 commented Apr 29, 2019

Yes, it would be nice to support these new paths. Right now, wslgit assumes that Windows paths start with a drive letter (to translate them into a proper unix path).

Adding support for these paths should be possible, e.g. by detecting and removing the prefix.

@roonie007
Copy link

+1

@chadrien
Copy link

Adding support for these paths should be possible, e.g. by detecting and removing the prefix.

@andy-5 why don't you use wslpath for things like that? E.g. wsl.exe wslpath -u "\\\\wsl$\\Ubuntu\\home\\alecxvs\\Git\\myproject" would return /home/alecxvs/Git/myproject. Would it make your life easier? :)

@andy-5
Copy link
Owner

andy-5 commented Aug 19, 2019

Thanks for the suggestion (and good to know that it supports these paths). There is already some discussion on wslpath in #12. Unfortunately, it does not solve all problems. The main reasons it is not used are:

  • it does not fully support manually mounted drives
  • executing a separate process is slow
  • nobody has done the work to implement support for it

@rennex
Copy link

rennex commented Oct 2, 2019

It should be super simple to convert WSL2 UNC paths: just add/remove the \\wsl$\Distroname and flip the backslashes. No need to resolve mount paths in that case. However, I'm not sure if there's some special consideration needed for running executables when the current directory is a UNC path. At least .bat scripts have problems with those.

Ideally, this would detect the UNC paths and also work with DrvFs or 9p mounts, so it'd work whether the git repo resides on the Windows side or the Linux side.

@andy-5
Copy link
Owner

andy-5 commented Jan 10, 2020

I just released v0.9.0, which uses wslpath to translate paths (and should handle UNC paths). Does the new version resolve this issue?

@Stanzilla
Copy link

Stanzilla commented Feb 7, 2020

Not quite, I have a repo at

\\wsl$\Ubuntu\home\stan\projects\personal\WeakAuras2

and when I go to it via CMD (which is T:\home\stan\projects\personal\WeakAuras2) and type git status it does not detect it as a git repo. When I then type git init, it inits in my WSL user folder,

PS T:\home\stan\projects\personal\WeakAuras2> git init
Initialized empty Git repository in \wsl$\Ubuntu\home\stan\.git

@Stanzilla
Copy link

@carlolars any idea for this maybe?

@carlolars
Copy link
Contributor

@carlolars any idea for this maybe?

To access mapped network drives they must be manually mounted inside WSL. wslpath cannot figure out that T: in your case is actually is \\wsl$\Ubuntu since it only gets the windows path (T:\home\stan...). So you have to mount the network drive inside WSL and then wslpath will know how to translate a path that begins with T: to the mounted path.

But unfortunately it seems to not be possible to, in WSL, mount a network drive that points to the WSL filesystem. I even tried to do a bind mount of the root filesystem to my /mnt/t but it didn't work.

I see that you actually use Power Shell and not cmd.exe. In PS you can actually do cd \\wsl$\Ubuntu\home\stan\projects\personal\WeakAuras2 😄

@Stanzilla
Copy link

but T IS the WSL mount, how would I mount it inside of WSL?

@carlolars
Copy link
Contributor

but T IS the WSL mount, how would I mount it inside of WSL?

You can't.

@Stanzilla
Copy link

Stanzilla commented Apr 3, 2020

Yeah well for this cmd/ps example it does not really matter but I was mainly testing this way because it did not work in Fork either.

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

No branches or pull requests

7 participants