12a55badeSJilles Tjoelker# This tests a quality of implementation issue. 22a55badeSJilles Tjoelker# Shells are not required to reject executing binary files as shell scripts 32a55badeSJilles Tjoelker# but executing, for example, ELF files for a different architecture as 42a55badeSJilles Tjoelker# shell scripts may have annoying side effects. 52a55badeSJilles Tjoelker 62a55badeSJilles TjoelkerT=`mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXXXX"` || exit 72a55badeSJilles Tjoelkertrap 'rm -rf "${T}"' 0 82a55badeSJilles Tjoelkerprintf '\0' >"$T/testshellproc" 92a55badeSJilles Tjoelkerchmod 755 "$T/testshellproc" 102a55badeSJilles Tjoelkerif [ ! -s "$T/testshellproc" ]; then 112a55badeSJilles Tjoelker printf "printf did not write a NUL character\n" >&2 122a55badeSJilles Tjoelker exit 2 132a55badeSJilles Tjoelkerfi 142a55badeSJilles TjoelkerPATH=$T:$PATH 152a55badeSJilles Tjoelkererrout=`testshellproc 3>&2 2>&1 >&3 3>&-` 162a55badeSJilles Tjoelkerr=$? 172a55badeSJilles Tjoelker[ "$r" = 126 ] && [ -n "$errout" ] 18