Date: Thu, 28 Oct 2010 21:51:14 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r214490 - in head: bin/sh tools/regression/bin/sh/expansion Message-ID: <201010282151.o9SLpE7l034115@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Thu Oct 28 21:51:14 2010 New Revision: 214490 URL: http://svn.freebsd.org/changeset/base/214490 Log: sh: Make double-quotes quote a '}' inside ${v#...} and ${v%...}. Exp-run done by: pav (with some other sh(1) changes) PR: bin/57554 Added: head/tools/regression/bin/sh/expansion/trim5.0 (contents, props changed) Modified: head/bin/sh/parser.c Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Thu Oct 28 20:18:26 2010 (r214489) +++ head/bin/sh/parser.c Thu Oct 28 21:51:14 2010 (r214490) @@ -1234,7 +1234,8 @@ readtoken1(int firstc, char const *initi case CENDVAR: /* '}' */ if (level > 0 && (state[level].category == TSTATE_VAR_OLD || - state[level].category == TSTATE_VAR_NEW)) { + (state[level].category == TSTATE_VAR_NEW && + state[level].syntax == BASESYNTAX))) { if (state[level].category == TSTATE_VAR_OLD) state[level - 1].syntax = state[level].syntax; else Added: head/tools/regression/bin/sh/expansion/trim5.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/trim5.0 Thu Oct 28 21:51:14 2010 (r214490) @@ -0,0 +1,28 @@ +# $FreeBSD$ + +e= q='?' a='*' t=texttext s='ast*que?non' p='/et[c]/' w='a b c' b='{{(#)}}' +h='##' +failures='' +ok='' + +testcase() { + code="$1" + expected="$2" + oIFS="$IFS" + eval "$code" + IFS='|' + result="$#|$*" + IFS="$oIFS" + if [ "x$result" = "x$expected" ]; then + ok=x$ok + else + failures=x$failures + echo "For $code, expected $expected actual $result" + fi +} + +testcase 'set -- "${b%'\'}\''}"' '1|{{(#)}' +testcase 'set -- ${b%"}"}' '1|{{(#)}' +testcase 'set -- "${b%"}"}"' '1|{{(#)}' + +test "x$failures" = x
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010282151.o9SLpE7l034115>