Jim Meyering <j...@meyering.net> wrote:
> Thank you for testing and reporting that!
> I have a marked preference for using hexadecimal (readability),
> but if I can't find a good, universally-portable converter that is
> sufficiently simple, I'll just revert to using octal.

Thanks, I fixed left multibyte-white-space.  Although I do not try it
on Debian, passed on CentOS, Solaris, HP-UX and AIX.
From 27adbe5bae4c0605155ab138add71be75e8df931 Mon Sep 17 00:00:00 2001
From: Norihiro Tanaka <nori...@kcn.ne.jp>
Date: Sat, 8 Nov 2014 16:34:24 +0900
Subject: [PATCH] tests: avoid awk+printf+\xHH portability trap

* tests/multibyte-white-space: Using Gawk's printf function with strings
like "\xHH\xHH", hexadecimal expressions are changed into characters
of the each mean, but no for other awk's imprementation.  That is not
portable.  Use octal expression in printf instead of hex_printf_ awk
wrapper.
---
 tests/multibyte-white-space | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tests/multibyte-white-space b/tests/multibyte-white-space
index bb1bdaf..278bf63 100755
--- a/tests/multibyte-white-space
+++ b/tests/multibyte-white-space
@@ -57,10 +57,16 @@ EOF
 
 fail=0
 
+hex_print()
+{
+  set -- $(echo "$1" | sed 's/\\x/ 0x/g')
+  printf $(printf $(printf "%0$#d" 0 | sed 's/0/\\%o/g')  ${1+"$@"})
+}
+
 for i in $utf8_space_characters; do
-  hex_printf_ "$i\n" | grep -q '^\s$' \
+  hex_print "$i" | grep -q '^\s$' \
       || { warn_ "$i FAILED to match \\s"; fail=1; }
-  hex_printf_ "$i\n" | grep -q '\S'
+  hex_print "$i" | grep -q '\S'
   test $? = 1 \
       || { warn_ "$i vs. \\S FAILED"; fail=1; }
 done
-- 
2.1.3

Reply via email to