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

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

Re: sed POSIX compatibility regarding '|' in regular expressions


From: Eric Blake
Subject: Re: sed POSIX compatibility regarding '|' in regular expressions
Date: Thu, 14 Dec 2006 07:27:50 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.8) Gecko/20061025 Thunderbird/1.5.0.8 Mnenhy/0.7.4.666

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

According to Bruno Haible on 12/14/2006 7:10 AM:
> Hi,
> 
> POSIX states in [1], section "Regular Expressions in sed", that sed uses
> basic regular expressions, with three minor modifications. The syntax
> of basic regular expressions is defined in [2]. According to the text
> and to the "RE and Bracket Expression Grammar" section at the end of this
> page, POSIX BREs don't support alternation. "The interpretation of an ordinary
> character preceded by a backslash ( '\' ) is undefined" - so this means
> that the use of '\|' in BREs is a GNU extension.
> 
> Bug #1: The --posix option fails to turn off this GNU extension.

I disagree.  The fact that \| is undefined in POSIX means that sed is free
to assign it any meaning it wants, including as the alternation operator,
and this does not count as an extension since POSIX left it undefined.  A
POSIX portable application will never pass such a sequence to sed.  I
would prefer the goal of 'sed --posix' to be disabling only GNU extensions
that conflict with POSIX, rather than crippling sane semantics for
sequences intentionally left undefined by POSIX.

- --
Life is short - so eat dessert first!

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

iD8DBQFFgV9m84KuGfSFAYARAi+uAJ9TxeWAcwVqviMEDV50flKJPefrFwCfXpd7
0ewlpvuZiQS/O69w9r3gvZ8=
=qUwQ
-----END PGP SIGNATURE-----




reply via email to

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