bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: sed --posix


From: Eric Blake
Subject: Re: sed --posix
Date: Wed, 27 May 2009 06:31:19 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Paolo Bonzini on 5/27/2009 6:15 AM:
>> While we already determined that the expression is using the non-portable
>> \|, and thus using --posix is allowed to change the behavior, I think we
>> have also found an actual bug in sed 4.2.
> 
> Not a bug, sed --posix disables \| altogether (and \+, \?, \<, \>,
> etc.).  Unless you had something different in mind?

My report is not about disabling \|, but about not issuing an error
message when \| is encountered.

In other words, since \| is unspecified, there are at least three viable
behaviors for \|:

\| is treated like |, matching a literal | (traditional behavior)
\| is treated as an alternation operator (GNU behavior)
\| is an error (my preference)

My claim that sed has a bug is that you chose the first behavior without
- --posix, and the second behavior with --posix; from the script-writer's
perspective, we want the first behavior without --posix, but the third
behavior with --posix.  You are correct that there is no conformance bug
regardless of which of the three options you use.  Rather, it is a QoI bug
in that you are not friendly to the user given the intent of what --posix
is documented as doing.

> 
>>  My preference would be that
>> 'sed --posix' failed with a verbose error message when undefined input
>> like \| is detected, rather than silently changing behavior.
> 
> This is hard, since regex does not have a flag for "fail on this
> escape", just for "enable/disable this escape".

Hard or not, that is exactly what I'm asking for.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkodMpcACgkQ84KuGfSFAYC4WwCgrDhWXWwP05nLYgVWd0Dc7nIF
oukAn1FZ1WcN1/muiGeGjdqLw+vEGBVb
=/QVb
-----END PGP SIGNATURE-----




reply via email to

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