From owner-svn-src-stable@FreeBSD.ORG Fri May 21 19:21:48 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 297701065670; Fri, 21 May 2010 19:21:48 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (unknown [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 16C308FC1B; Fri, 21 May 2010 19:21:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o4LJLlfn012730; Fri, 21 May 2010 19:21:47 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o4LJLlS0012727; Fri, 21 May 2010 19:21:47 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201005211921.o4LJLlS0012727@svn.freebsd.org> From: Marius Strobl Date: Fri, 21 May 2010 19:21:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r208397 - in stable/8: tools/regression/usr.bin/sed usr.bin/sed X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 May 2010 19:21:48 -0000 Author: marius Date: Fri May 21 19:21:47 2010 New Revision: 208397 URL: http://svn.freebsd.org/changeset/base/208397 Log: MFC: r197356 Allow [ to be used as a delimiter. Pointed by: Marius Strobl Obtained from: Apple Modified: stable/8/tools/regression/usr.bin/sed/multitest.t stable/8/usr.bin/sed/compile.c Directory Properties: stable/8/tools/regression/usr.bin/sed/ (props changed) stable/8/tools/regression/usr.bin/sed/regress.multitest.out/ (props changed) stable/8/usr.bin/sed/ (props changed) Modified: stable/8/tools/regression/usr.bin/sed/multitest.t ============================================================================== --- stable/8/tools/regression/usr.bin/sed/multitest.t Fri May 21 19:17:31 2010 (r208396) +++ stable/8/tools/regression/usr.bin/sed/multitest.t Fri May 21 19:21:47 2010 (r208397) @@ -432,6 +432,15 @@ u2/g' lines1 # POSIX does not say that this should work, # but it does for GNU, BSD, and SunOS mark '8.17' ; $SED -e 's/[/]/Q/' lines1 + + COMMENT='[ as an s delimiter and its escapes' + mark '8.18' ; $SED -e 's[_[X[' lines1 + # This is a matter of interpretation + # POSIX 1003.1, 2004 says "Within the BRE and the replacement, + # the BRE delimiter itself can be used as a *literal* character + # if it is preceded by a backslash + mark '8.19' ; sed 's/l/[/' lines1 | $SED -e 's[\[.[X[' + mark '8.20' ; sed 's/l/[/' lines1 | $SED -e 's[\[.[X\[[' } test_error() Modified: stable/8/usr.bin/sed/compile.c ============================================================================== --- stable/8/usr.bin/sed/compile.c Fri May 21 19:17:31 2010 (r208396) +++ stable/8/usr.bin/sed/compile.c Fri May 21 19:21:47 2010 (r208397) @@ -387,7 +387,7 @@ compile_delimited(char *p, char *d) errx(1, "%lu: %s: newline can not be used as a string delimiter", linenum, fname); while (*p) { - if (*p == '[') { + if (*p == '[' && *p != c) { if ((d = compile_ccl(&p, d)) == NULL) errx(1, "%lu: %s: unbalanced brackets ([])", linenum, fname); continue;