xref: /freebsd/bin/sh/tests/execution/shellproc4.0 (revision 5f4c09dd85bff675e0ca63c55ea3c517e0fddfcc)
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 '\211PNG\015\012\032\012\0\0\0\015IHDR' >"$T/testshellproc"
9chmod 755 "$T/testshellproc"
10PATH=$T:$PATH
11errout=`testshellproc 3>&2 2>&1 >&3 3>&-`
12r=$?
13[ "$r" = 126 ] && [ -n "$errout" ]
14