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: Paolo Bonzini
Subject: Re: sed --posix does not catch incomplete arguments
Date: Fri, 11 Jun 2010 23:56:04 +0200

> "sed --posix" does not verify the validity of the -e arguments.
>
> 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 `{'
>
> passing the script '1{' to option -e is also invalid. GNU sed rejects it
> sometimes, but not always:

It's a bug in the spec.  The overall script built by the -e option
shall have the same properties as the script operand, but not the
single options.  BSD sed does the same and, in fact, I'm pretty sure
this use is portable to even the crappiest seds.

> Note that I'm not asking to change the behaviour of 'sed' without --posix.
> It is very hard in some environments (e.g. inside Makefiles) to produce
> literal newlines, therefore the ability to use multiple -e options instead of
> newlines is a welcome extension of POSIX.

I would say the inability to use multiple -e options instead of
newlines is an unwanted bug of POSIX, instead.

Anybody can report this to the Austin group?

Paolo



reply via email to

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