1NOTE regression tests for --regress enabled ksh 2 3UNIT ksh-regress 4 5EXPORT HOME=. ENV=.env.sh LC_ALL=C HISTFILE= 6 7TEST mode suid/sgid combinations 8 9# these tests are the product { all modes combinations } X { tests } 10 11defaults=( 12 "etc=$HOME" 13 "source" 14) 15modes=( 16 interactive 17 login 18 privileged 19 rc 20 restricted 21) 22tests=( 23 "" 24 "euid=0" 25 "euid=0 p_suid=0" 26 "euid=0 p_suid=99999" 27 "euid=1" 28 "euid=1 p_suid=0" 29 "euid=1 p_suid=99999" 30 "egid=1" 31 "egid=1 p_suid=0" 32 "egid=1 p_suid=99999" 33) 34 35integer n=1 m=${#modes[@]} 36d= 37for o in ${defaults[@]} 38do d="$d --regress=$o" 39done 40for ((b=0; b<m; b++)) 41do (( n *= 3 )) 42done 43for (( b=0; b<n; b++ )) 44do k= 45 z=$(printf "%0$m..3u" $b) 46 for (( i=0; i<m; i++ )) 47 do case $z in 48 1*) k="$k --no${modes[i]}" ;; 49 2*) k="$k --${modes[i]}" ;; 50 esac 51 z=${z#?} 52 done 53 for t in "${tests[@]}" 54 do o=$d 55 for r in $t 56 do o="$o --regress=$r" 57 done 58 o="$o $k" 59 60EXEC $o <<! 61set --state 62! 63 64 done 65done 66 67TEST privileged/noprivileged sequence 68 69EXEC --regress=etc=. --regress=euid=1 --privileged <<! 70set --state; set --noprivileged; set --state; set --privileged; set --state; set --noprivileged; set --state 71! 72