git: 52981a1694be - main - sh/tests: Add a second kind of binary scripts without #!

Jilles Tjoelker jilles at FreeBSD.org
Sun Jan 3 22:54:14 UTC 2021


The branch main has been updated by jilles:

URL: https://cgit.FreeBSD.org/src/commit/?id=52981a1694be7a70013e5149c020706c9b6411f9

commit 52981a1694be7a70013e5149c020706c9b6411f9
Author:     Jilles Tjoelker <jilles at FreeBSD.org>
AuthorDate: 2021-01-03 20:27:50 +0000
Commit:     Jilles Tjoelker <jilles at FreeBSD.org>
CommitDate: 2021-01-03 22:53:37 +0000

    sh/tests: Add a second kind of binary scripts without #!
    
    One of the reasons for git commit
    e0f5c1387df23c8c4811f5b24a7ef6ecac51a71a was to make "actually portable
    executables" work. Add a test that is more like those.
    
    MFC after:      1 week
---
 bin/sh/tests/execution/Makefile     |  1 +
 bin/sh/tests/execution/shellproc7.0 | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/bin/sh/tests/execution/Makefile b/bin/sh/tests/execution/Makefile
index cfc21caf3791..ab5218b10a0c 100644
--- a/bin/sh/tests/execution/Makefile
+++ b/bin/sh/tests/execution/Makefile
@@ -63,6 +63,7 @@ ${PACKAGE}FILES+=		shellproc3.0
 ${PACKAGE}FILES+=		shellproc4.0
 ${PACKAGE}FILES+=		shellproc5.0
 ${PACKAGE}FILES+=		shellproc6.0
+${PACKAGE}FILES+=		shellproc7.0
 ${PACKAGE}FILES+=		subshell1.0 subshell1.0.stdout
 ${PACKAGE}FILES+=		subshell2.0
 ${PACKAGE}FILES+=		subshell3.0
diff --git a/bin/sh/tests/execution/shellproc7.0 b/bin/sh/tests/execution/shellproc7.0
new file mode 100644
index 000000000000..2a99ae74c151
--- /dev/null
+++ b/bin/sh/tests/execution/shellproc7.0
@@ -0,0 +1,10 @@
+# $FreeBSD$
+# Non-POSIX trickery that is widely supported,
+# used by https://justine.lol/ape.html
+
+T=`mktemp -d "${TMPDIR:-/tmp}/sh-test.XXXXXXXX"` || exit
+trap 'rm -rf "${T}"' 0
+printf "MZqFpD='\n\0'\n#'\"\necho this is a test\n" >"$T/testshellproc"
+chmod 755 "$T/testshellproc"
+PATH=$T:$PATH
+[ "`testshellproc`" = "this is a test" ]


More information about the dev-commits-src-all mailing list