Current-Users archive

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

Re: bug in libtre (regexp library) [was Re: sed broken]



On 13 February 2011 15:09, David Laight <david%l8s.co.uk@localhost> wrote:
> On Sun, Feb 13, 2011 at 01:29:08AM +0100, Pouya D. Tafti wrote:
>> After puzzling on this for quite some time, it eventually dawned on me
>> that I had enabled the TRE regexp library in mk.conf by adding to it
>> the line
>>
>> Â Â USE_LIBTRE=yes
>>
>> Rebuilding libc without libtre appears to have resolved the issue.
>
> It isn't 100% clear to me that the solitary * in s/*/-/g isn't an
> illegal regexp! Or does the standard explicitly say that a leading *
> doesn't have a special meaning. The repexp would be safer as s/\*/-/
> (with appropriate quoting).

From sed(1):

    The sed regular expressions are basic regular expressions
    (BRE's, see re_format(7) for more information).

From re_format(7):

    Obsolete (``basic'') regular expressions differ in several respects.
    [...] `*' is an ordinary character if it appears at the beginning
    of the RE or the beginning of a parenthesized subexpression
    (after a possible leading `^').

At any rate, I would expect the behaviour to be the same with or
without TRE.  The current behaviour with TRE also deviates from the
other BSDs that I had access to (FreeBSD and Mac OS X).

Pouya


Home | Main Index | Thread Index | Old Index