aboutsummaryrefslogtreecommitdiff
path: root/bin/sh/tests/execution/shellproc5.0
blob: 535e5dabc4d92199fdeee7aa62d77b3e36006a00 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
# This tests a quality of implementation issue.
# Shells are not required to reject executing binary files as shell scripts
# but executing, for example, ELF files for a different architecture as
# shell scripts may have annoying side effects.

T=`mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXXXX"` || exit
trap 'rm -rf "${T}"' 0
printf '\177ELF\001!!\012\0\0\0\0\0\0\0\0' >"$T/testshellproc"
chmod 755 "$T/testshellproc"
PATH=$T:$PATH
errout=`testshellproc 3>&2 2>&1 >&3 3>&-`
r=$?
[ "$r" = 126 ] && [ -n "$errout" ]