opnsense-src/bin/sh/tests/execution/Makefile
Jilles Tjoelker e0f5c1387d sh: Allow more scripts without #!
Austin Group bugs #1226 and #1250 changed the requirements for shell scripts
without #! (POSIX does not specify #!; this is about the shell execution
when execve(2) returns an [ENOEXEC] error).

POSIX says we shall allow execution if the initial part intended to be
parsed by the shell consists of characters and does not contain the NUL
character.  This allows concatenating a shell script (ending with exec or
exit) and a binary payload.

In order to reject common binary files such as PNG images, check that there
is a lowercase letter or expansion before the last newline before the NUL
character, in addition to the check for the newline character suggested by
POSIX.
2020-05-30 16:00:49 +00:00

71 lines
1.9 KiB
Makefile

# $FreeBSD$
PACKAGE= tests
TESTSDIR= ${TESTSBASE}/bin/sh/${.CURDIR:T}
.PATH: ${.CURDIR:H}
ATF_TESTS_SH= functional_test
${PACKAGE}FILES+= bg1.0
${PACKAGE}FILES+= bg2.0
${PACKAGE}FILES+= bg3.0
${PACKAGE}FILES+= bg4.0
${PACKAGE}FILES+= bg5.0
${PACKAGE}FILES+= bg6.0 bg6.0.stdout
${PACKAGE}FILES+= bg7.0
${PACKAGE}FILES+= bg8.0
${PACKAGE}FILES+= bg9.0
${PACKAGE}FILES+= bg10.0 bg10.0.stdout
${PACKAGE}FILES+= env1.0
${PACKAGE}FILES+= fork1.0
${PACKAGE}FILES+= fork2.0
${PACKAGE}FILES+= fork3.0
${PACKAGE}FILES+= func1.0
${PACKAGE}FILES+= func2.0
${PACKAGE}FILES+= func3.0
${PACKAGE}FILES+= hash1.0
${PACKAGE}FILES+= int-cmd1.0
${PACKAGE}FILES+= killed1.0
${PACKAGE}FILES+= killed2.0
${PACKAGE}FILES+= not1.0
${PACKAGE}FILES+= not2.0
${PACKAGE}FILES+= path1.0
${PACKAGE}FILES+= pipefail1.0
${PACKAGE}FILES+= pipefail2.42
${PACKAGE}FILES+= pipefail3.42
${PACKAGE}FILES+= pipefail4.42
${PACKAGE}FILES+= pipefail5.42
${PACKAGE}FILES+= pipefail6.42
${PACKAGE}FILES+= pipefail7.0
${PACKAGE}FILES+= redir1.0
${PACKAGE}FILES+= redir2.0
${PACKAGE}FILES+= redir3.0
${PACKAGE}FILES+= redir4.0
${PACKAGE}FILES+= redir5.0
${PACKAGE}FILES+= redir6.0
${PACKAGE}FILES+= redir7.0
${PACKAGE}FILES+= set-C1.0
${PACKAGE}FILES+= set-n1.0
${PACKAGE}FILES+= set-n2.0
${PACKAGE}FILES+= set-n3.0
${PACKAGE}FILES+= set-n4.0
${PACKAGE}FILES+= set-x1.0
${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+= shellproc6.0
${PACKAGE}FILES+= subshell1.0 subshell1.0.stdout
${PACKAGE}FILES+= subshell2.0
${PACKAGE}FILES+= subshell3.0
${PACKAGE}FILES+= subshell4.0
${PACKAGE}FILES+= unknown1.0
${PACKAGE}FILES+= unknown2.0
${PACKAGE}FILES+= var-assign1.0
.include <bsd.test.mk>