[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sed --posix does not catch incomplete arguments
From: |
Ralf Wildenhues |
Subject: |
Re: sed --posix does not catch incomplete arguments |
Date: |
Tue, 22 Jun 2010 07:29:35 +0200 |
User-agent: |
Mutt/1.5.20 (2010-04-22) |
[ moving from bug-autoconf ]
Hi Bruno, Eric,
* Bruno Haible wrote on Tue, Jun 22, 2010 at 01:42:20AM CEST:
> Ralf Wildenhues wrote:
> > > Here's what I see on Solaris 10:
> > >
> > > $ echo a | sed -n -e 'i\' -e 0
> > > Unrecognized command: 0
> >
> > JFTR, while i\ is a problem for some seds, I don't find any sed that
> > rejects
> > sed -e 1{ -e }
> >
> > among IRIX 6.5, AIX 5.1, Tru64 5.1D, BSDs, Solaris 2.6 or newer.
> > The problem seems to be relevant only for scripts ending trailing
> > backslash (which is far less often a problem in sed scripts).
>
> OK, feel free to change the wording that I submitted (doc/autoconf.texi around
> line 18244).
Here's a suggestion.
Cheers,
Ralf
Specify sed -e limitation in more detail.
* doc/autoconf.texi (Limitations of Usual Tools): Document that
splitting along sed command boundaries is portable in practice.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index c2772fe..4dfde1d 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -18239,13 +18239,13 @@ Limitations of Usual Tools
should use semicolon only with simple scripts that do not use these
verbs.
-The argument of the @option{-e} option must be a syntactically complete
-script. GNU @command{sed} allows to pass multiple script fragments,
-each as argument of a separate @option{-e} option, that are then combined,
-with newlines between the fragments. A future Posix revision may allow
-this as well. But in Posix:2008, this is not allowed, and the
address@hidden programs on Solaris 10, HP-UX 11, and AIX don't allow it
-either:
+Posix up to the 2008 revision requires the argument of the @option{-e}
+option to be a syntactically complete script. GNU @command{sed} allows
+to pass multiple script fragments, each as argument of a separate
address@hidden option, that are then combined, with newlines between the
+fragments, and a future Posix revision may allow this as well. For
+example, the @command{sed} programs on Solaris 10, HP-UX 11, and AIX
+don't allow splitting in this case:
@example
$ @kbd{echo a | sed -n -e 'i\}
@@ -18255,6 +18255,17 @@ Limitations of Usual Tools
Unrecognized command: 0
@end example
address@hidden
+In practice, however, it is portable to pass fragments to separate
address@hidden options that each represent full @command{sed} commands,
+even if that is not specified by Posix:
+
address@hidden
address@hidden The quote around the closing brace silences interactive zsh.
+$ @kbd{echo a | sed -n -e '/a/@{' -e s/a/b/ -e p -e '@}'}
+b
address@hidden example
+
Commands inside @{ @} brackets are further restricted. Posix says that
they cannot be preceded by addresses, @samp{!}, or @samp{;}, and that
each command must be followed immediately by a newline, without any