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