commit: f6f791f3c6ff6a4b94499c3fa61ffb20d2c5d733
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 7 20:36:16 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Aug 11 10:10:57 2024 +0000
URL:
https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=f6f791f3
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 <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
test-functions | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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