GAM-team / got-your-back

Got Your Back (GYB) is a command line tool for backing up your Gmail messages to your computer using Gmail's API over HTTPS.
https://github.com/GAM-team/got-your-back/wiki
Apache License 2.0
2.6k stars 205 forks source link

Win11 Ubuntu WSL2 fails, maybe spaces in paths #346

Closed ptr727 closed 4 months ago

ptr727 commented 2 years ago

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:

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 commented 2 years ago

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 commented 4 months ago

Abandon