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