Hi,

_C_ctype_ (ctype) and _DefaultRuneLocale.rl_runetype (wctype) are
currently unsynced, resulting regress/lib/libc/locale/check_isw to
failed.

The problem is _C_ctype_ (in gen/ctype_.c) and _DefaultRuneLocale (in
locale/runetable.c) define differently characters class for char >= 0x80.

After checking with FreeBSD, NetBSD and DragonFlyBSD: OpenBSD is alone
to define something different from 0 for char >= 0x80 (outside 7bit
ASCII) in default configuration (which should be "C" or "POSIX").

The following chart
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap06.html
show that the portable character set have 7bit long. "POSIX.1-2008 uses
character names other than the above, but only in an informative way".

The following patch reduce defining rl_runetype of _DefaultRuneLocale to
0x00-0x7f.

After this patch, regress/lib/libc/locale/check_isw pass.


Note I am unsure on a point: the array is defined to be _CACHED_RUNES
(1<<8 = 256) elements in size. Here the initialisation is for 128
elements.

> int tab[256] = {0, 1, 2, ..., 126, 127};

Should the rest of the array be initialised with zero ? or the compiler
will do it alone ? I have checked NetBSD, FreeBSD and DragonflyBSD: all
have this construct (array of 256, initialisation with 128 elements).

I also do several tests with MALLOC_OPTIONS and differents sizes of
array, and all remainings elements are 0.

Comments ? OK ?
-- 
Sebastien Marie

Index: locale/runetable.c
===================================================================
RCS file: /cvs/src/lib/libc/locale/runetable.c,v
retrieving revision 1.6
diff -u -p -r1.6 runetable.c
--- locale/runetable.c  12 Apr 2015 20:18:41 -0000      1.6
+++ locale/runetable.c  7 Jul 2015 06:39:47 -0000
@@ -177,6 +177,7 @@ _RuneLocale _DefaultRuneLocale = {
                _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
                _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
                _CTYPE_C,
+#if 0
        /*80*/  _CTYPE_C, 
                _CTYPE_C, 
                _CTYPE_C,
@@ -305,6 +306,7 @@ _RuneLocale _DefaultRuneLocale = {
                _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
                _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
                _CTYPE_P|_CTYPE_R|_CTYPE_G|_CTYPE_SW1,
+#endif
     },
     {  0x00,   0x01,   0x02,   0x03,   0x04,   0x05,   0x06,   0x07,
        0x08,   0x09,   0x0a,   0x0b,   0x0c,   0x0d,   0x0e,   0x0f,

Reply via email to