From owner-svn-src-all@FreeBSD.ORG Tue Nov 9 22:32:12 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77D9A10657A5; Tue, 9 Nov 2010 22:32:12 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 497448FC14; Tue, 9 Nov 2010 22:32:12 +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 oA9MWCRU055340; Tue, 9 Nov 2010 22:32:12 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oA9MWC1x055336; Tue, 9 Nov 2010 22:32:12 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201011092232.oA9MWC1x055336@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 9 Nov 2010 22:32:12 +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: r215066 - in stable/8: bin/sh tools/regression/bin/sh/expansion X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Nov 2010 22:32:12 -0000 Author: jilles Date: Tue Nov 9 22:32:11 2010 New Revision: 215066 URL: http://svn.freebsd.org/changeset/base/215066 Log: MFC r198454: sh: Exempt $@ and $* from set -u This seems more useful and will likely be in the next POSIX standard. Also document more precisely in the man page what set -u does (note that $@, $* and $! are the only special parameters that can ever be unset, all the others are always set, although they may be empty). Added: stable/8/tools/regression/bin/sh/expansion/set-u2.0 - copied unchanged from r198454, head/tools/regression/bin/sh/expansion/set-u2.0 Modified: stable/8/bin/sh/expand.c stable/8/bin/sh/sh.1 Directory Properties: stable/8/bin/sh/ (props changed) stable/8/tools/regression/bin/sh/ (props changed) Modified: stable/8/bin/sh/expand.c ============================================================================== --- stable/8/bin/sh/expand.c Tue Nov 9 22:32:09 2010 (r215065) +++ stable/8/bin/sh/expand.c Tue Nov 9 22:32:11 2010 (r215066) @@ -670,7 +670,7 @@ again: /* jump here after setting a vari } varlen = 0; startloc = expdest - stackblock(); - if (!set && uflag) { + if (!set && uflag && *var != '@' && *var != '*') { switch (subtype) { case VSNORMAL: case VSTRIMLEFT: Modified: stable/8/bin/sh/sh.1 ============================================================================== --- stable/8/bin/sh/sh.1 Tue Nov 9 22:32:09 2010 (r215065) +++ stable/8/bin/sh/sh.1 Tue Nov 9 22:32:11 2010 (r215066) @@ -311,7 +311,10 @@ sh -T -c "trap 'exit 1' 2 ; some-blockin .Ed .It Fl u Li nounset Write a message to standard error when attempting -to expand a variable that is not set, and if the +to expand a variable, a positional parameter or +the special parameter +.Va \&! +that is not set, and if the shell is not interactive, exit immediately. .It Fl V Li vi Enable the built-in Copied: stable/8/tools/regression/bin/sh/expansion/set-u2.0 (from r198454, head/tools/regression/bin/sh/expansion/set-u2.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/expansion/set-u2.0 Tue Nov 9 22:32:11 2010 (r215066, copy of r198454, head/tools/regression/bin/sh/expansion/set-u2.0) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +set -u +: $* $@ "$@" "$*" +set -- x +: $* $@ "$@" "$*" +shift $# +: $* $@ "$@" "$*" +set -- y +set -- +: $* $@ "$@" "$*" +exit 0