1
0
Fork 0

Really fix Ubuntu/Debian setup when $PATH contains spaces (#9370)

PR #9307 fixed the immediately visible problem (the command that was
added to $HOME/.bashrc was incorrect because of missing quotes around
paths with spaces).  However, the modified command is still wrong - it
captures the value of $PATH at the setup time, and the resulting command
written out to $HOME/.bashrc will overwrite $PATH with that captured
value, ignoring any changes in the environment.  This may be especially
important for WSL, where the initial value of $PATH in Linux includes
everything which has been added to %PATH% on the Windows side; after
adding that command to $HOME/.bashrc the WSL environment will no longer
pick up any changes made by newly installed Windows software.

Instead of that, use single quotes around the command, so that the
environment variables are not expanded at the setup time, and the
command that is added to $HOME/.bashrc becomes exactly this:

    PATH="$HOME/.local/bin:$PATH"

This command will use the $HOME and $PATH environment variable values at
the time the command is executed, not at the time the QMK setup is
performed, so any further updates to $PATH are taken into account.
Double quotes also ensure that the command is safe even if the values of
those environment variables contain spaces.
This commit is contained in:
Sergey Vlasov 2020-06-11 14:26:10 +03:00 committed by GitHub
parent 9b0c734733
commit 0cb4da2c74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -97,7 +97,7 @@ In most situations you will want to answer Yes to all of the prompts.
It's possible, that you will get an error saying something like: `bash: qmk: command not found`. It's possible, that you will get an error saying something like: `bash: qmk: command not found`.
This is due to a [bug](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839155) Debian introduced with their Bash 4.4 release, which removed `$HOME/.local/bin` from the PATH. This bug was later fixed on Debian and Ubuntu. This is due to a [bug](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839155) Debian introduced with their Bash 4.4 release, which removed `$HOME/.local/bin` from the PATH. This bug was later fixed on Debian and Ubuntu.
Sadly, Ubuntu reitroduced this bug and is [yet to fix it](https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1588562). Sadly, Ubuntu reitroduced this bug and is [yet to fix it](https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1588562).
Luckily, the fix is easy. Run this as your user: `echo "PATH=$HOME/.local/bin:\"$PATH\"" >> $HOME/.bashrc && source $HOME/.bashrc` Luckily, the fix is easy. Run this as your user: `echo 'PATH="$HOME/.local/bin:$PATH"' >> $HOME/.bashrc && source $HOME/.bashrc`
?>**Note on FreeBSD**: ?>**Note on FreeBSD**:
It is suggested to run `qmk setup` as a non-`root` user to start with, but this will likely identify packages that need to be installed to your It is suggested to run `qmk setup` as a non-`root` user to start with, but this will likely identify packages that need to be installed to your