Skip to content

Commit 590e7bb

Browse files
Coder-256kripken
authored andcommitted
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)
1 parent cd59b3a commit 590e7bb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

emsdk_env.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ SRC="$BASH_SOURCE"
1919
if [ "$SRC" = "" ]; then
2020
SRC="$0"
2121
fi
22-
CURDIR=$(pwd)
23-
cd $(dirname "$SRC")
22+
CURDIR="$(pwd)"
23+
cd "$(dirname "$SRC")"
2424
unset SRC
2525

2626
./emsdk construct_env "$@"
2727
. ./emsdk_set_env.sh
2828

29-
cd $CURDIR
29+
cd "$CURDIR"

0 commit comments

Comments
 (0)