summaryrefslogtreecommitdiff
path: root/lib/spack/env
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2018-08-08 22:52:19 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2018-08-09 08:00:22 -0700
commited79d6a11b4c5baf811a126406bed1c7f623a26a (patch)
treee1f5f7f9be7871d9010db381ac6b917b68376353 /lib/spack/env
parent393d3c64fc6275e6e6d20269cbc155e4fdea97f8 (diff)
downloadspack-ed79d6a11b4c5baf811a126406bed1c7f623a26a.tar.gz
spack-ed79d6a11b4c5baf811a126406bed1c7f623a26a.tar.bz2
spack-ed79d6a11b4c5baf811a126406bed1c7f623a26a.tar.xz
spack-ed79d6a11b4c5baf811a126406bed1c7f623a26a.zip
bugfix: cc handles spaces in flag variables properly
- cc cleanup caused a parsing regression in flag handling - We added proper quoting to array expansions, but flag variables were never actually converted to arrays. Old code relied on this. This commit: - Adds reads to convert flags to arrays. - Makes the cc test check for improper space handling to prevent future regressions.
Diffstat (limited to 'lib/spack/env')
-rwxr-xr-xlib/spack/env/cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/spack/env/cc b/lib/spack/env/cc
index 2dd82d7d73..826a0fe457 100755
--- a/lib/spack/env/cc
+++ b/lib/spack/env/cc
@@ -74,9 +74,18 @@ function die {
exit 1
}
-# read system directories into an array (delimited by :)
+# read input parameters into proper bash arrays.
+# SYSTEM_DIRS is delimited by :
IFS=':' read -ra SPACK_SYSTEM_DIRS <<< "${SPACK_SYSTEM_DIRS}"
+# SPACK_<LANG>FLAGS and SPACK_LDLIBS are split by ' '
+IFS=' ' read -ra SPACK_FFLAGS <<< "$SPACK_FFLAGS"
+IFS=' ' read -ra SPACK_CPPFLAGS <<< "$SPACK_CPPFLAGS"
+IFS=' ' read -ra SPACK_CFLAGS <<< "$SPACK_CFLAGS"
+IFS=' ' read -ra SPACK_CXXFLAGS <<< "$SPACK_CXXFLAGS"
+IFS=' ' read -ra SPACK_LDFLAGS <<< "$SPACK_LDFLAGS"
+IFS=' ' read -ra SPACK_LDLIBS <<< "$SPACK_LDLIBS"
+
# test whether a path is a system directory
function system_dir {
path="$1"
@@ -524,7 +533,8 @@ fi
# dump the full command if the caller supplies SPACK_TEST_COMMAND=dump-args
if [[ $SPACK_TEST_COMMAND == dump-args ]]; then
- echo "${full_command[@]}"
+ IFS="
+" && echo "${full_command[*]}"
exit
elif [[ -n $SPACK_TEST_COMMAND ]]; then
die "ERROR: Unknown test command"