mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-10 11:50:29 +00:00
disable HasMzHeader check per request @jart 31
This commit is contained in:
parent
628d952d8b
commit
694f5973be
1 changed files with 28 additions and 19 deletions
|
@ -36,13 +36,16 @@ bool UsingBinfmtMisc(void) {
|
||||||
return fileexists("/proc/sys/fs/binfmt_misc/APE");
|
return fileexists("/proc/sys/fs/binfmt_misc/APE");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HasMzHeader(const char *path) {
|
// see: #431
|
||||||
char buf[2] = {0};
|
// todo(jart): figure out what is wrong with github actions
|
||||||
open(path, O_RDONLY);
|
// thetanil: same issue reproducible on my debian 5.10
|
||||||
read(3, buf, 2);
|
// bool HasMzHeader(const char *path) {
|
||||||
close(3);
|
// char buf[2] = {0};
|
||||||
return buf[0] == 'M' && buf[1] == 'Z';
|
// 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) {
|
void Extract(const char *from, const char *to, int mode) {
|
||||||
ASSERT_SYS(0, 3, open(from, O_RDONLY), "%s %s", from, to);
|
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");
|
ws = system("bin/life-nomod.com");
|
||||||
EXPECT_TRUE(WIFEXITED(ws));
|
EXPECT_TRUE(WIFEXITED(ws));
|
||||||
EXPECT_EQ(42, WEXITSTATUS(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");
|
system("cp bin/life-nomod.com /tmp/life-nomod.com");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +129,8 @@ TEST(execve, fork_apeNoModifySelf) {
|
||||||
ASSERT_EQ(pid, wait(&ws));
|
ASSERT_EQ(pid, wait(&ws));
|
||||||
EXPECT_TRUE(WIFEXITED(ws));
|
EXPECT_TRUE(WIFEXITED(ws));
|
||||||
EXPECT_EQ(42, WEXITSTATUS(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));
|
ASSERT_EQ(pid, wait(&ws));
|
||||||
EXPECT_TRUE(WIFEXITED(ws));
|
EXPECT_TRUE(WIFEXITED(ws));
|
||||||
EXPECT_EQ(42, WEXITSTATUS(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");
|
system("bin/life-classic.com");
|
||||||
EXPECT_TRUE(WIFEXITED(ws));
|
EXPECT_TRUE(WIFEXITED(ws));
|
||||||
EXPECT_EQ(42, WEXITSTATUS(ws));
|
EXPECT_EQ(42, WEXITSTATUS(ws));
|
||||||
if (UsingBinfmtMisc()) {
|
// see: HasMzHeader()
|
||||||
EXPECT_TRUE(HasMzHeader("bin/life-classic.com"));
|
// if (UsingBinfmtMisc()) {
|
||||||
}
|
// EXPECT_TRUE(HasMzHeader("bin/life-classic.com"));
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,9 +174,10 @@ TEST(execve, fork_apeClassic) {
|
||||||
ASSERT_EQ(pid, wait(&ws));
|
ASSERT_EQ(pid, wait(&ws));
|
||||||
EXPECT_TRUE(WIFEXITED(ws));
|
EXPECT_TRUE(WIFEXITED(ws));
|
||||||
EXPECT_EQ(42, WEXITSTATUS(ws));
|
EXPECT_EQ(42, WEXITSTATUS(ws));
|
||||||
if (UsingBinfmtMisc()) {
|
// see: HasMzHeader()
|
||||||
EXPECT_TRUE(HasMzHeader("bin/life-classic.com"));
|
// if (UsingBinfmtMisc()) {
|
||||||
}
|
// EXPECT_TRUE(HasMzHeader("bin/life-classic.com"));
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,9 +191,10 @@ TEST(execve, vfork_apeClassic) {
|
||||||
ASSERT_EQ(pid, wait(&ws));
|
ASSERT_EQ(pid, wait(&ws));
|
||||||
EXPECT_TRUE(WIFEXITED(ws));
|
EXPECT_TRUE(WIFEXITED(ws));
|
||||||
EXPECT_EQ(42, WEXITSTATUS(ws));
|
EXPECT_EQ(42, WEXITSTATUS(ws));
|
||||||
if (UsingBinfmtMisc()) {
|
// see: HasMzHeader()
|
||||||
EXPECT_TRUE(HasMzHeader("bin/life-classic.com"));
|
// if (UsingBinfmtMisc()) {
|
||||||
}
|
// EXPECT_TRUE(HasMzHeader("bin/life-classic.com"));
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue