On 05/03/19 13:17, Assaf Gordon wrote:
> Hello Pádraig,
> 
> On 2019-03-04 3:18 a.m., Pádraig Brady wrote:
>> We plan to release coreutils-8.31 in the coming week
> 
> Thanks for all the hard work, and for cleaning up and finalizing the 
> 'env' patch.
> 
> 
> Some test results:
> 

> On FreeBSD 11:
>    FAIL: tests/misc/wc-nbsp
> 
> On Mac OS X:
>    FAIL: tests/misc/wc-nbsp


Thanks for all the testing!

I think the wc-nbsp failure stems from FreeBSD's concept of printable,
assuming nbsp is non printable.
For example:
https://mpc.lists.freebsd.questions.narkive.com/4m5jNqLS/printable-characters-in-lc-ctype

This is a bug in FreeBSD/OSX IMHO.
I tested that the attached avoids the test failure.

cheers,
Pádraig

p.s. I could check for nbsp in the non printable case,
but that would be inconsistent with wc -L
and also doesn't work in the KOI8-R case
From 1c4206881ae279871c1ba5b946f870364dc00b90 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Wed, 6 Mar 2019 10:34:16 -0800
Subject: [PATCH] tests: wc-nbsp.sh: avoid failure on FreeBSD

* tests/misc/wc-nbsp.sh: FreeBSD and OS X don't
treat non breaking space as printable characters.
So use wc -L to determine printability before
testing non breaking space functionality.
---
 tests/misc/wc-nbsp.sh | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/tests/misc/wc-nbsp.sh b/tests/misc/wc-nbsp.sh
index 11ee0d6..aca971c 100755
--- a/tests/misc/wc-nbsp.sh
+++ b/tests/misc/wc-nbsp.sh
@@ -24,19 +24,27 @@ print_ver_ wc printf
 
 export LC_ALL=en_US.ISO-8859-1
 if test "$(locale charmap 2>/dev/null)" = ISO-8859-1; then
-  test $(env printf '=\xA0=' | wc -w) = 2 || fail=1
-  test $(env printf '=\xA0=' | POSIXLY_CORRECT=1 wc -w) = 1 || fail=1
+  # Use -L to determine whether NBSP is printable.
+  # FreeBSD 11 and OS X treat NBSP as non printable ?
+  if test "$(env printf '=\xA0=' | wc -L)" = 3; then
+    test $(env printf '=\xA0=' | wc -w) = 2 || fail=1
+    test $(env printf '=\xA0=' | POSIXLY_CORRECT=1 wc -w) = 1 || fail=1
+  fi
 fi
 export LC_ALL=en_US.UTF-8
 if test "$(locale charmap 2>/dev/null)" = UTF-8; then
-  test $(env printf '=\u00A0=' | wc -w) = 2 || fail=1
-  test $(env printf '=\u2007=' | wc -w) = 2 || fail=1
-  test $(env printf '=\u202F=' | wc -w) = 2 || fail=1
-  test $(env printf '=\u2060=' | wc -w) = 2 || fail=1
+  if test "$(env printf '=\u00A0=' | wc -L)" = 3; then
+    test $(env printf '=\u00A0=' | wc -w) = 2 || fail=1
+    test $(env printf '=\u2007=' | wc -w) = 2 || fail=1
+    test $(env printf '=\u202F=' | wc -w) = 2 || fail=1
+    test $(env printf '=\u2060=' | wc -w) = 2 || fail=1
+  fi
 fi
 export LC_ALL=ru_RU.KOI8-R
 if test "$(locale charmap 2>/dev/null)" = KOI8-R; then
-  test $(env printf '=\x9A=' | wc -w) = 2 || fail=1
+  if test "$(env printf '=\x9A=' | wc -L)" = 3; then
+    test $(env printf '=\x9A=' | wc -w) = 2 || fail=1
+  fi
 fi
 
 Exit $fail
-- 
2.9.3

Reply via email to