From f6f791f3c6ff6a4b94499c3fa61ffb20d2c5d733 Mon Sep 17 00:00:00 2001 From: Kerin Millar Date: Wed, 7 Aug 2024 21:36:16 +0100 Subject: 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 character followed by the 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 Signed-off-by: Sam James --- 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 -- cgit v1.2.3-65-gdbad