diff options
author | Diana Picus <diana.picus@linaro.org> | 2017-08-04 15:08:21 +0200 |
---|---|---|
committer | Diana Picus <diana.picus@linaro.org> | 2017-08-04 15:08:21 +0200 |
commit | 0341de8b375db72fd5952fe92844a1fd5614cc11 (patch) | |
tree | cea795720516a16acfa8b31f9cfe82a5a9df23bf /tcwg-llvm-testsuite.sh | |
parent | fe269e8c5c74817784af3d38176553caa651b505 (diff) |
tcwg-llvm-testsuite.sh: Don't use cut to split strings
We were using cut with a separator of "=" to parse things like
arg=value. This is problematic in cases where value itself may contain
other occurences of =, since the previous code would trim them away. For
instance, when parsing "nt_flags=--mllvm -global-isel-abort=2", we would
identify "nt_flags" as arg, but only "--mllvm -global-isel-abort" as
value.
We can fix the issue by using read instead of cut.
Change-Id: Icf35bc70c0534464ec70a0e062dae2d9efac0508
Diffstat (limited to 'tcwg-llvm-testsuite.sh')
-rwxr-xr-x | tcwg-llvm-testsuite.sh | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/tcwg-llvm-testsuite.sh b/tcwg-llvm-testsuite.sh index d36d20e4..f3931f29 100755 --- a/tcwg-llvm-testsuite.sh +++ b/tcwg-llvm-testsuite.sh @@ -24,8 +24,7 @@ NT_FLAGS="" # Command line parsing while [ "$#" -gt 0 ]; do - ARG=$(echo "$1" | cut -d "=" -f 1) - VAL=$(echo "$1" | cut -d "=" -f 2) + IFS="=" read ARG VAL <<< "$1" case "$ARG" in --workspace) if [ -d "$VAL" ]; then |