########################################################################
# #
# This software is part of the ast package #
# Copyright (c) 1982-2010 AT&T Intellectual Property #
# and is licensed under the #
# Common Public License, Version 1.0 #
# by AT&T Intellectual Property #
# #
# A copy of the License is available at #
# (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) #
# #
# Information and Software Systems Research #
# AT&T Research #
# Florham Park NJ #
# #
# David Korn <dgk@research.att.com> #
# #
########################################################################
function err_exit
{
print -u2 -n "\t"
let Errors+=1
}
alias err_exit='err_exit $LINENO'
integer Errors=0
ulimit -c 0
integer foo=33
# check for global variables and $0
function foobar
{
case $1 in
2) print -r - "$0";;
integer bar=10
typeset foo=20;;
esac
}
function print
{
command print hi
}
if [[ $(print) != hi ]]
then err_exit "command print not working inside print function"
fi
unset -f print
if [[ $(foobar 1) != '33 bye' ]]
then err_exit 'global variables not correct'
fi
if [[ $(foobar 2) != 'foobar' ]]
then err_exit '$0 not correct'
fi
then err_exit 'environment override not correct'
fi
then err_exit 'scoping error'
fi
if [[ $(foobar 3) != 'foo 10' ]]
fi
foobar 4
if [[ $foo != 36 ]]
fi
function foobar
{
(return 0)
}
{
else err_exit 'return within subshell inside function error'
fi
}
then err_exit 'abc() print hi not working'
fi
( unset -f abc )
then err_exit 'abc() print hi not working after subshell unset'
fi
(
function f
{
exit 1
}
f
err_exit 'exit from function not working'
)
unset -f foo
function foo
{
x=2
(
x=3
cd $tmp
print bar
)
if [[ $x != 2 ]]
then err_exit 'value of x not restored after subshell inside function'
fi
}
x=1
then err_exit 'cd inside nested subshell not working'
fi
then err_exit 'cd inside nested subshell changes $PWD'
fi
fi
print -r -- "$1"
!
function passargs
{
}
then err_exit 'passing args from functions to scripts not working'
fi
trap 'exit 0' EXIT
function foo
{
}
!
then err_exit 'exit trap incorrectly triggered'
fi
then err_exit 'exit trap incorrectly triggered when invoked with -c'
fi
then err_exit 'exit trap not triggered when invoked with -c'
fi
{
return
}
shift
print -r -- "$1"
then err_exit 'arguments not restored by posix functions'
fi
function foo
{
print hello
}
(
function foo
{
print bar
}
then err_exit 'function definitions inside subshells not working'
fi
)
then err_exit 'function definitions inside subshells not restored'
fi
function bar
{
print "$y"
}
function foo
{
typeset x=3
y=$x bar
}
x=1
if [[ $(foo) != 3 ]]
then err_exit 'variable assignment list not using parent scope'
fi
unset -f foobar
function foobar
{
print foo
}
!
autoload foobar
then err_exit 'autoload not working'
fi
unset -f foobar
function foobar
{
typeset -r x=3
return 0
}
!
then err_exit 'abc() without a function body is not a syntax error'
fi
function winpath
{
usage='q pathname ...'
q) format=q;;
esac
done
print done
}
then err_exit 'getopts --man in functions not working'
fi
then err_exit 'getopts with bad option in functions not working'
fi
unset -f x
function x
{
print "$@"
}
typeset -ft x
then err_exit 'name=value pair args not passed to traced functions'
fi
function bad
{
false
}
trap 'val=false' ERR
val=true
if [[ $val != false ]]
then err_exit 'set -e not working for functions'
fi
function bad
{
false
return 0
}
val=true
if [[ $val != true ]]
then err_exit 'set -e not disabled for functions'
fi
{
false
return 0
}
val=true
if [[ $val != false ]]
then err_exit 'set -e not inherited for posix functions'
fi
trap - ERR
function myexport
{
nameref var=$1
if (( $# > 1 ))
then export $1=$2
fi
if (( $# > 2 ))
return
fi
typeset val
print ${val#"$1="}
}
fi
fi
then err_exit "export inside function not working with recursive function -- expected 'fun2', got '$val'"
fi
fi
then err_exit "name=value not added to export list with function call -- expected 'try3', got '$val'"
fi
fi
unset zzz
fi
if [[ $val ]]
fi
unset zzz
typeset -u zzz
function foo
{
print $zzz
}
fi
typeset i j=$1
for i
do print i=$i j=$j
[[ $i == a ]] && xpd b
done
}
if [[ $(xpd a c) != $'i=a j=a\ni=b j=b\ni=c j=a' ]]
then err_exit 'for loop function optimization error'
fi
typeset -A visited
integer level=0
function closure
{
(( $# > 5 )) && return 1
typeset tmp r=0
visited[$1]=1
do
done
return $r
}
(
function a {
print a
}
function b {
print 1
a
print 2
typeset -ft a b
PS4=X
b
print 'false' > try
function ignore
{
./try
return 0
}
trap "print error; exit 1" ERR
ignore
EOF
then err_exit 'ERR trap not cleared'
fi
print ': This does nothing' > foobar
unset -f foobar
got=$?
exp=126
then err_exit "function file without function definition processes wrong error -- expected '$exp', got '$got'"
fi
print 'set a b c' > dotscript
[[ $(PATH=$PATH: $SHELL -c '. dotscript;print $#') == 3 ]] || err_exit 'positional parameters not preserved with . script without arguments'
cd ~- || err_exit "cd back failed"
function errcheck
{
false
print ok
}
x="$(
function foobar
{
print ok
}
typeset -f foobar
)"
unset -f a b c
a()
{
b
b
print ${.sh.fun}
}
b() { : ;}
++EOF
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX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XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
f()
{
cat <<\M
++EOF
v=1
function f
{
typeset i
for i in 0 1
do typeset v
v=$i
[[ $v == $i ]] || return 1
done
}
f || err_exit "typeset optimization bug"
function f
{
}
function g
{
}
unset -f foo
function foo
{
typeset line=$1
set +n
while [[ $line ]]
do if [[ ! $varname ]]
[[ $line ]] && continue
else print ok
return
fi
done
}
unset x
x=$(
set -e
integer count=0
function err_f
{
then print failed
else false
fi
}
false
)
export environment
typeset global
function f
{
typeset i t local
for i
do case $i in
[-+]*) set "$@"
continue
;;
local) local=f
t=$(typeset +f $local)
;;
t=$(typeset +f $global)
;;
t=$(typeset +f $environment)
;;
literal)t=$(typeset +f f)
;;
set -- f
t=$(typeset +f $1)
;;
esac
[[ $t ]] || err_exit "typeset +f \$$i failed"
done
}
f local global environment literal positional
$SHELL -c '
unset var
var=( ident=1 )
function fun
{
}
fun
function main
{
typeset key
typeset -A entry
}
++EOF++
sub()
{
(
OPTIND=1
done
)
}
function bar
{
}
function foo
{
set -o nounset
}
set +o nounset
function red
{
integer -S d=0
(( d++ ))
return 0
}
xyz=$0
function traceback
{
do
[[ ${.sh.lineno} == "$1" ]] || err_exit "\${.sh.lineno}=${.sh.lineno} does not match $1 on level ${.level}"
done
}
function foo
{
}
function bar
{
: $LINENO "$1"
}
function .sh.fun.set
{
print -r -- "${.sh.value}"
}
function abc
{
:
}
def()
{
:
}
unset -f .sh.fun.set
# tests for debug functions
integer baseline
: line 1
: line 3
+++
# Print one line in a call stack
function _Dbg_print_frame
{
typeset -i pos=$1
typeset fn=$2
typeset filename="$3"
typeset -i line=$4
typeset arg=$5
shift 5
fi
}
function _Dbg_debug_trap_handler
{
do
_Dbg_print_frame "${.level}" "$0" "${.sh.file}" "${.sh.lineno}" "${.sh.command##* }" "$@"
done
}
do
print -r -- "${.sh.lineno}"
done
}
set -- $(bar)
[[ $1 == $2 ]] && err_exit ".sh.inline optimization bug"
( $SHELL -c ' function foo { typeset x=$1;print $1;};z=();z=($(foo bar)) ') 2> /dev/null || err_exit 'using a function to set an array in a command sub fails'
{
got=$(
s=$(ulimit -s)
fi
$SHELL << \+++
f()
{
if (($1>1))
then x=$(f $(($1-1))) || exit 1
fi
return 0
}
f 257 && print ok
+++
)
#! $SHELL
print \$\$
+++
function foo
{
typeset pid
wait $!
}
# make sure compiled functions work
function bar
{
print foo
}
function foobar
{
}
++++
# test for functions in shell having side effects.
cd "$tmp"
function bar
{
print foobar
}
function foo
{
}
: $(foo)
: $(foo)
[[ $(typeset +f) == *foo* ]] && err_exit 'function in subshell leaving side effects of function foo after reload'
[[ $(typeset +f) == *bar* ]] && err_exit 'function in subshell leaving side effects of function bar after reload'
unset -f foo
typeset -A bar
function foo
{
typeset -i bar[$1].x
bar[$1].x=5
}
foo sub
function A
{
# (( stderr )) && print >&2
}
function B
{
A
}
x=$(B)