diff options
author | rillig <rillig@pkgsrc.org> | 2019-05-22 20:47:05 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2019-05-22 20:47:05 +0000 |
commit | 69bc3b0fb286c262b389b791e414686aeef8669c (patch) | |
tree | a42fe9219caf9466f4b4f8b190098cbc14683579 /regress | |
parent | 3db4d431ba3bf18c4fb4dbdf7575c248dabff926 (diff) | |
download | pkgsrc-69bc3b0fb286c262b389b791e414686aeef8669c.tar.gz |
mk/tools: in the wrapper log, quote arguments containing = naturally
Diffstat (limited to 'regress')
-rwxr-xr-x | regress/tools/files/logging-test.sh | 6 | ||||
-rw-r--r-- | regress/tools/files/shquote-test.sh | 9 |
2 files changed, 12 insertions, 3 deletions
diff --git a/regress/tools/files/logging-test.sh b/regress/tools/files/logging-test.sh index 9e10b89f5ff..91e2602dbd1 100755 --- a/regress/tools/files/logging-test.sh +++ b/regress/tools/files/logging-test.sh @@ -1,5 +1,5 @@ #! /bin/sh -# $NetBSD: logging-test.sh,v 1.6 2019/03/24 11:29:19 rillig Exp $ +# $NetBSD: logging-test.sh,v 1.7 2019/05/22 20:47:05 rillig Exp $ # Up to March 2019, the command logging for the wrapped tools didn't properly # quote the command line arguments. This meant the logging did not reflect @@ -152,7 +152,7 @@ test_case "TOOLS_SCRIPT with actual arguments containing quotes" -DB=\"a\ b\" assert_log <<'EOF' -[*] WRKDIR/.tools/bin/for-loop '-DSD="a b"' '-DSS='\''a b'\''' '-DDD="a b"' '-DB="a b"' -<.> set args '-DSD="a b"' '-DSS='\''a b'\''' '-DDD="a b"' '-DB="a b"'; shift; printf '%s' "$0"; for arg in "$@"; do printf ' <%s>' "$arg"; done; printf '\n' +[*] WRKDIR/.tools/bin/for-loop -DSD='"a b"' -DSS=''\''a b'\''' -DDD='"a b"' -DB='"a b"' +<.> set args -DSD='"a b"' -DSS=''\''a b'\''' -DDD='"a b"' -DB='"a b"'; shift; printf '%s' "$0"; for arg in "$@"; do printf ' <%s>' "$arg"; done; printf '\n' EOF } diff --git a/regress/tools/files/shquote-test.sh b/regress/tools/files/shquote-test.sh index d0ace17ba19..796913a05c9 100644 --- a/regress/tools/files/shquote-test.sh +++ b/regress/tools/files/shquote-test.sh @@ -52,3 +52,12 @@ test_shquote '-e asdf' becomes "'-e asdf'" test_shquote '-n' becomes '-n' test_shquote '\\\\\\\\' becomes \''\\\\\\\\'\' test_shquote \"\$\'\;\<\\\` becomes \'\"\$\'\\\'\'\;\<\\\`\' + +# Move the single quote to the right of the equals sign, if possible. +test_shquote '-DMACRO="value"' becomes "-DMACRO='\"value\"'" +test_shquote '--prefix="/usr/local"' becomes "--prefix='\"/usr/local\"'" +test_shquote '-assignment=first=second=""' becomes "-assignment='first=second=\"\"'" +test_shquote '-assignment=first=second' becomes '-assignment=first=second' + +# If the left-hand side needs to be quoted as well, quote the whole string. +test_shquote '"left"="right"' becomes "'\"left\"=\"right\"'" |