GNU bug report logs - #16895
[PATCH] grep: fix multiple bugs with bracket expressions

Previous Next

Package: grep;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Thu, 27 Feb 2014 17:35:01 UTC

Severity: normal

Tags: fixed, patch

Fixed in versions 16232, 16777

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #15 received at 16895 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Aharon Robbins <arnold <at> skeeve.com>, 16895 <at> debbugs.gnu.org
Subject: Re: bug#16895: [PATCH] grep: fix multiple bugs with bracket
 expressions
Date: Thu, 27 Feb 2014 13:24:53 -0800
[Message part 1 (text/plain, inline)]
On 02/27/2014 12:31 PM, Aharon Robbins wrote:
> What a mouthful!  Is all that really necessary?
>

You should have seen it before I trimmed it down; it listed every POSIX 
character.  I dunno, maybe it could be trimmed, but I was worried about 
oddball character sets like the unibyte JIS character set that's like 
ASCII but substitutes Yen-sign for '\', and a couple of other 
substitutions like that.  I figured better safe than sorry.  No big deal 
of course.

> I'd suggest parentheses around the bit with the bitwise operator, both 
> for readability and to match the rest of the code. 

Done, with the attached patch.  Oh, and I fixed an xdigit buglet I found 
too, in the second patch in the attachment.

>> >@@ -1000,7 +1043,10 @@ parse_bracket_exp (void)
>> >                /* Fetch bracket.  */
>> >                FETCH_WC (c, wc, _("unbalanced ["));
>> >                if (c1 == ':')
>> >-                /* build character class.  */
>> >+                /* Build character class.  POSIX allows character
>> >+                   classes to match multicharacter collating elements,
>> >+                   but the regex code does not support that, so do not
>> >+                   worry about that possibility.  */
> I thought GLIBC did support them?
Source code says no.  That is, [[:alpha:]] never matches a 
multicharacter collating sequence.  [[=a=]] might do so, but [[:alpha:]] 
doesn't.  (Unless I'm reading the source code wrong, which is possible.  
It's not documented either way, as far as I know.)
[grep.diff (text/x-patch, attachment)]

This bug report was last modified 11 years and 83 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.