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

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:

2 Likes