xref: /freebsd/bin/sh/tests/execution/shellproc5.0 (revision 257e70f1d5ee61037c8c59b116538d3b6b1427a2)
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