Bug 506521 - [RHEL4] using REG_ICASE with regcomp() can break ranges
Summary: [RHEL4] using REG_ICASE with regcomp() can break ranges
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: glibc
Version: 4.8
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Andreas Schwab
QA Contact: BaseOS QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-06-17 15:56 UTC by Jeff Bastian
Modified: 2010-05-11 16:05 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 506525 (view as bug list)
Environment:
Last Closed: 2010-05-11 13:14:22 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
test case (716 bytes, text/plain)
2009-06-17 16:09 UTC, Jeff Bastian
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Sourceware 10290 0 None None None Never

Description Jeff Bastian 2009-06-17 15:56:26 UTC
Description of problem:
Using a regular expression range like [C-a] works fine if compiled with
regcomp() with just the REG_EXTENDED flag, but if the REG_ICASE flag is added
too, regcomp() returns an error "Invalid range end".

Testing other ranges with REG_ICASE reveals:
    [A-Z^-z] is invalid: Invalid range end (11)
    [A-Z^_`a-z] is ok
    [C-a] is invalid: Invalid range end (11)
    [C-f] is ok
    [_-a] is invalid: Invalid range end (11)
    [<-a] is ok
    [z-{] is ok

It appears that regcomp() is capitalizing the range if the REG_ICASE flag is
used, thus [C-a] becomes [C-A] and since A comes before C, the range is invalid.
 Likewise, in locales that match ASCII, ^ becomes before z, but after Z, so
[A-Z^-z] becomes invalid, and _ comes after A but before a, so [_-a] becomes
invalid.

If this is not considered a bug, then at the very least, the regex(3) man page
should note the side-effects of using REG_ICASE.

Version-Release number of selected component (if applicable):
glibc-2.3.4-2.43

How reproducible:
every time

Steps to Reproduce:
1. compile a regex range [C-a] or [_-a] with regcomp() and REG_ICASE flag
  
Actual results:
regcomp() returns an "Invalid range end" error

Expected results:
regcomp() is consistent with or without REG_ICASE flag

Additional info:
If this is considered not a bug, then please update the regcomp(3) man page to note the side effects of using REG_ICASE.

Comment 1 Jeff Bastian 2009-06-17 15:57:21 UTC
Reported upstream at http://sourceware.org/bugzilla/show_bug.cgi?id=10290

Comment 2 Jeff Bastian 2009-06-17 16:09:17 UTC
Created attachment 348288 [details]
test case

Comment 4 RHEL Program Management 2010-05-11 13:14:22 UTC
Development Management has reviewed and declined this request.  You may appeal
this decision by reopening this request.


Note You need to log in before you can comment on or make changes to this bug.