Skip to content

Latest commit

 

History

History
1079 lines (899 loc) · 22.5 KB

portabilitytest-2014-05-29-solaris10.org

File metadata and controls

1079 lines (899 loc) · 22.5 KB

portabilitytest results

Solaris 10: bash 3.2.41, zsh 4.2.1, ksh88? dtksh=ksh93?

The shells available in Solaris 10 default install…

That test_echoc zsh failure can probably be sorted out by yet another zsh option – unsetopt bsd_echo was not enough…

Shells: /bin/sh, /bin/ksh, /bin/bash, /bin/zsh, /usr/dt/bin/dtksh

01_test_commandshkshbashzshdtksh
02_test_command_vshkshbashzshdtksh
03_test_cmdv_failshkshbashzshdtksh
04_test_builtinshkshbashzshdtksh
05_test_localshkshbashzshdtksh
06_test_typesetshkshbashzshdtksh
07_test_globalshkshbashzshdtksh
08_test_functionshkshbashzshdtksh
09_test_function2shkshbashzshdtksh
10_test_exclmarkshkshbashzshdtksh
11_test_testshkshbashzshdtksh
12_test_test_eshkshbashzshdtksh
13_test_test_efshkshbashzshdtksh
14_test_test_ntshkshbashzshdtksh
15_test_testexclshkshbashzshdtksh
16_test_testeqeqshkshbashzshdtksh
17_test_testtestshkshbashzshdtksh
18_test_tildexpshkshbashzshdtksh
19_test_pwdvarshkshbashzshdtksh
20_test_pwdcmdshkshbashzshdtksh
21_test_trueshkshbashzshdtksh
22_test_colonshkshbashzshdtksh
23_test_export1shkshbashzshdtksh
24_test_readonly2shkshbashzshdtksh
25_test_case_pxclshkshbashzshdtksh
26_test_case_pxcfshkshbashzshdtksh
27_test_at0shkshbashzshdtksh
28_test_at1shkshbashzshdtksh
29_test_at0forshkshbashzshdtksh
30_test_echoEshkshbashzshdtksh
31_test_echocshkshbashzshdtksh
32_test_echonshkshbashzshdtksh
33_test_bi_printfshkshbashzshdtksh
34_test_dollar_sgshkshbashzshdtksh
35_test_hash_fatlshkshbashzshdtksh
36_test_hash_btinshkshbashzshdtksh
37_test_hash_failshkshbashzshdtksh
38_test_iexprshkshbashzshdtksh
39_test_tfftshkshbashzshdtksh
40_test_icatshkshbashzshdtksh

common.sh

set -eu
#set -x

PATH=; export PATH

case ${BASH_VERSION-} in *.*)
	# Make echo builtin in bash expands backslash-escape sequences by
	# default. Without this bash would be less portable compared to
	# most other shells...
	shopt -s xpg_echo
	# make sure pipefail is not set (bash-only feature)...
	set +o pipefail
	#list_functions () { set; }
esac
case ${ZSH_VERSION-} in *.*)
	setopt shwordsplit
	setopt posix_builtins # for test_command()
	unsetopt equals # for [ 1 == 1 ] (nonstandard usage...)
	unsetopt bsd_echo # enable echo escape sequences (like \c)
	#setopt equals # make [ 1 == 1 ] fail for sure...
	unsetopt function_argzero # $0 being the name of this script always
	#list_functions () { functions; }
esac

withpath () { PATH=/bin:/usr/bin; export PATH; "$@"; PATH=; export PATH; }

saved_IFS=$IFS; readonly saved_IFS
set -x

01_test_command

#!/bin/sh
test_command () # builtin or system, not function or alias
{
	# one could argue whether command should include builtins...
	alias echo='exit 1' || :
	echo () { exit 1; }
	command echo
} 
. portabilitytest/common.sh
test_command

f 01_test_command sh

+ test_command 
+ alias echo=exit 1 
portabilitytest/01_test_command: alias: not found
+ : 
+ command echo 
portabilitytest/01_test_command: command: not found

1 of the tested shells failed to execute this test


02_test_command_v

#!/bin/sh
test_command_v () # the -v option
{
	# first check that there is builtin 'command'
	command echo || exit 1
	# expect cat reside in /bin, to make this run not fail
	PATH=/bin; export PATH
	case `command -v cat` in *cat) ;; *) exit 1; esac
} 
. portabilitytest/common.sh
test_command_v

f 02_test_command_v sh

+ test_command_v 
+ command echo 
portabilitytest/02_test_command_v: command: not found
+ exit 1 

1 of the tested shells failed to execute this test


03_test_cmdv_fail

#!/bin/sh
test_cmdv_fail () # if command -v fails in case command not found
{
	if command -v this_c0mmand_does_not_existt
	then exit 1
	else exit 0
	fi
} 
. portabilitytest/common.sh
test_cmdv_fail

all of the tested shells executed this test successfully


04_test_builtin

#!/bin/sh
test_builtin () # builtin command
{
	echo () { return 1; }
	builtin echo
} 
. portabilitytest/common.sh
test_builtin

f 04_test_builtin sh

+ test_builtin 
+ builtin echo 
portabilitytest/04_test_builtin: builtin: not found

f 04_test_builtin ksh

+ test_builtin
portabilitytest/04_test_builtin[8]: restricted: echo is a shell builtin
portabilitytest/04_test_builtin[3]: builtin:  not found

2 of the tested shells failed to execute this test


05_test_local

#!/bin/sh
test_local () # local variable
{
	lt () {
		local var=ilval
		case $var in ilval) ;; *) exit 1 ;; esac
	}
	local var=lval
	lt
	case $var in lval) ;; *) exit 1 ;; esac
} 
. portabilitytest/common.sh
test_local

f 05_test_local sh

+ test_local 
+ local var=lval 
portabilitytest/05_test_local: local: not found

f 05_test_local dtksh

+ test_local
+ local var=lval
portabilitytest/05_test_local: line 8: local: not found

2 of the tested shells failed to execute this test


06_test_typeset

#!/bin/sh
test_typeset () # local variable using plain typeset (typeset/declare without opts)
{
	# declare: same as typeset (in bash, zsh, ...) but less portable
	lt () {
		typeset var=ilval
		case $var in ilval) ;; *) exit 1 ;; esac
	}
	typeset var=lval
	lt
	case $var in lval) ;; *) exit 1 ;; esac
} 
. portabilitytest/common.sh
test_typeset

f 06_test_typeset sh

+ test_typeset 
+ typeset var=lval 
portabilitytest/06_test_typeset: typeset: not found

f 06_test_typeset dtksh

+ test_typeset
+ var=lval
+ typeset var
+ lt
+ var=ilval
+ typeset var
+ exit 1

2 of the tested shells failed to execute this test


07_test_global

#!/bin/sh
test_global () # test whether variable is global always
{
	gt () {
		var=local
	}
	var=global
	gt
	case $var in local) exit 0 ;; *) exit 1 ;; esac
} 
. portabilitytest/common.sh
test_global

all of the tested shells executed this test successfully


08_test_function

#!/bin/sh
test_function () # function keyword
{
	function inner { :; }
	inner
} 
. portabilitytest/common.sh
test_function

f 08_test_function sh

portabilitytest/08_test_function: inner: not found
portabilitytest/08_test_function: syntax error at line 6: `}' unexpected

1 of the tested shells failed to execute this test


09_test_function2

#!/bin/sh
test_function2 () # function keyword, with ()
{
	function inner () { :; }
	inner
} 
. portabilitytest/common.sh
test_function2

f 09_test_function2 sh

portabilitytest/09_test_function2: syntax error at line 4: `(' unexpected

f 09_test_function2 ksh

portabilitytest/09_test_function2[2]: syntax error at line 4 : `(' unexpected

f 09_test_function2 dtksh

portabilitytest/09_test_function2: syntax error at line 4: `(' unexpected

3 of the tested shells failed to execute this test


10_test_exclmark

#!/bin/sh
test_exclmark () # whether '!' as 'not' works (and is builtin)
{
	# fails in heirloom sh
	! /bin/false
} 
. portabilitytest/common.sh
test_exclmark

f 10_test_exclmark sh

+ test_exclmark 
+ ! /bin/false 
portabilitytest/10_test_exclmark: !: not found

1 of the tested shells failed to execute this test


11_test_test

#!/bin/sh
test_test () # builtin test command
{
	test string
} 
. portabilitytest/common.sh
test_test

all of the tested shells executed this test successfully


12_test_test_e

#!/bin/sh
test_test_e () # test -e file (well, current directory)
{
	if test -e "$0"; then exit 0; else exit 1; fi
} 
. portabilitytest/common.sh
test_test_e

f 12_test_test_e sh

+ test_test_e 
+ test -e portabilitytest/12_test_test_e 
portabilitytest/12_test_test_e: test: argument expected

1 of the tested shells failed to execute this test


13_test_test_ef

#!/bin/sh
test_test_ef () # test file1 -ef file2
{
	td=`withpath mktemp -d /tmp/tmp.XXXXXX`; ev=1
	trap '/bin/rm -rf $td; exit $ev' 0
	: > $td/file1
	/bin/ln $td/file1 $td/file2
	if test $td/file1 -ef $td/file2; then ev=0; fi
} 
. portabilitytest/common.sh
test_test_ef

f 13_test_test_ef sh

+ test_test_ef 
+ withpath mktemp -d /tmp/tmp.XXXXXX 
PATH=/bin:/usr/bin
+ export PATH 
+ mktemp -d /tmp/tmp.XXXXXX 
PATH=
+ export PATH 
td=/tmp/tmp.MNaynf
ev=1
+ trap /bin/rm -rf $td; exit $ev 0 
+ : 
+ /bin/ln /tmp/tmp.MNaynf/file1 /tmp/tmp.MNaynf/file2 
+ test /tmp/tmp.MNaynf/file1 -ef /tmp/tmp.MNaynf/file2 
portabilitytest/13_test_test_ef: test: unknown operator -ef
+ /bin/rm -rf /tmp/tmp.MNaynf 
+ exit 1 

1 of the tested shells failed to execute this test


14_test_test_nt

#!/bin/sh
test_test_nt () # test file1 -nt file2 (presumed -ot is also supported if -nt is)
{
	td=`withpath mktemp -d /tmp/tmp.XXXXXX`; ev=1
	#trap '/bin/rm -rf $td; exit $ev' 0
	# XXX expects system time & fs times to work as usual
	: > $td/newfile
	if test $td/newfile -nt "$0"; then ev=0; fi
} 
. portabilitytest/common.sh
test_test_nt

f 14_test_test_nt sh

+ test_test_nt 
+ withpath mktemp -d /tmp/tmp.XXXXXX 
PATH=/bin:/usr/bin
+ export PATH 
+ mktemp -d /tmp/tmp.XXXXXX 
PATH=
+ export PATH 
td=/tmp/tmp.NaaOrf
ev=1
+ : 
+ test /tmp/tmp.NaaOrf/newfile -nt portabilitytest/14_test_test_nt 
portabilitytest/14_test_test_nt: test: unknown operator -nt

1 of the tested shells failed to execute this test


15_test_testexcl

#!/bin/sh
test_testexcl () # '!' in test
{
	if test '!' string; then exit 1; else exit 0; fi
} 
. portabilitytest/common.sh
test_testexcl

all of the tested shells executed this test successfully


16_test_testeqeq

#!/bin/sh
test_testeqeq () # nonstandard '[ 1 == 1 ]' ('[ 1 = 1 ]' would be standard one)
{
	# this can be made to pass in zsh by using '==' or w/ unsetopt equals
	[ 1 == 1 ]
} 
. portabilitytest/common.sh
test_testeqeq

f 16_test_testeqeq sh

+ test_testeqeq 
+ [ 1 == 1 ] 
portabilitytest/16_test_testeqeq: test: unknown operator ==

1 of the tested shells failed to execute this test


17_test_testtest

#!/bin/sh
test_testtest () # whether [[ ]] is supported (with 1 == 1)
{
	[[ 1 == 1 ]]
} 
. portabilitytest/common.sh
test_testtest

f 17_test_testtest sh

+ test_testtest 
+ [[ 1 == 1 ]] 
portabilitytest/17_test_testtest: [[: not found

1 of the tested shells failed to execute this test


18_test_tildexp

#!/bin/sh
test_tildexp () # tilde expansion
{
	case ~ in /*) ;; *) exit 1; esac
} 
. portabilitytest/common.sh
test_tildexp

f 18_test_tildexp sh

+ test_tildexp 
+ exit 1 

1 of the tested shells failed to execute this test


19_test_pwdvar

#!/bin/sh
test_pwdvar () # '$PWD' variable expansion
{
	cd /tmp
	PWD=/usr
	echo \$PWD: $PWD
	cd .
	echo \$PWD: $PWD
	case $PWD in /tmp) ;; *) exit 1; esac
} 
. portabilitytest/common.sh
test_pwdvar

f 19_test_pwdvar sh

+ test_pwdvar 
+ cd /tmp 
PWD=/usr
+ echo $PWD: /usr 
$PWD: /usr
+ cd . 
+ echo $PWD: /usr 
$PWD: /usr
+ exit 1 

1 of the tested shells failed to execute this test


20_test_pwdcmd

#!/bin/sh
test_pwdcmd () # pwd builtin command
{
	pwd
} 
. portabilitytest/common.sh
test_pwdcmd

all of the tested shells executed this test successfully


21_test_true

#!/bin/sh
test_true () # true builtin command (cannot test false...)
{
	true
} 
. portabilitytest/common.sh
test_true

f 21_test_true sh

+ test_true 
+ true 
portabilitytest/21_test_true: true: not found

1 of the tested shells failed to execute this test


22_test_colon

#!/bin/sh
test_colon () # colon (:) builtin command
{
	:
} 
. portabilitytest/common.sh
test_colon

all of the tested shells executed this test successfully


23_test_export1

#!/bin/sh
test_export1 () # export VAR=val -- not bourne compatible
{
	export VAR=val
	case $VAR in val) ;; *) exit 1; esac
} 
. portabilitytest/common.sh
test_export1

f 23_test_export1 sh

+ test_export1 
+ export VAR=val 
portabilitytest/23_test_export1: VAR=val: is not an identifier

1 of the tested shells failed to execute this test


24_test_readonly2

#!/bin/sh
test_readonly2 () # VAR=val; readonly VAR -- then attempt to change VAR
{
	VAR=val; readonly VAR
	# running in subshell as this makes shell exit.
	( VAR=changed || : ) && exit 1 || :
} 
. portabilitytest/common.sh
test_readonly2

all of the tested shells executed this test successfully


25_test_case_pxcl

#!/bin/sh
test_case_pxcl () # case where both '*' and '[!a-z0-9_]' unquoted
{
	case test/echo1 in *[!a-z0-9_]*) ;; *) exit 1; esac
	case test_echo1 in *[!a-z0-9_]*) exit 1; esac
} 
. portabilitytest/common.sh
test_case_pxcl

all of the tested shells executed this test successfully


26_test_case_pxcf

#!/bin/sh
test_case_pxcf () # case where both '*' and '[^a-z0-9_]' unquoted
{
	# dash & heirloom sh expected to "fail" here.
	case test/echo1 in *[^a-z0-9_]*) ;; *) exit 1; esac
	case test_echo1 in *[^a-z0-9_]*) exit 1; esac
} 
. portabilitytest/common.sh
test_case_pxcf

f 26_test_case_pxcf sh

portabilitytest/26_test_case_pxcf: syntax error at line 5: `^' unexpected

f 26_test_case_pxcf ksh

+ test_case_pxcf

f 26_test_case_pxcf dtksh

+ test_case_pxcf
+ exit 1

3 of the tested shells failed to execute this test


27_test_at0

#!/bin/sh
test_at0 () # "$@" expansion when $# 0
{
	case $# in 0) ;; *) die "arg count 0 required for this test" ;; esac
	: "$@"
} 
. portabilitytest/common.sh
test_at0

f 27_test_at0 sh

+ test_at0 
portabilitytest/27_test_at0: @: parameter not set

f 27_test_at0 ksh

+ test_at0
portabilitytest/27_test_at0[3]: @: parameter not set

f 27_test_at0 dtksh

+ test_at0
portabilitytest/27_test_at0: line 5: @: parameter not set

3 of the tested shells failed to execute this test


28_test_at1

#!/bin/sh
test_at1 () # ${1+"$@"} expansion when $# 0
{
	case $# in 0) ;; *) die "arg count 0 required for this test" ;; esac
	: ${1+"$@"}
} 
. portabilitytest/common.sh
test_at1

all of the tested shells executed this test successfully


29_test_at0for

#!/bin/sh
test_at0for () # implicit "$@" in for loop
{
	case $# in 0) ;; *) die "arg count 0 required for this test" ;; esac
	# FreeBSD 7.1 /bin/sh will complain something like $@ not defined
	for var; do :; done
} 
. portabilitytest/common.sh
test_at0for

f 29_test_at0for sh

portabilitytest/29_test_at0for: syntax error at line 6: `;' unexpected

1 of the tested shells failed to execute this test


30_test_echoE

#!/bin/sh
test_echoE () # expect backslash-escapes to be escapes by default
{
	case `echo '\n' | withpath wc` in *2*0*2) ;; *) exit 1; esac
} 
. portabilitytest/common.sh
test_echoE

f 30_test_echoE dtksh

+ test_echoE
+ echo '\n'
+ withpath wc
+ PATH=/bin:/usr/bin
+ export PATH
+ wc
+ PATH=''
+ export PATH
+ exit 1

1 of the tested shells failed to execute this test


31_test_echoc

#!/bin/sh
test_echoc () # expect '\c' to stop producing more output
{
	case `echo '\c---'` in '') ;; *) exit 1; esac
} 
. portabilitytest/common.sh
test_echoc

f 31_test_echoc zsh

+portabilitytest/31_test_echoc:7> test_echoc
+test_echoc:1> echo '\c---'
+test_echoc:2> case --- ()
+test_echoc:2> case --- (*)
+test_echoc:2> exit 1

1 of the tested shells failed to execute this test


32_test_echon

#!/bin/sh
test_echon () # whether 'echo -n' works
{
	echo -n
	case `echo -n` in '') ;; *) exit 1; esac
} 
. portabilitytest/common.sh
test_echon

f 32_test_echon sh

+ test_echon 
+ echo -n 
-n
+ echo -n 
+ exit 1 

f 32_test_echon ksh

+ test_echon
-n

f 32_test_echon dtksh

+ test_echon
+ echo -n
-n
+ echo -n
+ exit 1

3 of the tested shells failed to execute this test


33_test_bi_printf

#!/bin/sh
test_bi_printf () # builtin printf
{
	case `printf '%s' tstr` in tstr) ;; *) exit 1; esac
} 
. portabilitytest/common.sh
test_bi_printf

f 33_test_bi_printf sh

+ test_bi_printf 
+ printf %s tstr 
portabilitytest/33_test_bi_printf: printf: not found

f 33_test_bi_printf ksh

+ test_bi_printf
portabilitytest/33_test_bi_printf[7]: printf:  not found

2 of the tested shells failed to execute this test


34_test_dollar_sg

#!/bin/sh
test_dollar_sg () # dollar-single expansion
{
	x=$'\n'
	case $x in ?) ;; *) exit 1; esac
} 
. portabilitytest/common.sh
test_dollar_sg

f 34_test_dollar_sg sh

+ test_dollar_sg 
x=$\n
+ exit 1 

f 34_test_dollar_sg ksh

+ test_dollar_sg

2 of the tested shells failed to execute this test


35_test_hash_fatl

#!/bin/sh
test_hash_fatl () # some shells (heirloom sh) exits when hash fails
{
	if hash xxx_no_such_prog
	then :
	fi
} 
. portabilitytest/common.sh
test_hash_fatl

f 35_test_hash_fatl sh

+ test_hash_fatl 
+ hash xxx_no_such_prog 
portabilitytest/35_test_hash_fatl: xxx_no_such_prog: not found

1 of the tested shells failed to execute this test


36_test_hash_btin

#!/bin/sh
test_hash_btin () # if there is builtin hash
{
	hash /bin/sh || hash sh=/bin/sh # latter for zsh
} 
. portabilitytest/common.sh
test_hash_btin

all of the tested shells executed this test successfully


37_test_hash_fail

#!/bin/sh
test_hash_fail () # if hash fails in case command not found
{
	if (hash this_c0mmand_does_not_existt) # in subshell for heirloom sh...
	then exit 1
	else exit 0
	fi
} 
. portabilitytest/common.sh
test_hash_fail

f 37_test_hash_fail ksh

+ test_hash_fail

f 37_test_hash_fail dtksh

+ test_hash_fail
+ alias -t -- this_c0mmand_does_not_existt
+ exit 1

2 of the tested shells failed to execute this test


38_test_iexpr

#!/bin/sh
test_iexpr () # $((a + b))
{
	a=1 b=2
	c=$((a + b))
	case $c in 3) ;; *) exit 1; esac
} 
. portabilitytest/common.sh
test_iexpr

f 38_test_iexpr sh

portabilitytest/38_test_iexpr: syntax error at line 5: `c=$' unexpected

1 of the tested shells failed to execute this test


39_test_tfft

#!/bin/sh
test_tfft () # true && false && false || true
{
	_false () { return 1; }
	: && _false && _false || :
} 
. portabilitytest/common.sh
test_tfft

all of the tested shells executed this test successfully


40_test_icat

#!/bin/sh
test_icat () # whether there is $(< file)
{
	d=$(< "$0")
	case $d in '') exit 1; esac
} 
. portabilitytest/common.sh
test_icat

f 40_test_icat sh

portabilitytest/40_test_icat: syntax error at line 4: `d=$' unexpected

1 of the tested shells failed to execute this test