From 694f5973be38ab03959ec4c2458b5c1e03981a96 Mon Sep 17 00:00:00 2001 From: Theta Nil <20186755+thetanil@users.noreply.github.com> Date: Tue, 21 Jun 2022 06:36:50 -0400 Subject: [PATCH] disable HasMzHeader check per request @jart 31 --- test/libc/calls/execve_test.c | 47 +++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/test/libc/calls/execve_test.c b/test/libc/calls/execve_test.c index 97a7ba957..b8c4a68b8 100644 --- a/test/libc/calls/execve_test.c +++ b/test/libc/calls/execve_test.c @@ -36,13 +36,16 @@ bool UsingBinfmtMisc(void) { return fileexists("/proc/sys/fs/binfmt_misc/APE"); } -bool HasMzHeader(const char *path) { - char buf[2] = {0}; - open(path, O_RDONLY); - read(3, buf, 2); - close(3); - return buf[0] == 'M' && buf[1] == 'Z'; -} +// see: #431 +// todo(jart): figure out what is wrong with github actions +// thetanil: same issue reproducible on my debian 5.10 +// bool HasMzHeader(const char *path) { +// char buf[2] = {0}; +// open(path, O_RDONLY); +// read(3, buf, 2); +// close(3); +// return buf[0] == 'M' && buf[1] == 'Z'; +// } void Extract(const char *from, const char *to, int mode) { ASSERT_SYS(0, 3, open(from, O_RDONLY), "%s %s", from, to); @@ -110,7 +113,8 @@ TEST(execve, system_apeNoModifySelf) { ws = system("bin/life-nomod.com"); EXPECT_TRUE(WIFEXITED(ws)); EXPECT_EQ(42, WEXITSTATUS(ws)); - EXPECT_TRUE(HasMzHeader("bin/life-nomod.com")); + // see: HasMzHeader() + // EXPECT_TRUE(HasMzHeader("bin/life-nomod.com")); system("cp bin/life-nomod.com /tmp/life-nomod.com"); } } @@ -125,7 +129,8 @@ TEST(execve, fork_apeNoModifySelf) { ASSERT_EQ(pid, wait(&ws)); EXPECT_TRUE(WIFEXITED(ws)); EXPECT_EQ(42, WEXITSTATUS(ws)); - EXPECT_TRUE(HasMzHeader("bin/life-nomod.com")); + // see: HasMzHeader() + // EXPECT_TRUE(HasMzHeader("bin/life-nomod.com")); } } @@ -139,7 +144,8 @@ TEST(execve, vfork_apeNoModifySelf) { ASSERT_EQ(pid, wait(&ws)); EXPECT_TRUE(WIFEXITED(ws)); EXPECT_EQ(42, WEXITSTATUS(ws)); - EXPECT_TRUE(HasMzHeader("bin/life-nomod.com")); + // see: HasMzHeader() + // EXPECT_TRUE(HasMzHeader("bin/life-nomod.com")); } } @@ -151,9 +157,10 @@ TEST(execve, system_apeClassic) { system("bin/life-classic.com"); EXPECT_TRUE(WIFEXITED(ws)); EXPECT_EQ(42, WEXITSTATUS(ws)); - if (UsingBinfmtMisc()) { - EXPECT_TRUE(HasMzHeader("bin/life-classic.com")); - } + // see: HasMzHeader() + // if (UsingBinfmtMisc()) { + // EXPECT_TRUE(HasMzHeader("bin/life-classic.com")); + // } } } @@ -167,9 +174,10 @@ TEST(execve, fork_apeClassic) { ASSERT_EQ(pid, wait(&ws)); EXPECT_TRUE(WIFEXITED(ws)); EXPECT_EQ(42, WEXITSTATUS(ws)); - if (UsingBinfmtMisc()) { - EXPECT_TRUE(HasMzHeader("bin/life-classic.com")); - } + // see: HasMzHeader() + // if (UsingBinfmtMisc()) { + // EXPECT_TRUE(HasMzHeader("bin/life-classic.com")); + // } } } @@ -183,9 +191,10 @@ TEST(execve, vfork_apeClassic) { ASSERT_EQ(pid, wait(&ws)); EXPECT_TRUE(WIFEXITED(ws)); EXPECT_EQ(42, WEXITSTATUS(ws)); - if (UsingBinfmtMisc()) { - EXPECT_TRUE(HasMzHeader("bin/life-classic.com")); - } + // see: HasMzHeader() + // if (UsingBinfmtMisc()) { + // EXPECT_TRUE(HasMzHeader("bin/life-classic.com")); + // } } }