Date: Mon, 14 Jan 2013 12:20:55 +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: r245422 - in head: bin/sh tools/regression/bin/sh/expansion Message-ID: <201301141220.r0ECKtY4071480@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Mon Jan 14 12:20:55 2013 New Revision: 245422 URL: http://svnweb.freebsd.org/changeset/base/245422 Log: sh: Pass $? to command substitution containing compound/multiple commands. Example: false; echo $(echo $?; :) Added: head/tools/regression/bin/sh/expansion/cmdsubst17.0 (contents, props changed) Modified: head/bin/sh/eval.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Mon Jan 14 12:12:56 2013 (r245421) +++ head/bin/sh/eval.c Mon Jan 14 12:20:55 2013 (r245422) @@ -624,8 +624,8 @@ evalbackcmd(union node *n, struct backcm exitstatus = 0; goto out; } + exitstatus = oexitstatus; if (is_valid_fast_cmdsubst(n)) { - exitstatus = oexitstatus; savelocalvars = localvars; localvars = NULL; forcelocal++; @@ -649,7 +649,6 @@ evalbackcmd(union node *n, struct backcm poplocalvars(); localvars = savelocalvars; } else { - exitstatus = 0; if (pipe(pip) < 0) error("Pipe call failed: %s", strerror(errno)); jp = makejob(n, 1); Added: head/tools/regression/bin/sh/expansion/cmdsubst17.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/cmdsubst17.0 Mon Jan 14 12:20:55 2013 (r245422) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +f() { return 3; } +f +[ `echo $?; :` = 3 ]
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301141220.r0ECKtY4071480>