From 9e9e7dd442ade2a0988a5ce03116928b0d79ce97 Mon Sep 17 00:00:00 2001 From: Albert Ou Date: Sat, 31 Aug 2019 02:00:48 -0700 Subject: [PATCH] scripts: Fix latent issues with env.sh * Ensure shell metacharacters are quoted in RISCV variable assignment. * Avoid unnecessary expansion of $RISCV and $LD_LIBRARY_PATH at generation time. * Remove undefined usage of $DTCversion. * Simplify output redirection. --- scripts/build-toolchains.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/build-toolchains.sh b/scripts/build-toolchains.sh index 8e0d40e7..6d466ad7 100755 --- a/scripts/build-toolchains.sh +++ b/scripts/build-toolchains.sh @@ -135,13 +135,14 @@ fi cd "$RDIR" -echo "export CHIPYARD_TOOLCHAIN_SOURCED=1" > env.sh -echo "export RISCV=$RISCV" >> env.sh -echo "export PATH=$RISCV/bin:$RDIR/$DTCversion:\$PATH" >> env.sh -echo "export LD_LIBRARY_PATH=$RISCV/lib\${LD_LIBRARY_PATH:+":${LD_LIBRARY_PATH}"}" >> env.sh +{ + echo "export CHIPYARD_TOOLCHAIN_SOURCED=1" + echo "export RISCV=$(printf '%q' "$RISCV")" + echo "export PATH=\${RISCV}/bin:\${PATH}" + echo "export LD_LIBRARY_PATH=\${RISCV}/lib\${LD_LIBRARY_PATH:+":\${LD_LIBRARY_PATH}"}" +} > env.sh echo "Toolchain Build Complete!" - if [ "$FASTINSTALL" = "false" ]; then # commands that can't run on EC2 (specifically, OpenOCD because of autoconf version_ # see if the instance info page exists. if not, we are not on ec2.