got-your-back icon indicating copy to clipboard operation
got-your-back copied to clipboard

Win11 Ubuntu WSL2 fails, maybe spaces in paths

Open ptr727 opened this issue 3 years ago • 1 comments

The issue tracker is for reporting product deficiencies. How do I questions should be posted to the discussion forum at https://groups.google.com/group/got-your-back. When in doubt, start at the discussion forum and return here only when instructed to do so.

Please confirm the following:

  • I have upgraded to the latest GYB release from https://github.com/jay0lee/got-your-back/releases and I still have this issue.
  • I am typing the command as described in the GAM Wiki at https://github.com/jay0lee/got-your-back/wiki

Full steps to reproduce the issue:

  1. Install Ubuntu from Windows Store on Win11, update as of today 24 Jan 2022
  2. Run Ubuntu Shell, follow Linux install instructions, install 1.54.
  3. At end of setup, exit shell when prompted, re-run shell

Expected outcome (what are you trying to do?): No error

Actual outcome (what errors or bad behavior do you see instead?):

-bash: export: `Files/dotnet/:/mnt/c/Program': not a valid identifier
-bash: export: `Files/Microsoft': not a valid identifier
-bash: export: `Server/130/Tools/Binn/:/mnt/c/Program': not a valid identifier
-bash: export: `Files/Microsoft': not a valid identifier
-bash: export: `Server/Client': not a valid identifier
-bash: export: `SDK/ODBC/170/Tools/Binn/:/mnt/c/Program': not a valid identifier
-bash: export: `Files/Git/cmd:/mnt/c/Program': not a valid identifier
-bash: export: `Files/Microsoft': not a valid identifier
-bash: export: `Server/140/Tools/Binn/:/mnt/c/Program': not a valid identifier
-bash: export: `Files/Microsoft': not a valid identifier
-bash: export: `Server/150/Tools/Binn/:/mnt/c/Program': not a valid identifier
-bash: export: `Files/PowerShell/7/:/mnt/c/Program': not a valid identifier
-bash: export: `Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Users/piete/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/piete/.dotnet/tools:/mnt/c/Users/piete/AppData/Local/Programs/Microsoft': not a valid identifier
-bash: export: `Insiders/bin:/mnt/c/Program': not a valid identifier
-bash: export: `Files/JetBrains/JetBrains': not a valid identifier
-bash: export: `2020.3.3/bin:/snap/bin:/home/pieter/bin/gyb': not a valid identifier
pieter@DESKTOP-2IL0UKA:/mnt/c/Users/piete$

I suspect the install is not quoting paths and failing when encountering paths with spaces in names, as is very common on Windows.

ptr727 avatar Jan 24 '22 21:01 ptr727

On a "clean" WSL2 Ubuntu, or Ubuntu LTS, or Debian, there is no path in cat ~/.bashrc. After installing GYB the PATH environment is expanded without quotes and a GYB appended as the last entry.

cat ~/.bashrc
...
export PATH=/home/pieter/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/Microsoft SQL Server/130/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/Microsoft SQL Server/140/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/150/Tools/Binn/:/mnt/c/Program Files/PowerShell/7/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Users/piete/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/piete/.dotnet/tools:/mnt/c/Users/piete/AppData/Local/Programs/Microsoft VS Code Insiders/bin:/mnt/c/Program Files/JetBrains/JetBrains Rider 2020.3.3/bin:/snap/bin:/home/pieter/bin/gyb

See here for append: https://github.com/GAM-team/got-your-back/blob/main/install-gyb.sh#L235

See here for possible alternative expansion: https://unix.stackexchange.com/questions/79658/not-a-valid-identifier-when-i-do-export-path

See here for similar issues in WSL: https://github.com/microsoft/WSL/issues/1640

Maybe ignore the path and just register the alias?: echo "alias gyb='~/bin/gyb/gyb'" >> ~/.bash_aliases

ptr727 avatar Jan 26 '22 00:01 ptr727

Abandon

ptr727 avatar Apr 26 '24 16:04 ptr727