From owner-svn-src-stable-8@FreeBSD.ORG Wed Apr 20 22:10:44 2011 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 864731065673; Wed, 20 Apr 2011 22:10:44 +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 729138FC16; Wed, 20 Apr 2011 22:10:44 +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 p3KMAiD6068485; Wed, 20 Apr 2011 22:10:44 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p3KMAihG068474; Wed, 20 Apr 2011 22:10:44 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201104202210.p3KMAihG068474@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 20 Apr 2011 22:10:44 +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: r220902 - in stable/8/tools/regression/bin/sh: builtins execution expansion parser X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Apr 2011 22:10:44 -0000 Author: jilles Date: Wed Apr 20 22:10:44 2011 New Revision: 220902 URL: http://svn.freebsd.org/changeset/base/220902 Log: MFC r218205,r218821,r218891,r219390,r219611,r220654,r220655,r220656: sh: New testcases that already work in stable/8. Added: stable/8/tools/regression/bin/sh/builtins/case4.0 - copied unchanged from r220654, head/tools/regression/bin/sh/builtins/case4.0 stable/8/tools/regression/bin/sh/builtins/dot3.0 - copied unchanged from r219390, head/tools/regression/bin/sh/builtins/dot3.0 stable/8/tools/regression/bin/sh/builtins/read5.0 - copied unchanged from r218821, head/tools/regression/bin/sh/builtins/read5.0 stable/8/tools/regression/bin/sh/execution/shellproc1.0 - copied unchanged from r218205, head/tools/regression/bin/sh/execution/shellproc1.0 stable/8/tools/regression/bin/sh/expansion/length1.0 - copied unchanged from r219611, head/tools/regression/bin/sh/expansion/length1.0 stable/8/tools/regression/bin/sh/expansion/length2.0 - copied unchanged from r219611, head/tools/regression/bin/sh/expansion/length2.0 stable/8/tools/regression/bin/sh/expansion/length3.0 - copied unchanged from r219611, head/tools/regression/bin/sh/expansion/length3.0 stable/8/tools/regression/bin/sh/expansion/length4.0 - copied unchanged from r220655, head/tools/regression/bin/sh/expansion/length4.0 stable/8/tools/regression/bin/sh/expansion/length5.0 - copied unchanged from r220656, head/tools/regression/bin/sh/expansion/length5.0 stable/8/tools/regression/bin/sh/parser/no-space1.0 - copied unchanged from r218891, head/tools/regression/bin/sh/parser/no-space1.0 stable/8/tools/regression/bin/sh/parser/no-space2.0 - copied unchanged from r218891, head/tools/regression/bin/sh/parser/no-space2.0 Modified: Directory Properties: stable/8/tools/regression/bin/sh/ (props changed) Copied: stable/8/tools/regression/bin/sh/builtins/case4.0 (from r220654, head/tools/regression/bin/sh/builtins/case4.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/case4.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r220654, head/tools/regression/bin/sh/builtins/case4.0) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +set -- "*" +case x in +"$1") echo failed ;; +esac Copied: stable/8/tools/regression/bin/sh/builtins/dot3.0 (from r219390, head/tools/regression/bin/sh/builtins/dot3.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/dot3.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r219390, head/tools/regression/bin/sh/builtins/dot3.0) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +# . should return 0 if no command was executed. + +if false; then + exit 3 +else + . /dev/null + exit $? +fi Copied: stable/8/tools/regression/bin/sh/builtins/read5.0 (from r218821, head/tools/regression/bin/sh/builtins/read5.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/builtins/read5.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r218821, head/tools/regression/bin/sh/builtins/read5.0) @@ -0,0 +1,32 @@ +# $FreeBSD$ + +unset LC_ALL +LC_CTYPE=en_US.ISO8859-1 +export LC_CTYPE + +# Note: the first and last characters are not whitespace. +# Exclude backslash and newline. +bad1=`printf %03o \'\\\\` +bad2=`printf %03o \'' +'` +e= +for i in 0 1 2 3; do + for j in 0 1 2 3 4 5 6 7; do + for k in 0 1 2 3 4 5 6 7; do + case $i$j$k in + 000|$bad1|$bad2) continue ;; + esac + e="$e\\$i$j$k" + done + done +done +e=`printf "$e"` +[ "${#e}" = 253 ] || echo length bad + +r1=`printf '%s\n' "$e" | { read -r x; printf '%s' "$x"; }` +[ "$r1" = "$e" ] || echo "read with -r bad" +r2=`printf '%s\n' "$e" | { read x; printf '%s' "$x"; }` +[ "$r2" = "$e" ] || echo "read without -r bad 1" +IFS= +r3=`printf '%s\n' "$e" | { read x; printf '%s' "$x"; }` +[ "$r3" = "$e" ] || echo "read without -r bad 2" Copied: stable/8/tools/regression/bin/sh/execution/shellproc1.0 (from r218205, head/tools/regression/bin/sh/execution/shellproc1.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/execution/shellproc1.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r218205, head/tools/regression/bin/sh/execution/shellproc1.0) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +T=`mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXXXX"` || exit +trap 'rm -rf "${T}"' 0 +cat <"$T/testshellproc" +printf 'this ' +echo is a test +EOF +chmod 755 "$T/testshellproc" +PATH=$T:$PATH +[ "`testshellproc`" = "this is a test" ] Copied: stable/8/tools/regression/bin/sh/expansion/length1.0 (from r219611, head/tools/regression/bin/sh/expansion/length1.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/expansion/length1.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r219611, head/tools/regression/bin/sh/expansion/length1.0) @@ -0,0 +1,12 @@ +# $FreeBSD$ + +v=abcd +[ "${#v}" = 4 ] || echo '${#v} wrong' +v=$$ +[ "${#$}" = "${#v}" ] || echo '${#$} wrong' +[ "${#!}" = 0 ] || echo '${#!} wrong' +set -- 01 2 3 4 5 6 7 8 9 10 11 12 0013 +[ "${#1}" = 2 ] || echo '${#1} wrong' +[ "${#13}" = 4 ] || echo '${#13} wrong' +v=$0 +[ "${#0}" = "${#v}" ] || echo '${#0} wrong' Copied: stable/8/tools/regression/bin/sh/expansion/length2.0 (from r219611, head/tools/regression/bin/sh/expansion/length2.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/expansion/length2.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r219611, head/tools/regression/bin/sh/expansion/length2.0) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +v=$- +[ "${#-}" = "${#v}" ] || echo '${#-} wrong' Copied: stable/8/tools/regression/bin/sh/expansion/length3.0 (from r219611, head/tools/regression/bin/sh/expansion/length3.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/expansion/length3.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r219611, head/tools/regression/bin/sh/expansion/length3.0) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +set -- 1 2 3 4 5 6 7 8 9 10 11 12 13 +[ "$#" = 13 ] || echo '$# wrong' +[ "${#}" = 13 ] || echo '${#} wrong' +[ "${##}" = 2 ] || echo '${##} wrong' +set -- +[ "$#" = 0 ] || echo '$# wrong' +[ "${#}" = 0 ] || echo '${#} wrong' +[ "${##}" = 1 ] || echo '${##} wrong' Copied: stable/8/tools/regression/bin/sh/expansion/length4.0 (from r220655, head/tools/regression/bin/sh/expansion/length4.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/expansion/length4.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r220655, head/tools/regression/bin/sh/expansion/length4.0) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +# The construct ${#?} is ambiguous in POSIX.1-2008: it could be the length +# of $? or it could be $# giving an error in the (impossible) case that it +# is not set. +# We use the former interpretation; it seems more useful. + +: +[ "${#?}" = 1 ] || echo '${#?} wrong' +(exit 42) +[ "${#?}" = 2 ] || echo '${#?} wrong' Copied: stable/8/tools/regression/bin/sh/expansion/length5.0 (from r220656, head/tools/regression/bin/sh/expansion/length5.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/expansion/length5.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r220656, head/tools/regression/bin/sh/expansion/length5.0) @@ -0,0 +1,27 @@ +# $FreeBSD$ + +unset LC_ALL +LC_CTYPE=en_US.ISO8859-1 +export LC_CTYPE + +e= +for i in 0 1 2 3; do + for j in 0 1 2 3 4 5 6 7; do + for k in 0 1 2 3 4 5 6 7; do + case $i$j$k in + 000) continue ;; + esac + e="$e\\$i$j$k" + done + done +done +ee=`printf "$e"` +[ ${#ee} = 255 ] || echo bad 1 +[ "${#ee}" = 255 ] || echo bad 2 +[ $((${#ee})) = 255 ] || echo bad 3 +[ "$((${#ee}))" = 255 ] || echo bad 4 +set -- "$ee" +[ ${#1} = 255 ] || echo bad 5 +[ "${#1}" = 255 ] || echo bad 6 +[ $((${#1})) = 255 ] || echo bad 7 +[ "$((${#1}))" = 255 ] || echo bad 8 Copied: stable/8/tools/regression/bin/sh/parser/no-space1.0 (from r218891, head/tools/regression/bin/sh/parser/no-space1.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/parser/no-space1.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r218891, head/tools/regression/bin/sh/parser/no-space1.0) @@ -0,0 +1,18 @@ +# $FreeBSD$ + +# These are ugly but are required to work. + +set -e + +while(false)do(:)done +if(false)then(:)fi +if(false)then(:)else(:)fi +(:&&:)||: +until(:)do(:)done +case x in(x);;*)exit 1;(:)esac +case x in(x);;*)exit 1;;esac +for i do(:)done +{(:)} +f(){(:)} +:|: +(:)|(:) Copied: stable/8/tools/regression/bin/sh/parser/no-space2.0 (from r218891, head/tools/regression/bin/sh/parser/no-space2.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/tools/regression/bin/sh/parser/no-space2.0 Wed Apr 20 22:10:44 2011 (r220902, copy of r218891, head/tools/regression/bin/sh/parser/no-space2.0) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +# This conflicts with ksh extended patterns but occurs in the wild. + +set -e + +!(false)