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

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

sed --posix does not catch incomplete arguments


From: Bruno Haible
Subject: sed --posix does not catch incomplete arguments
Date: Fri, 11 Jun 2010 21:41:27 +0200
User-agent: KMail/1.9.9

Hi,

Using sed 4.2.1.

"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 `{'
  $ sed --posix '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:

  $ : | sed --posix -e '1{'
  sed: -e expression #1, char 0: unmatched `{'
  $ : | sed --posix -e '1{' -e '}'
  $ echo $?
  0

It should reject it always.

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.

Bruno



reply via email to

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