bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: wcwidth on OpenBSD 5.8


From: Bruno Haible
Subject: Re: wcwidth on OpenBSD 5.8
Date: Thu, 21 Jan 2016 11:32:20 +0100
User-agent: KMail/4.8.5 (Linux/3.8.0-44-generic; KDE/4.8.5; x86_64; ; )

Pádraig Brady wrote in 
http://lists.gnu.org/archive/html/coreutils/2016-01/msg00057.html:
> OpenBSD 5.8, x86_64, GCC 4.2.1
>  coreutils:
>   PASS:  428
>   SKIP:  152
>  gnulib:
>   PASS:  273
>   SKIP:  34
>   FAIL:  1
>    test-wcwidth.c:71: assertion 'wcwidth (0x3000) == 2' failed
>    Seems we should add some more width verifications to wcwidth.m4.
>     $ export LC_ALL=fr_FR.UTF-8
>     $ for c in 3000 B250 FF1A; do
>     > src/printf "\\u$c" | src/wc -L
>     > python -c "import unicodedata as ud; print ud.name(unichr(0x$c))"
>     > done
>     1
>     IDEOGRAPHIC SPACE
>     2
>     HANGUL SYLLABLE NWESS
>     0
>     FULLWIDTH COLON

wcwidth(0x3000) and wcwidth(0xFF1A) should both be 2; test-wcwidth.c
verifies this.

Here is a proposed patch, to ensure that wcwidth gets overridden by gnulib
on this system.


2016-01-20  Bruno Haible  <address@hidden>

        wcwidth: Replace also on OpenBSD 5.8.
        * m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Check the value of wcwidth(0xFF1A).
        * doc/posix-functions/wcwidth.texi: Update.

diff --git a/doc/posix-functions/wcwidth.texi b/doc/posix-functions/wcwidth.texi
index d00354b..d15bbb0 100644
--- a/doc/posix-functions/wcwidth.texi
+++ b/doc/posix-functions/wcwidth.texi
@@ -17,7 +17,7 @@ glibc 2.8.
 @item
 This function handles combining characters in UTF-8 locales incorrectly on some
 platforms:
-Mac OS X 10.3, OpenBSD 5.0.
+Mac OS X 10.3, OpenBSD 5.8.
 @end itemize
 
 Portability problems not fixed by Gnulib:
diff --git a/m4/wcwidth.m4 b/m4/wcwidth.m4
index 653f442..7a743c0 100644
--- a/m4/wcwidth.m4
+++ b/m4/wcwidth.m4
@@ -39,6 +39,7 @@ AC_DEFUN([gl_FUNC_WCWIDTH],
     dnl On Mac OS X 10.3, wcwidth(0x0301) (COMBINING ACUTE ACCENT) returns 1.
     dnl On OpenBSD 5.0, wcwidth(0x05B0) (HEBREW POINT SHEVA) returns 1.
     dnl On OSF/1 5.1, wcwidth(0x200B) (ZERO WIDTH SPACE) returns 1.
+    dnl On OpenBSD 5.8, wcwidth(0xFF1A) (FULLWIDTH COLON) returns 0.
     dnl This leads to bugs in 'ls' (coreutils).
     AC_CACHE_CHECK([whether wcwidth works reasonably in UTF-8 locales],
       [gl_cv_func_wcwidth_works],
@@ -74,6 +75,8 @@ int main ()
         result |= 2;
       if (wcwidth (0x200B) > 0)
         result |= 4;
+      if (wcwidth (0xFF1A) == 0)
+        result |= 8;
     }
   return result;
 }]])],




reply via email to

[Prev in Thread] Current Thread [Next in Thread]