summaryrefslogtreecommitdiff
path: root/bin/sh
diff options
context:
space:
mode:
authorJilles Tjoelker <jilles@FreeBSD.org>2019-12-30 21:32:55 +0000
committerJilles Tjoelker <jilles@FreeBSD.org>2019-12-30 21:32:55 +0000
commit2a55bade0ed3e08a8c4f922df0ecf67d1ee32f53 (patch)
tree04846ce845d3b60d1c74578557cd8835e22d5956 /bin/sh
parentb0a0152ab9944ca4f09712dc8b2428f12f6b2212 (diff)
downloadsrc-test2-2a55bade0ed3e08a8c4f922df0ecf67d1ee32f53.tar.gz
src-test2-2a55bade0ed3e08a8c4f922df0ecf67d1ee32f53.zip
Notes
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/tests/execution/Makefile4
-rw-r--r--bin/sh/tests/execution/shellproc2.018
-rw-r--r--bin/sh/tests/execution/shellproc3.014
-rw-r--r--bin/sh/tests/execution/shellproc4.014
-rw-r--r--bin/sh/tests/execution/shellproc5.014
5 files changed, 64 insertions, 0 deletions
diff --git a/bin/sh/tests/execution/Makefile b/bin/sh/tests/execution/Makefile
index c8fac417de85..983db692faff 100644
--- a/bin/sh/tests/execution/Makefile
+++ b/bin/sh/tests/execution/Makefile
@@ -55,6 +55,10 @@ ${PACKAGE}FILES+= set-x2.0
${PACKAGE}FILES+= set-x3.0
${PACKAGE}FILES+= set-x4.0
${PACKAGE}FILES+= shellproc1.0
+${PACKAGE}FILES+= shellproc2.0
+${PACKAGE}FILES+= shellproc3.0
+${PACKAGE}FILES+= shellproc4.0
+${PACKAGE}FILES+= shellproc5.0
${PACKAGE}FILES+= subshell1.0 subshell1.0.stdout
${PACKAGE}FILES+= subshell2.0
${PACKAGE}FILES+= subshell3.0
diff --git a/bin/sh/tests/execution/shellproc2.0 b/bin/sh/tests/execution/shellproc2.0
new file mode 100644
index 000000000000..85e768070022
--- /dev/null
+++ b/bin/sh/tests/execution/shellproc2.0
@@ -0,0 +1,18 @@
+# $FreeBSD$
+# 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 '\0' >"$T/testshellproc"
+chmod 755 "$T/testshellproc"
+if [ ! -s "$T/testshellproc" ]; then
+ printf "printf did not write a NUL character\n" >&2
+ exit 2
+fi
+PATH=$T:$PATH
+errout=`testshellproc 3>&2 2>&1 >&3 3>&-`
+r=$?
+[ "$r" = 126 ] && [ -n "$errout" ]
diff --git a/bin/sh/tests/execution/shellproc3.0 b/bin/sh/tests/execution/shellproc3.0
new file mode 100644
index 000000000000..6ad455f2cd77
--- /dev/null
+++ b/bin/sh/tests/execution/shellproc3.0
@@ -0,0 +1,14 @@
+# $FreeBSD$
+# 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!!\011\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" ]
diff --git a/bin/sh/tests/execution/shellproc4.0 b/bin/sh/tests/execution/shellproc4.0
new file mode 100644
index 000000000000..fcc72eef073c
--- /dev/null
+++ b/bin/sh/tests/execution/shellproc4.0
@@ -0,0 +1,14 @@
+# $FreeBSD$
+# 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 '\211PNG\015\012\032\012\0\0\0\015IHDR' >"$T/testshellproc"
+chmod 755 "$T/testshellproc"
+PATH=$T:$PATH
+errout=`testshellproc 3>&2 2>&1 >&3 3>&-`
+r=$?
+[ "$r" = 126 ] && [ -n "$errout" ]
diff --git a/bin/sh/tests/execution/shellproc5.0 b/bin/sh/tests/execution/shellproc5.0
new file mode 100644
index 000000000000..c25ffe3e4693
--- /dev/null
+++ b/bin/sh/tests/execution/shellproc5.0
@@ -0,0 +1,14 @@
+# $FreeBSD$
+# 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" ]