Fix path quoting bug introduced in #220 (#227)

It seems that some variables were mistakenly left unquoted, leading to paths containing spaces being treated incorrectly.

For example, the directory `/home/person/foo bar/test/` would cause `CURDIR=$(pwd)` to be expanded to `CURDIR=/home/person/foo bar/test/`. This means that the shell would attempt to run the command `bar/test/` with the environment variable `CURDIR` set to `/home/person/foo`. This is due to [word splitting](https://www.gnu.org/software/bash/manual/html_node/Word-Splitting.html). (TL;DR the result of shell expansions should probably be quoted 99% of the time)
This commit is contained in:
Jacob Greenfield
2019-03-06 11:35:35 -05:00
committed by Alon Zakai
parent cd59b3aa26
commit 590e7bb23d

View File

@@ -19,11 +19,11 @@ SRC="$BASH_SOURCE"
if [ "$SRC" = "" ]; then
SRC="$0"
fi
CURDIR=$(pwd)
cd $(dirname "$SRC")
CURDIR="$(pwd)"
cd "$(dirname "$SRC")"
unset SRC
./emsdk construct_env "$@"
. ./emsdk_set_env.sh
cd $CURDIR
cd "$CURDIR"