-
-
Notifications
You must be signed in to change notification settings - Fork 377
Description
Issue: If you run the install-linux.sh script in a path that contains spaces, like /home/niroku/Applications/SwarmUI testing/, then the install script fails at the first cd command:
cd: Too many arguments.
and continues executing commands. The SwarmUI does continue installation, just not in the path specified (it uses whatever path the working directory is currently).
Solution 1: The rudimentary fix is to encapsulate all uses of $SCRIPT_DIR in double-quotes:
install-linux.zip
This also needs to be applied to the SwarmUI/launch-linux.sh file as well:
launch-linux.zip
This issue may affect all platforms, but I've only tested this rudimentary fix on Linux. This is the most security-oriented approach, as the script is currently arbitrary commands (intentional or not) can be executed by the script depending on the name of the path installed to, eg. /home/you/lol && cd -- && rm -rf * (though this is arguably self-inflicted).
Solution 2: The rudimentary fix in solution 1 does not account for other parts of the project that may have been programmed with the initial behaviour in mind though, so a less error-prone solution might be to store escaped double-quotes in the SCRIPT_DIR variable itself. In which case, the command to assign the variable can be replaced with:
SCRIPT_DIR=\"$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )\"in all the files which define that variable (install-linux.sh, launch-linux.sh, launch-macos.sh, etc.). This is the fix involving the fewest modifications to existing files.
Solution 3: Tell users not to use paths that contains spaces.
Extra info: This issue affects manually defined paths as well, which is the initial issue I was actually testing for. So the rudimentary fix for solution 1 would be modified as:
# Note: manual installers that want to avoid home dir, add to both of the below lines: --install-dir "$SCRIPT_DIR/.dotnet"
./launchtools/dotnet-install.sh --channel 8.0 --runtime aspnetcore --install-dir "$SCRIPT_DIR/.dotnet"
./launchtools/dotnet-install.sh --channel 8.0 --install-dir "$SCRIPT_DIR/.dotnet"If using solution 2, no further modifications are necessary.