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

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

Re: sed --posix does not catch incomplete arguments


From: Eric Blake
Subject: Re: sed --posix does not catch incomplete arguments
Date: Thu, 17 Jun 2010 09:33:10 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-3.fc13 Lightning/1.0b2pre Mnenhy/0.8.2 Thunderbird/3.0.4

On 06/11/2010 03:10 PM, Ralf Wildenhues wrote:
> Hello Bruno,
> 
> * Bruno Haible wrote on Fri, Jun 11, 2010 at 09:41:27PM CEST:
>> Quoting <http://www.opengroup.org/onlinepubs/9699919799/utilities/sed.html>:
>>   "-e  script
>>                Add the editing commands specified by the script
>>                option-argument to the end of the script of editing commands.
>>                The script option-argument shall have the same properties as
>>                the script operand, described in the OPERANDS section."
>>
>> Since "sed '1{'" is invalid
>>
>>   $ sed '1{'
>>   sed: -e expression #1, char 0: unmatched `{'
>>   $ sed --posix '1{'
>>   sed: -e expression #1, char 0: unmatched `{'
>>
>> passing the script '1{' to option -e is also invalid.
> 
> Ouch.  That would be a problem, because not splitting brace arguments to
> multiple -e options (or introducing embedded newlines) is not portable
> to some non-GNU seds.  IIRC.  I'll check.  GNU software uses this in
> a few cases, esp. in makefiles of course.

About the only portable alternative that I could think of for a makefile
would be to use multiple echo (or printf) into a temporary file, then
use sed -f file, rather than relying on multiple -e.  The Austin group
take this morning is that allowing -e fragments is a useful addition for
the next revision of the standard, but that there are still
implementations today (like AIX) that don't support it now, so it will
be several years before sed -e 1{ -e } is standardized.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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