>From bf5a308349fbcf0a376ca3e6e83fe7c6a2cc9eb1 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 25 Dec 2019 14:40:11 -0800 Subject: [PATCH] tests: work around AIX 7.2 sh printf bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AIX 7.2 /bin/sh’s printf command mishandles octal escapes in multibyte locales: it treats them as characters, not bytes. * tests/backslash-s-vs-invalid-multitype, tests/encoding-error: Use the C locale when employing the printf command with an octal escape that AIX 7.2 sh might mishandle. * tests/init.sh (setup_): Use the C locale for tests. This has the side benefit of making them more reproducible. --- tests/backslash-s-vs-invalid-multitype | 4 ++-- tests/encoding-error | 6 +++--- tests/init.sh | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/backslash-s-vs-invalid-multitype b/tests/backslash-s-vs-invalid-multitype index 82c6e63..bfa4462 100755 --- a/tests/backslash-s-vs-invalid-multitype +++ b/tests/backslash-s-vs-invalid-multitype @@ -11,11 +11,11 @@ require_en_utf8_locale_ +printf '\202\n' > in || framework_failure_ + LC_ALL=en_US.UTF-8 export LC_ALL -printf '\202\n' > in || framework_failure_ - fail=0 grep '^\S$' in > out-S && fail=1 compare /dev/null out-S || fail=1 diff --git a/tests/encoding-error b/tests/encoding-error index 1987f09..508206d 100755 --- a/tests/encoding-error +++ b/tests/encoding-error @@ -11,14 +11,14 @@ require_en_utf8_locale_ -LC_ALL=en_US.UTF-8 -export LC_ALL - printf 'Alfred Jones\n' > a || framework_failure_ printf 'John Smith\n' >j || framework_failure_ printf 'Pedro P\351rez\n' >p || framework_failure_ cat a p j >in || framework_failure_ +LC_ALL=en_US.UTF-8 +export LC_ALL + fail=0 grep '^A' in >out || fail=1 diff --git a/tests/init.sh b/tests/init.sh index 8ca5c90..a0ee8a9 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -378,6 +378,8 @@ testdir_prefix_ () { printf gt; } # Set up the environment for the test to run in. setup_ () { + export LC_ALL=C + if test "$VERBOSE" = yes; then # Test whether set -x may cause the selected shell to corrupt an # application's stderr. Many do, including zsh-4.3.10 and the /bin/sh -- 2.17.1