xref: /freebsd/bin/sh/tests/execution/shellproc5.0 (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1# This tests a quality of implementation issue.
2# Shells are not required to reject executing binary files as shell scripts
3# but executing, for example, ELF files for a different architecture as
4# shell scripts may have annoying side effects.
5
6T=`mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXXXX"` || exit
7trap 'rm -rf "${T}"' 0
8printf '\177ELF\001!!\012\0\0\0\0\0\0\0\0' >"$T/testshellproc"
9chmod 755 "$T/testshellproc"
10PATH=$T:$PATH
11errout=`testshellproc 3>&2 2>&1 >&3 3>&-`
12r=$?
13[ "$r" = 126 ] && [ -n "$errout" ]
14