diff options
author | Kerin Millar <kfm@plushkava.net> | 2024-08-07 21:36:16 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2024-08-11 11:10:57 +0100 |
commit | f6f791f3c6ff6a4b94499c3fa61ffb20d2c5d733 (patch) | |
tree | e1e8a777fbb91c2efd2e1e871056b3050bdb8da7 /test-functions | |
parent | Have srandom() employ an upper bound of 2^31-1 (diff) | |
download | gentoo-functions-f6f791f3c6ff6a4b94499c3fa61ffb20d2c5d733.tar.gz gentoo-functions-f6f791f3c6ff6a4b94499c3fa61ffb20d2c5d733.tar.bz2 gentoo-functions-f6f791f3c6ff6a4b94499c3fa61ffb20d2c5d733.zip |
test-functions: avoid unspecified behaviour in test_quote_args()
In test_quote_args(), there is the following code.
fmt=$(printf '\%o' "$i")
However, the behaviour of the <backslash> character followed by the
<number-sign> character is unspecified. Since it is intended to be taken
as a literal backslash, fix it by writing it as thus.
fmt=$(printf '\\%o' "$i")
Doing so addresses a spurious test failure where using the loksh shell.
Signed-off-by: Kerin Millar <kfm@plushkava.net>
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'test-functions')
-rwxr-xr-x | test-functions | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test-functions b/test-functions index 96781f2..487caa9 100755 --- a/test-functions +++ b/test-functions @@ -914,7 +914,7 @@ test_quote_args() { retval=0 i=0 while [ "$(( i += 1 ))" -le 255 ]; do - fmt=$(printf '\%o' "$i") + fmt=$(printf '\\%o' "$i") # shellcheck disable=2059 str=$(printf "$fmt.") POSIXLY_CORRECT= quote_args "${str%.}" || break |