1*3e3895bfSKrzysztof Piecuch# $FreeBSD: head/bin/sh/tests/execution/shellproc2.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 '\0' >"$T/testshellproc"
10*3e3895bfSKrzysztof Piecuchchmod 755 "$T/testshellproc"
11*3e3895bfSKrzysztof Piecuchif [ ! -s "$T/testshellproc" ]; then
12*3e3895bfSKrzysztof Piecuch	printf "printf did not write a NUL character\n" >&2
13*3e3895bfSKrzysztof Piecuch	exit 2
14*3e3895bfSKrzysztof Piecuchfi
15*3e3895bfSKrzysztof PiecuchPATH=$T:$PATH
16*3e3895bfSKrzysztof Piecucherrout=`testshellproc 3>&2 2>&1 >&3 3>&-`
17*3e3895bfSKrzysztof Piecuchr=$?
18*3e3895bfSKrzysztof Piecuch[ "$r" = 126 ] && [ -n "$errout" ]
19