1*3e3895bfSKrzysztof Piecuch# $FreeBSD: head/bin/sh/tests/execution/shellproc5.0 356208 2019-12-30 21:32:55Z jilles $ 2*3e3895bfSKrzysztof Piecuch# This tests a quality of implementation issue. 3*3e3895bfSKrzysztof Piecuch# Shells are not required to reject executing binary files as shell scripts 4*3e3895bfSKrzysztof Piecuch# but executing, for example, ELF files for a different architecture as 5*3e3895bfSKrzysztof Piecuch# shell scripts may have annoying side effects. 6*3e3895bfSKrzysztof Piecuch 7*3e3895bfSKrzysztof PiecuchT=`mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXXXX"` || exit 8*3e3895bfSKrzysztof Piecuchtrap 'rm -rf "${T}"' 0 9*3e3895bfSKrzysztof Piecuchprintf '\177ELF\001!!\012\0\0\0\0\0\0\0\0' >"$T/testshellproc" 10*3e3895bfSKrzysztof Piecuchchmod 755 "$T/testshellproc" 11*3e3895bfSKrzysztof PiecuchPATH=$T:$PATH 12*3e3895bfSKrzysztof Piecucherrout=`testshellproc 3>&2 2>&1 >&3 3>&-` 13*3e3895bfSKrzysztof Piecuchr=$? 14*3e3895bfSKrzysztof Piecuch[ "$r" = 126 ] && [ -n "$errout" ] 15