From e6b04d9ffd8bef2482ab61957c138ae92527206d Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Wed, 13 Mar 2019 17:15:03 -0400 Subject: Protect [ commands from strings beginning with "-" --- (limited to 'tests') diff --git a/tests/ob_parse_dep.sh b/tests/ob_parse_dep.sh index 2ee6cbf..887f6f1 100755 --- a/tests/ob_parse_dep.sh +++ b/tests/ob_parse_dep.sh @@ -40,7 +40,7 @@ testcase() for comp in pkg archqual rel ver arches; do test_comp="$(eval "printf '%s' \"\${test_${comp}}\"")" good_comp="$(eval "printf '%s' \"\${${comp}}\"")" - if [ "${test_comp}" != "${good_comp}" ]; then + if [ x"${test_comp}" != x"${good_comp}" ]; then diag_ "$(printf 'Dependency "%s", component "%s":' \ "${dep}" "${comp}")" diag_ "$(printf ' "%s" != "%s"\n' \ diff --git a/tests/ob_reduce_deps.sh b/tests/ob_reduce_deps.sh index 833f8de..7030f07 100755 --- a/tests/ob_reduce_deps.sh +++ b/tests/ob_reduce_deps.sh @@ -28,107 +28,107 @@ plan_ 11 command_ok_ \ 'NORMAL LIST "foo, bar"' -- \ - [ "$(ob_reduce_deps \ + [ x"$(ob_reduce_deps \ -a 'amd64-linux-glibc' \ 'foo, bar' \ )" = \ - 'foo, bar' \ + x'foo, bar' \ ] command_ok_ \ 'NORMAL LIST "foo,bar"' -- \ - [ "$(ob_reduce_deps \ + [ x"$(ob_reduce_deps \ -a 'amd64-linux-glibc' \ 'foo,bar' \ )" = \ - 'foo, bar' \ + x'foo, bar' \ ] command_ok_ \ 'NORMAL LIST "foo, bar"' -- \ - [ "$(ob_reduce_deps \ + [ x"$(ob_reduce_deps \ -a 'amd64-linux-glibc' \ 'foo, bar' \ )" = \ - 'foo, bar' \ + x'foo, bar' \ ] command_ok_ \ 'UNION LIST "foo, bar"' -- \ - [ "$(ob_reduce_deps \ + [ x"$(ob_reduce_deps \ -u \ -a 'amd64-linux-glibc' \ 'foo, bar' \ )" = \ - 'foo, bar' \ + x'foo, bar' \ ] command_ok_ \ 'UNION LIST "foo,bar"' -- \ - [ "$(ob_reduce_deps \ + [ x"$(ob_reduce_deps \ -u \ -a 'amd64-linux-glibc' \ 'foo,bar' \ )" = \ - 'foo, bar' \ + x'foo, bar' \ ] command_ok_ \ 'UNION LIST "foo, bar"' -- \ - [ "$(ob_reduce_deps \ + [ x"$(ob_reduce_deps \ -u \ -a 'amd64-linux-glibc' \ 'foo, bar' \ )" = \ - 'foo, bar' \ + x'foo, bar' \ ] # Normal OR-lists. command_ok_ \ 'NORMAL LIST "foo | bar"' -- \ - [ "$(ob_reduce_deps \ + [ x"$(ob_reduce_deps \ -a 'amd64-linux-glibc' \ 'foo | bar' \ )" = \ - 'foo | bar' \ + x'foo | bar' \ ] command_ok_ \ 'NORMAL LIST "foo|bar"' -- \ - [ "$(ob_reduce_deps \ + [ x"$(ob_reduce_deps \ -a 'amd64-linux-glibc' \ 'foo|bar' \ )" = \ - 'foo | bar' \ + x'foo | bar' \ ] command_ok_ \ 'NORMAL LIST "foo | bar"' -- \ - [ "$(ob_reduce_deps \ + [ x"$(ob_reduce_deps \ -a 'amd64-linux-glibc' \ 'foo | bar' \ )" = \ - 'foo | bar' \ + x'foo | bar' \ ] # Normal and union AND-lists with arch specs. command_ok_ \ 'NORMAL LIST "foo [amd64-linux-glibc], bar [!amd64-linux-glibc]"' -- \ - [ "$(ob_reduce_deps \ + [ x"$(ob_reduce_deps \ -a 'amd64-linux-glibc' \ 'foo [amd64-linux-glibc], bar [!amd64-linux-glibc]' \ )" = \ - 'foo' \ + x'foo' \ ] command_ok_ \ 'UNION LIST "foo [amd64-linux-glibc], bar [!amd64-linux-glibc]"' -- \ - [ "$(ob_reduce_deps \ + [ x"$(ob_reduce_deps \ -u \ -a 'amd64-linux-glibc' \ 'foo [amd64-linux-glibc], bar [!amd64-linux-glibc]' \ )" = \ - 'foo' \ + x'foo' \ ] -- cgit v0.9.1