From owner-svn-src-stable@freebsd.org Sun Dec 9 19:14:22 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BEC5C132BA28; Sun, 9 Dec 2018 19:14:22 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 652E2771CA; Sun, 9 Dec 2018 19:14:22 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46D5815707; Sun, 9 Dec 2018 19:14:22 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wB9JEMHH053537; Sun, 9 Dec 2018 19:14:22 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wB9JELTI053534; Sun, 9 Dec 2018 19:14:21 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201812091914.wB9JELTI053534@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 9 Dec 2018 19:14:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r341767 - in stable/12/bin/sh: . tests/expansion X-SVN-Group: stable-12 X-SVN-Commit-Author: jilles X-SVN-Commit-Paths: in stable/12/bin/sh: . tests/expansion X-SVN-Commit-Revision: 341767 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 652E2771CA X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.94)[-0.943,0]; NEURAL_HAM_LONG(-0.99)[-0.990,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 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: Sun, 09 Dec 2018 19:14:23 -0000 Author: jilles Date: Sun Dec 9 19:14:21 2018 New Revision: 341767 URL: https://svnweb.freebsd.org/changeset/base/341767 Log: MFC r341164: sh: Fix ${param?} default error message If word in ${param?word} is missing, the shell shall write a default error message. So expanding ${param?} when param is not set should write an error message like sh: param: parameter not set This was broken by r316417. PR: 233585 Added: stable/12/bin/sh/tests/expansion/question2.0 - copied unchanged from r341164, head/bin/sh/tests/expansion/question2.0 Modified: stable/12/bin/sh/expand.c stable/12/bin/sh/tests/expansion/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/bin/sh/expand.c ============================================================================== --- stable/12/bin/sh/expand.c Sun Dec 9 17:55:10 2018 (r341766) +++ stable/12/bin/sh/expand.c Sun Dec 9 19:14:21 2018 (r341767) @@ -623,10 +623,11 @@ static const char * subevalvar_misc(const char *p, struct nodelist **restrict argbackq, const char *var, int subtype, int startloc, int varflags) { + const char *end; char *startp; int amount; - p = argstr(p, argbackq, EXP_TILDE, NULL); + end = argstr(p, argbackq, EXP_TILDE, NULL); STACKSTRNUL(expdest); startp = stackblock() + startloc; @@ -635,7 +636,7 @@ subevalvar_misc(const char *p, struct nodelist **restr setvar(var, startp, 0); amount = startp - expdest; STADJUST(amount, expdest); - return p; + return end; case VSQUESTION: if (*p != CTLENDVAR) { Modified: stable/12/bin/sh/tests/expansion/Makefile ============================================================================== --- stable/12/bin/sh/tests/expansion/Makefile Sun Dec 9 17:55:10 2018 (r341766) +++ stable/12/bin/sh/tests/expansion/Makefile Sun Dec 9 19:14:21 2018 (r341767) @@ -86,6 +86,7 @@ ${PACKAGE}FILES+= plus-minus7.0 ${PACKAGE}FILES+= plus-minus8.0 ${PACKAGE}FILES+= plus-minus9.0 ${PACKAGE}FILES+= question1.0 +${PACKAGE}FILES+= question2.0 ${PACKAGE}FILES+= readonly1.0 ${PACKAGE}FILES+= redir1.0 ${PACKAGE}FILES+= set-u1.0 Copied: stable/12/bin/sh/tests/expansion/question2.0 (from r341164, head/bin/sh/tests/expansion/question2.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/bin/sh/tests/expansion/question2.0 Sun Dec 9 19:14:21 2018 (r341767, copy of r341164, head/bin/sh/tests/expansion/question2.0) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +unset dummyvar +msg=`(: ${dummyvar?}) 2>&1` +r=$? +[ "$r" != 0 ] && case $msg in +*dummyvar?* | *?dummyvar*) : ;; +*) + printf 'Bad message: [%s]\n' "$msg" + exit 1 +esac