From owner-freebsd-standards@FreeBSD.ORG Sun Apr 23 21:40:26 2006 Return-Path: X-Original-To: freebsd-standards@hub.freebsd.org Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ECD5A16A404 for ; Sun, 23 Apr 2006 21:40:26 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id EF4F343D62 for ; Sun, 23 Apr 2006 21:40:18 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k3NLeIaC080542 for ; Sun, 23 Apr 2006 21:40:18 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k3NLeIau080541; Sun, 23 Apr 2006 21:40:18 GMT (envelope-from gnats) Resent-Date: Sun, 23 Apr 2006 21:40:18 GMT Resent-Message-Id: <200604232140.k3NLeIau080541@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-standards@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Andreas Kohn" Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 56B0D16A402 for ; Sun, 23 Apr 2006 21:39:26 +0000 (UTC) (envelope-from andreas@syndrom23.de) Received: from vs159088.vserver.de (syndrom23.de [62.75.159.88]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9235A43D46 for ; Sun, 23 Apr 2006 21:39:24 +0000 (GMT) (envelope-from andreas@syndrom23.de) Received: from [212.204.44.203] (helo=klamath.syndrom23.de) by vs159088.vserver.de with esmtpa (Exim 4.50) id 1FXmIZ-00005B-Vk for FreeBSD-gnats-submit@freebsd.org; Sun, 23 Apr 2006 23:39:20 +0200 Message-Id: <1145828362.16563@klamath.syndrom23.de> Date: Sun, 23 Apr 2006 23:39:22 +0200 From: "Andreas Kohn" To: "FreeBSD gnats submit" X-Send-Pr-Version: gtk-send-pr 0.4.7 Cc: Subject: standards/96236: [PATCH] [POSIX] sed.1 incorrectly describes a function-list X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2006 21:40:29 -0000 >Number: 96236 >Category: standards >Synopsis: [PATCH] [POSIX] sed.1 incorrectly describes a function-list >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-standards >State: open >Quarter: >Keywords: >Date-Required: >Class: doc-bug >Submitter-Id: current-users >Arrival-Date: Sun Apr 23 21:40:18 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Andreas Kohn >Release: FreeBSD 7.0-CURRENT i386 >Organization: >Environment: System: FreeBSD 7.0-CURRENT #41: Fri Mar 17 12:01:02 CET 2006 root@klamath.syndrom23.de:/usr/obj/usr/src/sys/KLAMATH >Description: sed.1 says about a function-list: This is a list of sed functions separated by newlines, as follows: The ``{'' can be preceded by white space and can be followed by white space. The function can be preceded by white space. The terminating ``}'' must be preceded by a newline or optional white space. According to SUS, this is incorrect: The shall be preceded by a and can be preceded or followed by s. The sed command does follow SUS, see attached test case. GNU sed (4.1.4 tested) also allows that the } is only preceeded by whitespace, see attached test case. A simple fix would be to replace the "or" with an "and", as in the patch. >How-To-Repeat: Try the test case from sed-check.shar with both SED=sed and SED=gsed. Compare with documentation and SUS. >Fix: --- sed-check.shar begins here --- # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # sed-check # sed-check/Makefile # sed-check/testcase.gsed # sed-check/testcase.txt # echo c - sed-check mkdir -p sed-check > /dev/null 2>&1 echo x - sed-check/Makefile sed 's/^X//' >sed-check/Makefile << 'END-of-sed-check/Makefile' X# Check for [2addr] function-list functionaly of sed X X# try with gsed XSED?=sed X Xtest: X if ! ${SED} -e '/start/,/end/ { s/foobar/barbaz/ }' testcase.txt > testcase.out; then \ X echo FAILED ; \ X else \ X if ! cmp -s testcase.gsed testcase.out; then \ X echo FAILED ; \ X else \ X echo PASSED ; \ X fi \ X fi X X END-of-sed-check/Makefile echo x - sed-check/testcase.gsed sed 's/^X//' >sed-check/testcase.gsed << 'END-of-sed-check/testcase.gsed' Xsome text which should not be touched Xalthough it does contain the search strings "foobar" X Xstart Xhere is some text that also contains barbaz, which should be changed. Xsome more text. Xend X Xthe next foobar should stay foobar. X END-of-sed-check/testcase.gsed echo x - sed-check/testcase.txt sed 's/^X//' >sed-check/testcase.txt << 'END-of-sed-check/testcase.txt' Xsome text which should not be touched Xalthough it does contain the search strings "foobar" X Xstart Xhere is some text that also contains foobar, which should be changed. Xsome more text. Xend X Xthe next foobar should stay foobar. X END-of-sed-check/testcase.txt exit --- sed-check.shar ends here --- --- sed.1-function-list.diff begins here --- Index: sed.1 =================================================================== RCS file: /storage/freebsd/cvs/src/usr.bin/sed/sed.1,v retrieving revision 1.43 diff -u -r1.43 sed.1 --- sed.1 14 Jun 2005 11:50:52 -0000 1.43 +++ sed.1 23 Apr 2006 21:29:32 -0000 @@ -280,7 +280,7 @@ The function can be preceded by white space. The terminating .Dq } -must be preceded by a newline or optional white space. +must be preceded by a newline and optional white space. .Pp .Bl -tag -width "XXXXXX" -compact .It [2addr] function-list --- sed.1-function-list.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: