From owner-freebsd-bugs Sun Dec 9 15:10:17 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 52F5E37B41C for ; Sun, 9 Dec 2001 15:10:02 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id fB9NA2K77592; Sun, 9 Dec 2001 15:10:02 -0800 (PST) (envelope-from gnats) Received: from mailhost.auckland.ac.nz (mailhost.auckland.ac.nz [130.216.1.4]) by hub.freebsd.org (Postfix) with ESMTP id DB0E937B405 for ; Sun, 9 Dec 2001 15:05:42 -0800 (PST) Received: from stat1.stat.auckland.ac.nz (stat1.stat.auckland.ac.nz [130.216.93.1]) by mailhost.auckland.ac.nz (8.9.2/8.9.2/8.9.2-ua) with ESMTP id MAA07447 for ; Mon, 10 Dec 2001 12:05:36 +1300 (NZDT) Received: (from ihaka@localhost) by stat1.stat.auckland.ac.nz (8.10.2+Sun/8.8.8) id fB9N5a017671 for FreeBSD-gnats-submit@freebsd.org; Mon, 10 Dec 2001 12:05:36 +1300 (NZDT) Message-Id: <200112092305.fB9N5a017671@stat1.stat.auckland.ac.nz> 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 Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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