bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: have you ever mistyped [[:lower:]] as [:lower:] ?


From: Jim Meyering
Subject: Re: have you ever mistyped [[:lower:]] as [:lower:] ?
Date: Wed, 01 Sep 2010 16:01:22 +0200

Paolo Bonzini wrote:
> On 09/01/2010 03:45 PM, Jim Meyering wrote:
>>>>> It's a huge mistake, because making it an error means
>>>>> changing the regex grammar (and making it unnecessarily complicated
>>>>> and contrived).
>>>>
>>>> It's already done in grep, and wasn't a very big change.
>>>
>>> You're conflating the formal grammar and the code that implements
>>> it. The latter is allowed to include this kind of "hack", the former
>>> cannot. POSIX
>>
>> It's done for grep.
>> I see no need to change any formal grammar.
>
> Do you honestly imagine
> http://opengroup.org/onlinepubs/007908775/xbd/re.html changed to say
> "If a bracket expression consists of a colon, a series of alphabetic
> characters, and another colon, the implementation's behavior is
> undefined?

Perhaps that is where we disagree, then.
I do not require that POSIX allow the new behavior.

>>>> It sounds like you're upset.
>>>> Sorry it's come to that, but I feel strongly about this, too.
>>>
>>> I'm not upset, but I'm very much worried of making a mistake.  What if
>>> someone proposes to warn for [A-Z] and [a-z] whenever they're not
>>> going to do what the user thinks (they're not synonyms of any of
>>> [[:upper:]], [[:lower:]], [[:alpha:]])?  Are we going to make that an
>>> error?
>>
>> "We have nothing to fear but fear itself".
>> But I doubt you're seriously worried about [A-Z], etc.
>
> Not worried, but it honestly would be a sensible warning whenever
> strcoll ("A", "f") <= 0 && strcoll ("f", "Z") <= 0, as is the case in
> UTF-8 locales with glibc.  It will basically never do the right thing,
> since [A-Z] and [a-z] exclude a and Z respectively.

Ranges like [A-Z] are so common that changing the default
would have far-reaching effects.  Will it ever be possible?
I don't know.  Perhaps if we first allow it to be enabled via
some new environment variable, and then, much later, make it the default.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]