This is the mail archive of the glibc-bugs-regex@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug regex/11561] New: Collation characters represented by internal name instead of character sequence


In the glibc locale definitions, collating elements have a hyphenated name:

    collating-symbol  <zs>
    collating-element <z-s> from "<U007A><U0073>"

and the hyphenated name have to be used in regular expression for [[. .]] to
work properly:

    $ echo '*ch*' | LC_COLLATE=cs_CZ.UTF-8 sed 's/[[.c-h.]]//'
    **
    $ echo 'ch' | LC_COLLATE=cs_CZ.UTF-8 sed 's/[[.ch.]]//'
    sed: -e expression #1, char 12: Invalid collation character

However, POSIX 1.2008 says:

        A collating symbol is a collating element enclosed within
        bracket-period ( "[." and ".]" ) delimiters. Collating
        elements are defined as described in Collation Order .
        Conforming applications shall represent multi-character
        collating elements as collating symbols when it is
        necessary to distinguish them from a list of the
        individual characters that make up the multi-character
        collating element. For example, if the string "ch" is a
        collating element defined using the line:

        collating-element <ch-digraph> from "<c><h>"

        in the locale definition, the expression "[[.ch.]]" shall
        be treated as an RE containing the collating symbol 'ch',
        while "[ch]" shall be treated as an RE matching 'c' or
        'h' . Collating symbols are recognized only inside
        bracket expressions. If the string is not a collating
        element in the current locale, the expression is invalid.

POSIX especially mentions [[.ch.]] in the example instead of [[.ch-digraph.]] so
this is a bug in glibc.  It shouldn't be hard to fix it in regcomp.

-- 
           Summary: Collation characters represented by internal name
                    instead of character sequence
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: regex
        AssignedTo: bonzini at gnu dot org
        ReportedBy: bonzini at gnu dot org
                CC: glibc-bugs-regex at sources dot redhat dot com,glibc-
                    bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=11561

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]