WSL1 UNIX paths on the command line are being changed in a strange way

I’m trying to use WSL1 on Windows. But bumped with this odd error when I tried to access the directory /usr/local/lib/python3.6/dist-packages/ which pip3 showed.

/bin/bash: line 0: cd: C:/program files/git/usr/local/lib/python3.6/dist-packages/: No such file or directory

Could someone shed some light on this? There is very little documentation on travis-CI Windows WSL.

$ wsl pip3 --version

pip 19.3.1 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)

$ wsl cd /usr/local/lib/python3.6/dist-packages/

The command “wsl cd /usr/local/lib/python3.6/dist-packages/” exited with 1.

Done. Your build exited with 1.

/bin/bash: line 0: cd: C:/program files/git/usr/local/lib/python3.6/dist-packages/: No such file or directory

Travis-ci builds are at:
WSL ubuntu - Manual install
WSL ubuntu - Choco install

Your command lines are run with Git Bash. Which processes it before the program proper gets to see the result.

What you see is processing specific to MSYS that Git Bash is based on. It interprets an argument starting with a forward slash (/stuff) as a UNIX absolute path – and converts it into a corresponding Windows path according to MSYS-emulated mounts (e.g. / corresponds to Windows Git’s installation directory).

There are two ways to get around it (as of this writing):

  • Double the leading forward slash: //stuff
  • Set the MSYS2_ARG_CONV_EXCL envvar that inhibits this behavior. E.g. MSYS2_ARG_CONV_EXCL="*" disables it for all paths.
    • Bash syntax allows to set an envvar for a specific command rather than globally with MSYS2_ARG_CONV_EXCL="*" <command>

For details and references, see:

1 Like

Thanks for the quick response. It works.:smiley:

Imprint