[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sed --posix does not catch incomplete arguments
From: |
Bruno Haible |
Subject: |
Re: sed --posix does not catch incomplete arguments |
Date: |
Fri, 18 Jun 2010 14:46:47 +0200 |
User-agent: |
KMail/1.9.9 |
Hi,
Eric Blake reported in
<http://lists.gnu.org/archive/html/bug-gnu-utils/2010-06/msg00060.html>:
> 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.
So, meanwhile, let's document the portability problem in the Autoconf
manual.
Here's what I see on Solaris 10:
$ echo a | sed -n -e 'i\' -e 0
Unrecognized command: 0
And on HP-UX 11:
$ echo a | sed -n -e 'i\' -e 0
sed: Found escape character at end of editing script.
And on AIX 4:
$ echo a | sed -n -e 'i\' -e 0
sed: 0602-403 0 is not a recognized function.
Here's a proposed patch.
2010-06-18 Bruno Haible <address@hidden>
* doc/autoconf.texi (Limitations of Usual Tools): Mention portability
problem of sed -e option with script fragments.
*** doc/autoconf.texi.orig Fri Jun 18 14:40:10 2010
--- doc/autoconf.texi Fri Jun 18 14:38:20 2010
***************
*** 18237,18242 ****
--- 18237,18258 ----
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
+ @command{sed} programs on Solaris 10, HP-UX 11, and AIX don't allow it
+ either:
+
+ @example
+ $ @kbd{echo a | sed -n -e 'i\}
+ @kbd{0'}
+ 0
+ $ @kbd{echo a | sed -n -e 'i\' -e 0}
+ Unrecognized command: 0
+ @end 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
- Re: sed --posix does not catch incomplete arguments,
Bruno Haible <=