Hi Jim, > Here's a slightly tighter test, albeit relying on tr working with octals: > > case `LC_ALL=en_US.UTF-8 printf '\351'| tr '\351' x` in x) ;; *) exit 1;; > esac
You're right, it's probably better to rely on 'tr' than on 'od'. Find attached an updated proposed patch. > Also, with archive/html URLs, please use the abbreviated form: > - https://lists.gnu.org/archive/html/grep-devel/2019-12/msg00020.html > + https://lists.gnu.org/r/grep-devel/2019-12/msg00020.html I prefer to use the canonical URLs, not the abbreviated ones. I can't find the long explanation right now, but basically my reasoning is: - Using the canonical URL provides a less surprising experience for the user who pastes it in a browser. - For security reasons, we are teaching people to avoid URLs shorteners like bit.ly, goo.gl, etc. A URL shortener that preserves the host name, like here, is less problematic, but still if I can avoid it, I avoid it. - When updating URLs every couple of years, my usual heuristic is to consider the current destination URL the "up-to-date" URL and the old one the "stale" URL that may go away at any moment. As a human, I do not read (and don't expect people to read) a URL word by word. Therefore it doesn't really matter whether it contains 60 or 80 or 120 characters. Bruno
>From cfc12acaf2be213c1bf0e8b59f10bdbafec335da Mon Sep 17 00:00:00 2001 From: Bruno Haible <br...@clisp.org> Date: Thu, 26 Dec 2019 12:29:20 +0100 Subject: [PATCH] test-framework-sh: Avoid /bin/sh on AIX 7.2 due to its printf built-in. Reported by Paul Eggert in <https://lists.gnu.org/archive/html/grep-devel/2019-12/msg00020.html>. Simplification by Jim Meyering. * tests/init.sh (gl_shell_test_script_): Add a test of printf of an octal escape sequence in a UTF-8 locale. --- ChangeLog | 9 +++++++++ tests/init.sh | 3 +++ 2 files changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index 70b4662..5161363 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2019-12-26 Bruno Haible <br...@clisp.org> + + test-framework-sh: Avoid /bin/sh on AIX 7.2 due to its printf built-in. + Reported by Paul Eggert in + <https://lists.gnu.org/archive/html/grep-devel/2019-12/msg00020.html>. + Simplification by Jim Meyering. + * tests/init.sh (gl_shell_test_script_): Add a test of printf of an + octal escape sequence in a UTF-8 locale. + 2019-12-26 Paul Eggert <egg...@cs.ucla.edu> mbrtowc: port better to narrow-wchar_t platforms diff --git a/tests/init.sh b/tests/init.sh index 8ca5c90..34da197 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -129,6 +129,8 @@ else fi # We require $(...) support unconditionally. +# We require that the printf built-in works correctly regarding octal escapes; +# this eliminates /bin/sh on AIX 7.2. # We require non-surprising "local" semantics (this eliminates dash). # This takes the admittedly draconian step of eliminating dash, because the # assignment tab=$(printf '\t') works fine, yet preceding it with "local " @@ -158,6 +160,7 @@ fi # ? - not ok gl_shell_test_script_=' test $(echo y) = y || exit 1 +LC_ALL=en_US.UTF-8 printf "\\351" 2>/dev/null | LC_ALL=C tr "\\351" x | LC_ALL=C grep x > /dev/null || exit 1 f_local_() { local v=1; }; f_local_ || exit 1 f_dash_local_fail_() { local t=$(printf " 1"); }; f_dash_local_fail_ score_=10 -- 2.7.4