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