From 472d43e5f5c656301d1292dded6b8b9cbaf46c05 Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Oct 08 2010 18:20:36 +0000 Subject: - disable only known to be broken builtins, let other enabled - skip regression tests if /dev/fd is missing --- diff --git a/ksh-20070328-builtins.patch b/ksh-20070328-builtins.patch index 4c06c3f..e50470a 100644 --- a/ksh-20070328-builtins.patch +++ b/ksh-20070328-builtins.patch @@ -1,15 +1,28 @@ -diff -up ksh-20090501/src/cmd/ksh93/data/builtins.c.builtins ksh-20090501/src/cmd/ksh93/data/builtins.c ---- ksh-20090501/src/cmd/ksh93/data/builtins.c.builtins 2009-04-12 09:38:03.000000000 +0200 -+++ ksh-20090501/src/cmd/ksh93/data/builtins.c 2009-05-05 11:20:30.601284246 +0200 -@@ -125,6 +125,7 @@ const struct shtable3 shtab_builtins[] = +diff -up ksh-20100924/src/cmd/ksh93/data/builtins.c.builtins ksh-20100924/src/cmd/ksh93/data/builtins.c +--- ksh-20100924/src/cmd/ksh93/data/builtins.c.builtins 2010-08-10 20:58:54.000000000 +0200 ++++ ksh-20100924/src/cmd/ksh93/data/builtins.c 2010-10-08 18:08:35.118675557 +0200 +@@ -125,20 +125,28 @@ const struct shtable3 shtab_builtins[] = #ifdef SHOPT_CMDLIB_HDR #include SHOPT_CMDLIB_HDR #else -+#if 0 ++#if 1 CMDLIST(basename) CMDLIST(chmod) CMDLIST(dirname) -@@ -139,6 +140,7 @@ const struct shtable3 shtab_builtins[] = + CMDLIST(getconf) + CMDLIST(head) ++#if 0 ++does not work when ACLs are used + CMDLIST(mkdir) ++#endif + CMDLIST(logname) ++#if 1 ++//does not work in chrooted environments, because /dev/fd/? is missing + CMDLIST(cat) ++#endif + CMDLIST(cmp) + CMDLIST(cut) + CMDLIST(uname) CMDLIST(wc) CMDLIST(sync) #endif diff --git a/ksh-20100826-fixregr.patch b/ksh-20100826-fixregr.patch index 70552d3..68fc0a9 100644 --- a/ksh-20100826-fixregr.patch +++ b/ksh-20100826-fixregr.patch @@ -1,209 +1,61 @@ -diff -up ksh-20100924/src/cmd/ksh93/tests/basic.sh.fixregr ksh-20100924/src/cmd/ksh93/tests/basic.sh ---- ksh-20100924/src/cmd/ksh93/tests/basic.sh.fixregr 2010-09-01 18:01:20.000000000 +0200 -+++ ksh-20100924/src/cmd/ksh93/tests/basic.sh 2010-09-28 19:49:32.057393580 +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-20100924/src/cmd/ksh93/tests/builtins.sh.fixregr ksh-20100924/src/cmd/ksh93/tests/builtins.sh ---- ksh-20100924/src/cmd/ksh93/tests/builtins.sh.fixregr 2010-09-07 19:01:56.000000000 +0200 -+++ ksh-20100924/src/cmd/ksh93/tests/builtins.sh 2010-09-28 21:42:43.857395930 +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 )) | -@@ -535,7 +541,7 @@ $SHELL 2> /dev/null -c 'cd ""' && err_ex - [[ $($SHELL 2> /dev/null -c 'cd "";print hi') != hi ]] && err_exit 'cd "" should not terminate script' - - bincat=$(whence -p cat) --builtin cat -+builtin cat >/dev/null 2>&1 - out=$tmp/seq.out - seq 11 >$out - cmp -s <(print -- "$($bincat<( $bincat $out ) )") <(print -- "$(cat <( cat $out ) )") || err_exit "builtin cat differes from $bincat" -diff -up ksh-20100924/src/cmd/ksh93/tests/coprocess.sh.fixregr ksh-20100924/src/cmd/ksh93/tests/coprocess.sh ---- ksh-20100924/src/cmd/ksh93/tests/coprocess.sh.fixregr 2010-06-29 15:49:14.000000000 +0200 -+++ ksh-20100924/src/cmd/ksh93/tests/coprocess.sh 2010-09-28 19:49:32.077393950 +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-20100924/src/cmd/ksh93/tests/exit.sh.fixregr ksh-20100924/src/cmd/ksh93/tests/exit.sh ---- ksh-20100924/src/cmd/ksh93/tests/exit.sh.fixregr 2009-04-20 08:52:54.000000000 +0200 -+++ ksh-20100924/src/cmd/ksh93/tests/exit.sh 2010-09-28 19:49:32.079393840 +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-20100924/src/cmd/ksh93/tests/heredoc.sh.fixregr ksh-20100924/src/cmd/ksh93/tests/heredoc.sh ---- ksh-20100924/src/cmd/ksh93/tests/heredoc.sh.fixregr 2010-06-26 05:42:14.000000000 +0200 -+++ ksh-20100924/src/cmd/ksh93/tests/heredoc.sh 2010-09-28 19:49:32.080390599 +0200 -@@ -109,7 +109,7 @@ EOF - done - ' 2> /dev/null || err_exit '100 empty here docs fails' +--- ksh-20100924/src/cmd/ksh93/tests/builtins.sh.fixregr 2010-09-30 08:49:58.225268051 +0200 ++++ ksh-20100924/src/cmd/ksh93/tests/builtins.sh 2010-09-30 08:53:58.429519220 +0200 +@@ -293,7 +293,7 @@ fi + # we won't get hit by the one second boundary twice, right? + [[ $(printf '%T\n' now) == "$(date)" ]] || + [[ $(printf '%T\n' now) == "$(date)" ]] || +-err_exit 'printf "%T" now' ++err_exit 'printf "%T" now'"$(printf '%T\n' now) != $(date)" + behead() { -- 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 + read line diff -up ksh-20100924/src/cmd/ksh93/tests/locale.sh.fixregr ksh-20100924/src/cmd/ksh93/tests/locale.sh --- ksh-20100924/src/cmd/ksh93/tests/locale.sh.fixregr 2010-09-07 20:21:44.000000000 +0200 -+++ ksh-20100924/src/cmd/ksh93/tests/locale.sh 2010-09-28 19:49:32.081389809 +0200 -@@ -106,6 +106,8 @@ fi ++++ ksh-20100924/src/cmd/ksh93/tests/locale.sh 2010-09-30 08:57:41.512270429 +0200 +@@ -103,6 +103,7 @@ if (( $($SHELL -c $'export LC_ALL='$loca + then LC_ALL=$locale $SHELL -c b1=$'"\342\202\254\342\202\254\342\202\254\342\202\254w\342\202\254\342\202\254\342\202\254\342\202\254"; [[ ${b1:4:1} == w ]]' || err_exit 'multibyte ${var:offset:len} not working correctly' + fi + ++locale=en_US.UTF-8 #$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 " +@@ -110,16 +111,16 @@ set -- $($SHELL -c " unset LC_CTYPE export LANG=$locale -@@ -118,6 +120,7 @@ set -- $($SHELL -c " + export LC_ALL=C +- command wc -C < $tmp/two_euro_chars.txt ++ command wc -m < $tmp/two_euro_chars.txt + unset LC_ALL +- command wc -C < $tmp/two_euro_chars.txt ++ command wc -m < $tmp/two_euro_chars.txt + export LC_ALL=C +- command wc -C < $tmp/two_euro_chars.txt ++ command wc -m < $tmp/two_euro_chars.txt ") 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 +- if builtin -f cmd wc 2>/dev/null ++ if builtin wc 2>/dev/null then unset LC_CTYPE -@@ -128,11 +131,15 @@ set -- $($SHELL -c " - wc -C < $tmp/two_euro_chars.txt + export LANG=$locale export LC_ALL=C - wc -C < $tmp/two_euro_chars.txt -+ else -+ print "$exp" - fi - ") +@@ -133,6 +134,8 @@ set -- $($SHELL -c " 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 + ++locale=C_EU.UTF-8 ++ # multibyte char straddling buffer boundary { -diff -up ksh-20100924/src/cmd/ksh93/tests/path.sh.fixregr ksh-20100924/src/cmd/ksh93/tests/path.sh ---- ksh-20100924/src/cmd/ksh93/tests/path.sh.fixregr 2010-03-19 22:50:57.000000000 +0100 -+++ ksh-20100924/src/cmd/ksh93/tests/path.sh 2010-09-28 19:49:32.082394900 +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' +@@ -189,6 +192,7 @@ do exp=$1 + done - [[ $(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 + # setocale(LC_ALL,"") after setlocale() initialization ++locale=en_US.UTF-8 - scr=$tmp/script + printf 'f1\357\274\240f2\n' > input1 + printf 't2\357\274\240f1\n' > input2 diff --git a/ksh.spec b/ksh.spec index b18d420..b0b335c 100644 --- a/ksh.spec +++ b/ksh.spec @@ -6,7 +6,7 @@ URL: http://www.kornshell.com/ Group: System Environment/Shells License: CPL Version: 20100924 -Release: 1%{?dist} +Release: 2%{?dist} Source0: http://www.research.att.com/~gsf/download/tgz/ast-ksh.%{releasedate}.tgz Source1: http://www.research.att.com/~gsf/download/tgz/INIT.%{releasedate}.tgz Source3: kshrc.rhs @@ -66,11 +66,17 @@ install -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/kshrc export SHELL=$(ls $(pwd)/arch/*/bin/ksh) cd src/cmd/ksh93/tests/ ulimit -c unlimited +if [ ! -e /dev/fd ] +then + echo "ERROR: /dev/fd does not exist, regression tests skipped" +# exit 0 +fi $SHELL ./shtests 2>&1 | tee testresults.log sed -e '/begins at/d' -e '/ 0 error/d' -e 's/at [^\[]*\[/\[/' testresults.log -e '/tests skipped/d' >filteredresults.log if ! cmp filteredresults.log %{SOURCE5} >/dev/null || ls core.* then echo "Regression tests failed" + diff -Naurp %{SOURCE5} filteredresults.log exit -1 fi @@ -110,6 +116,10 @@ fi rm -rf $RPM_BUILD_ROOT %changelog +* Fri Oct 08 2010 Michal Hlavinka - 20100924-2 +- disable only known to be broken builtins, let other enabled +- skip regression tests if /dev/fd is missing + * Tue Sep 28 2010 Michal Hlavinka - 20100924-1 - ksh updated to 2010-09-24