19 lines
595 B
Plaintext
19 lines
595 B
Plaintext
|
# $FreeBSD$
|
||
|
# This tests a quality of implementation issue.
|
||
|
# Shells are not required to reject executing binary files as shell scripts
|
||
|
# but executing, for example, ELF files for a different architecture as
|
||
|
# shell scripts may have annoying side effects.
|
||
|
|
||
|
T=`mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXXXX"` || exit
|
||
|
trap 'rm -rf "${T}"' 0
|
||
|
printf '\0' >"$T/testshellproc"
|
||
|
chmod 755 "$T/testshellproc"
|
||
|
if [ ! -s "$T/testshellproc" ]; then
|
||
|
printf "printf did not write a NUL character\n" >&2
|
||
|
exit 2
|
||
|
fi
|
||
|
PATH=$T:$PATH
|
||
|
errout=`testshellproc 3>&2 2>&1 >&3 3>&-`
|
||
|
r=$?
|
||
|
[ "$r" = 126 ] && [ -n "$errout" ]
|