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

Path to mvn incorrect when wsl.conf changes the root mount #206

Closed
rdcoe opened this issue Jan 2, 2019 · 4 comments
Closed

Path to mvn incorrect when wsl.conf changes the root mount #206

rdcoe opened this issue Jan 2, 2019 · 4 comments
Labels
feature-request New feature or request WSL Windows Subsystem for Linux

Comments

@rdcoe
Copy link

rdcoe commented Jan 2, 2019

Describe the bug
The maven plugin fails to execute if the /etc/wsl.conf changes the root mount point, because the plugin expects /mnt/ as the mount point.

To Reproduce
Steps to reproduce the behavior:

  1. edit /etc/wsl.conf and change the root mount:

[automount]
root = /
options = "metadata"

  1. save wsl.conf and exit the bash shell
  2. reopen the bash shell and confirm the mount point no longer references /mnt:

$ pwd
rcoe@SKELETOR:/d/cygwin64/home/rcoe$ pwd
/d/cygwin64/home/rcoe

  1. set the path to mvn in the user/workspace settings:

Maven › Executable: Path
Specifies absolute path of your mvn executable. When this value is empty, it tries using 'mvn' or 'mvnw' according to value of 'maven.executeble.preferMavenWapper'. Note that a relative path is not suggested, but if you do specify one, the absolute path will be resolved from your workspace root folder (if exists).

d:/cygwin64/home/rcoe/apache-maven-3.5.2/bin/mvn

  1. execute the maven project plugin, e.g., vertx:run

rcoe@SKELETOR:/d/cygwin64/home/rcoe/git/linkEd$ "/mnt/d/cygwin64/home/rcoe/apache-maven-3.5.2/bin/mvn" vertx:run -f "/mnt/d/cygwin64/home/rcoe/git/linkEd/chatsrv/pom.xml"
-bash: /mnt/d/cygwin64/home/rcoe/apache-maven-3.5.2/bin/mvn: No such file or directory

Expected behavior
The mvn path should refer to the correct mount point for wsl, i.e., / not /mnt/

rcoe@SKELETOR:/d/cygwin64/home/rcoe/git/linkEd$ which mvn
/d/cygwin64/home/rcoe/apache-maven-3.5.2/bin/mvn

Environments (please complete the following information as much as possible):

  • OS: Windows 10
  • VS Code version: 1.30.1
  • Extension version: 0.12.1
@Eskibear
Copy link
Member

Eskibear commented Jan 3, 2019

I didn't know the /etc/wsl.conf feature, and I find it in the official docs. Yes, it makes sense that we should support this.

What's in my mind now is:

  1. read the mount point from /etc/wsl.conf.
  • when? on extension activation or on command execution?
  • how? currently the extension simply sends commands to the integrated terminal, without knowing what's going on in the terminal.
  1. transform the path.

@Eskibear Eskibear added feature-request New feature or request WSL Windows Subsystem for Linux labels Jan 3, 2019
@rdcoe
Copy link
Author

rdcoe commented Jan 3, 2019

Less elegant but also less work would be to offer another field in the settings to specify the mount point, potentially read-only unless wsl bash is set as the default terminal. It might even be possible to interrogate that file for the mount setting when the user sets WSL-bash as the terminal shell to use. I only offer this as a quick fix, since it's a fragile approach. But considering the wsl.conf is only available in Insider builds, who knows whether Windows might add support to interrogate it through an SDK in the future. Plus, it's unlikely a Code user would be using an environment that they haven't configured if the default mount point was changed. So on seeing a path error when using the plugin, the user should know how to change it, especially if the plugin error message pointed out the setting.

@Eskibear
Copy link
Member

Eskibear commented Jan 3, 2019

wslpath is for this, inspired by https://github.com/jdneo/vscode-leetcode/blob/master/src/utils/wslUtils.ts#L12-L17

default

$ wslpath -u C:\\Windows
/mnt/c/Windows
$ wslpath -w /mnt/c/Windows
C:\Windows

set the root = /

$ cat /etc/wsl.conf
[automount]
root = /
options = "metadata"
$ wslpath -u C:\\Windows
/c/Windows
$ wslpath -w /c/Windows
C:\Windows

@Eskibear Eskibear mentioned this issue Jan 7, 2019
6 tasks
Eskibear added a commit that referenced this issue Jan 17, 2019
@Eskibear
Copy link
Member

@rdcoe v0.14.0 has been shipped. It should work now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request WSL Windows Subsystem for Linux
Projects
None yet
Development

No branches or pull requests

2 participants