Date: Mon, 10 Dec 2001 12:05:36 +1300 (NZDT) From: ihaka@stat.auckland.ac.nz To: FreeBSD-gnats-submit@freebsd.org Subject: bin/32657: sed incompatibility Message-ID: <200112092305.fB9N5a017671@stat1.stat.auckland.ac.nz>
next in thread | raw e-mail | index | archive | help
>Number: 32657
>Category: bin
>Synopsis: sed file handing is non-standard
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun Dec 09 15:10:02 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Ross Ihaka
>Release: FreeBSD 4.2-RELEASE i386
>Organization:
Statistics Department, University of Auckland
>Environment:
not relevant
>Description:
The sed manual entry says:
The ``r'' and ``w'' functions take an optional file parameter,
which should be separated from the function letter by white
space. Each file given as an argument to sed is created
(or its contents truncated) before any input processing
begins.
Under FreeBSD (and possibly other BSD systems) the file parameter
is mandatory -- sed terminates with an error message if an
editing command of one of the forms
/pattern/r
/pattern/w
is encountered. Other sed versions (e.g. GNU and Solaris) silently
ignore such constructions.
This kind constructions appears in scripts generated by autoconf
which work on other platforms, but not FreeBSD.
>How-To-Repeat:
Utter the command:
sed '/pattern/r'
>Fix:
In /usr/src/usr.bin/sed/compile.c in the function compile_stream,
(cases WFILE and RFILE) there are lines
if (*p == '\0')
errx(1, "%lu: %s: filename expected", linenum, fname);
else
cmd->t = duptoeol(p, "read command");
removing the first three of these lines will cause the filename
"" to be passed on for later processing. This will produce
the same effect as specifying a file which does not exist
(the problem is silently ignored).
This change would produce a warning message from duptoeol about
trailing white space. This message does not seem to occur in
other sed variants.
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200112092305.fB9N5a017671>
