Project

General

Profile

Actions

Bug #169

closed

Lack of "rune" wctype breaks tr -C

Added by Rich Lowe over 11 years ago. Updated over 11 years ago.

Status:
Resolved
Priority:
Normal
Category:
-
Start date:
2010-09-08
Due date:
% Done:

100%

Estimated time:
1.00 h
Difficulty:
Tags:
Gerrit CR:

Description

Our wctype() lacks the "rune" type, which tr -C relies upon to generate (I think) a complete current character set.

The FreeBSD value cannot be used verbatm, because we're trying to make our wctype compatible with existing Solaris software (again, I think).

Assuming that "rune" is a wildcard "anything valid", the following works:

diff -r afcbcdcb5b04 usr/src/lib/libc/port/locale/wctype.c
--- a/usr/src/lib/libc/port/locale/wctype.c    Wed Sep 08 03:45:10 2010 -0400
+++ b/usr/src/lib/libc/port/locale/wctype.c    Wed Sep 08 09:04:20 2010 -0400
@@ -57,6 +57,11 @@
         { "ideogram",    _CTYPE_I },    /* BSD extension */
         { "special",    _CTYPE_T },    /* BSD extension */
         { "phonogram",    _CTYPE_Q },    /* BSD extension */
+        /* BSD extension */
+        { "rune",    _CTYPE_A|_CTYPE_C|_CTYPE_D|_CTYPE_G|
+                _CTYPE_L|_CTYPE_L|_CTYPE_P|_CTYPE_S|
+                _CTYPE_U|_CTYPE_X|_CTYPE_B|_CTYPE_R|
+                _CTYPE_I|_CTYPE_T|_CTYPE_Q},
         { NULL,        0UL },        /* Default */
     };
     int i;

% prtconf | grep Memory | LD_PRELOAD=./i386/libc.so.1 ../../cmd/tr/tr -dC '[0-9]' && echo
5375

But this is a complete guess: FreeBSD uses the value: 0xFFFFFF00L, which matches the range of their _CTYPE constants, and so...

It should be cautiously checked by someone who understands this (Garrett?)

Actions #1

Updated by Garrett D'Amore over 11 years ago

  • Assignee set to Garrett D'Amore

Rich, almost, but not quite correct.

We need to look against "0xffffffffU" ... i.e. if any bit is set for the character then it qualifies as a rune. I.e. its a valid encoding in the locale.

Actions #2

Updated by Garrett D'Amore over 11 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 10
  • Estimated time set to 1.00 h

The fix for this is now integrated.

Actions #3

Updated by Garrett D'Amore over 11 years ago

  • % Done changed from 10 to 100
Actions

Also available in: Atom PDF