xref: /freebsd/bin/sh/tests/execution/shellproc3.0 (revision e9ac41698b2f322d55ccf9da50a3596edb2c1800)
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!!\011\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