diff -up ksh-20100826/src/cmd/ksh93/tests/basic.sh.fixregr ksh-20100826/src/cmd/ksh93/tests/basic.sh --- ksh-20100826/src/cmd/ksh93/tests/basic.sh.fixregr 2010-08-13 16:23:58.000000000 +0200 +++ ksh-20100826/src/cmd/ksh93/tests/basic.sh 2010-09-24 18:38:43.825176804 +0200 @@ -185,7 +185,7 @@ then err_exit " ( (/bin/echo);(/bin/echo fi cat > $tmp/script <<\! if [[ -p /dev/fd/0 ]] -then builtin cat +then builtin cat >/dev/null 2>&1 ||: cat - > /dev/null [[ -p /dev/fd/0 ]] && print ok else print no diff -up ksh-20100826/src/cmd/ksh93/tests/builtins.sh.fixregr ksh-20100826/src/cmd/ksh93/tests/builtins.sh --- ksh-20100826/src/cmd/ksh93/tests/builtins.sh.fixregr 2010-08-13 20:56:49.000000000 +0200 +++ ksh-20100826/src/cmd/ksh93/tests/builtins.sh 2010-09-24 18:38:43.827176204 +0200 @@ -32,7 +32,7 @@ tmp=$(mktemp -dt) || { err_exit mktemp - trap "cd /; rm -rf $tmp" EXIT # test shell builtin commands -builtin getconf +builtin getconf >/dev/null 2>&1 : ${foo=bar} || err_exit ": failed" [[ $foo = bar ]] || err_exit ": side effects failed" set -- - foobar @@ -333,12 +333,15 @@ wait $pid1 wait $pid2 (( $? == 127 )) || err_exit "subshell job known to parent" env= +if getconf LIBPATH >/dev/null 2>&1 +then v=$(getconf LIBPATH) for v in ${v//,/ } do v=${v#*:} v=${v%%:*} eval [[ \$$v ]] && env="$env $v=\"\$$v\"" done +fi if [[ $(foo=bar; eval foo=\$foo $env exec -c \$SHELL -c \'print \$foo\') != bar ]] then err_exit '"name=value exec -c ..." not working' fi @@ -482,8 +485,11 @@ fi while (( i <2)) do (( i++)) done) == $'0\n0\n1\n1\n2' ]] || err_exit "DEBUG trap not working" +if getconf UNIVERSE >/dev/null 2>&1 +then getconf UNIVERSE - ucb [[ $($SHELL -c 'echo -3') == -3 ]] || err_exit "echo -3 not working in ucb universe" +fi typeset -F3 start_x=SECONDS total_t delay=0.02 typeset reps=50 leeway=5 #sleep $(( 2 * leeway * reps * delay )) | @@ -534,8 +540,8 @@ t=$(ulimit -t) $SHELL 2> /dev/null -c 'cd ""' && err_exit 'cd "" not producing an error' [[ $($SHELL 2> /dev/null -c 'cd "";print hi') != hi ]] && err_exit 'cd "" should not terminate script' +builtin cat >/dev/null 2>&1 ||: bincat=$(whence -p cat) -builtin cat seq 11 >tmp11 cmp -s <(print -- "$($bincat<( $bincat tmp11 ) )") <(print -- "$(cat <( cat tmp11 ) )") || err_exit "builtin cat differes from $bincat" diff -up ksh-20100826/src/cmd/ksh93/tests/coprocess.sh.fixregr ksh-20100826/src/cmd/ksh93/tests/coprocess.sh --- ksh-20100826/src/cmd/ksh93/tests/coprocess.sh.fixregr 2010-06-29 15:49:14.000000000 +0200 +++ ksh-20100826/src/cmd/ksh93/tests/coprocess.sh 2010-09-24 18:38:43.829176092 +0200 @@ -205,7 +205,7 @@ done trap 'sleep_pid=; kill $pid; err_exit "coprocess 1 hung"' TERM { sleep 5; kill $$; } & sleep_pid=$! -builtin cat +builtin cat >/dev/null 2>&1 ||: cat |& pid=$! exec 5<&p 6>&p diff -up ksh-20100826/src/cmd/ksh93/tests/exit.sh.fixregr ksh-20100826/src/cmd/ksh93/tests/exit.sh --- ksh-20100826/src/cmd/ksh93/tests/exit.sh.fixregr 2009-04-20 08:52:54.000000000 +0200 +++ ksh-20100826/src/cmd/ksh93/tests/exit.sh 2010-09-24 18:38:43.830175792 +0200 @@ -40,7 +40,7 @@ function abspath print $newdir/$base } #test for proper exit of shell -builtin getconf +builtin getconf >/dev/null 2>&1 ||: ABSHELL=$(abspath) cd $tmp || { err_exit "cd $tmp failed"; exit 1; } print exit 0 >.profile @@ -49,7 +49,7 @@ HOME=$PWD \ PATH=$PATH \ SHELL=$ABSSHELL \ $( - v=$(getconf LIBPATH) + v=$(getconf LIBPATH 2>/dev/null) for v in ${v//,/ } do v=${v#*:} v=${v%%:*} diff -up ksh-20100826/src/cmd/ksh93/tests/heredoc.sh.fixregr ksh-20100826/src/cmd/ksh93/tests/heredoc.sh --- ksh-20100826/src/cmd/ksh93/tests/heredoc.sh.fixregr 2010-06-26 05:42:14.000000000 +0200 +++ ksh-20100826/src/cmd/ksh93/tests/heredoc.sh 2010-09-24 18:38:43.832176170 +0200 @@ -109,7 +109,7 @@ EOF done ' 2> /dev/null || err_exit '100 empty here docs fails' { - print 'builtin -d cat + print 'builtin -d cat >/dev/null 2>&1 ||: cat <<- EOF' for ((i=0; i < 100; i++)) do print XXXXXXXXXXXXXXXXXXXX @@ -147,7 +147,7 @@ EOF) != $'#abc\nabc' ]] then err_exit 'comments not preserved in here-documents' fi cat > "$f" <<- '!!!!' - builtin cat + builtin cat >/dev/null 2>&1 ||: : << EOF $PWD xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx diff -up ksh-20100826/src/cmd/ksh93/tests/locale.sh.fixregr ksh-20100826/src/cmd/ksh93/tests/locale.sh --- ksh-20100826/src/cmd/ksh93/tests/locale.sh.fixregr 2010-08-26 23:44:23.000000000 +0200 +++ ksh-20100826/src/cmd/ksh93/tests/locale.sh 2010-09-24 18:38:43.834424515 +0200 @@ -106,6 +106,8 @@ fi #$SHELL -c 'export LANG='$locale'; printf "\u[20ac]\u[20ac]" > $tmp/two_euro_chars.txt' printf $'\342\202\254\342\202\254' > $tmp/two_euro_chars.txt exp="6 2 6" +if [ -n "$(echo foo | wc -C 2>/dev/null)" ] +then set -- $($SHELL -c " unset LC_CTYPE export LANG=$locale @@ -118,6 +120,7 @@ set -- $($SHELL -c " ") got=$* [[ $got == $exp ]] || err_exit "command wc LC_ALL default failed -- expected '$exp', got '$got'" + set -- $($SHELL -c " if builtin -f cmd wc 2>/dev/null then unset LC_CTYPE @@ -128,11 +131,15 @@ set -- $($SHELL -c " wc -C < $tmp/two_euro_chars.txt export LC_ALL=C wc -C < $tmp/two_euro_chars.txt + else + print "$exp" fi ") got=$* [[ $got == $exp ]] || err_exit "builtin wc LC_ALL default failed -- expected '$exp', got '$got'" - +else + print "wc does not support -C parameter, some tests skipped" +fi # multibyte char straddling buffer boundary { diff -up ksh-20100826/src/cmd/ksh93/tests/path.sh.fixregr ksh-20100826/src/cmd/ksh93/tests/path.sh --- ksh-20100826/src/cmd/ksh93/tests/path.sh.fixregr 2010-03-19 22:50:57.000000000 +0100 +++ ksh-20100826/src/cmd/ksh93/tests/path.sh 2010-09-24 18:38:43.836424895 +0200 @@ -144,9 +144,9 @@ if [[ $(PATH=:/usr/bin; date) != 'hello' then err_exit "leading : in path not working" fi ( - PATH=$PWD: - builtin chmod print 'print cannot execute' > noexec + builtin chmod >/dev/null 2>&1 || alias chmod=$(which chmod) + PATH=$PWD: chmod 644 noexec if [[ ! -x noexec ]] then noexec > /dev/null 2>&1 @@ -244,16 +244,16 @@ typeset foo=$(PATH=/xyz:/abc :) y=$(whence rm) [[ $x != "$y" ]] && err_exit 'PATH not restored after command substitution' whence getconf > /dev/null && err_exit 'getconf should not be found' -builtin /bin/getconf -PATH=/bin +builtin /bin/getconf >/dev/null 2>&1 +PATH=/usr/bin PATH=$(getconf PATH) -x=$(whence ls) -PATH=.:$PWD:${x%/ls} -[[ $(whence ls) == "$x" ]] || err_exit 'PATH search bug when .:$PWD in path' -PATH=$PWD:.:${x%/ls} -[[ $(whence ls) == "$x" ]] || err_exit 'PATH search bug when :$PWD:. in path' -cd "${x%/ls}" -[[ $(whence ls) == /* ]] || err_exit 'whence not generating absolute pathname' +x=$(whence grep) +PATH=.:$PWD:${x%/grep} +[[ $(whence grep) == "$x" ]] || err_exit 'PATH search bug when .:$PWD in path' +PATH=$PWD:.:${x%/grep} +[[ $(whence grep) == "$x" ]] || err_exit 'PATH search bug when :$PWD:. in path' +cd "${x%/grep}" +[[ $(whence grep) == /* ]] || err_exit 'whence not generating absolute pathname' status=$($SHELL -c $'trap \'print $?\' EXIT;/xxx/a/b/c/d/e 2> /dev/null') [[ $status == 127 ]] || err_exit "not found command exit status $status -- expected 127" status=$($SHELL -c $'trap \'print $?\' EXIT;/dev/null 2> /dev/null') @@ -265,12 +265,13 @@ status=$($SHELL -c $'trap \'print $?\' E # universe via PATH -builtin getconf +if builtin getconf >/dev/null 2>&1 +then getconf UNIVERSE - att # override sticky default 'UNIVERSE = foo' [[ $(PATH=/usr/ucb/bin:/usr/bin echo -n ucb) == 'ucb' ]] || err_exit "ucb universe echo ignores -n option" [[ $(PATH=/usr/xpg/bin:/usr/bin echo -n att) == '-n att' ]] || err_exit "att universe echo does not ignore -n option" - +fi PATH=$path scr=$tmp/script