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: Pádraig Brady
Subject: Re: wcwidth on OpenBSD 5.8
Date: Thu, 21 Jan 2016 11:55:23 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 21/01/16 10:32, Bruno Haible wrote:
> 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;
>  }]])],

+1

I was wondering about a more general check in the m4 file
that verified all our internal values against the system wcwidth(),
though perhaps that is too draconian and dependent on system
fonts etc. rather than unicode standards?

thanks,
Pádraig.



reply via email to

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