From 9801f2d1db19c8dc4a80da4562c5365592b70ead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C5=8Dshin?= Date: Mon, 1 Jan 2024 10:25:16 -0500 Subject: [PATCH] Remove COSMOPOLITAN_PROGRAM_EXECUTABLE (#1047) --- libc/calls/getprogramexecutablename.greg.c | 2 -- .../calls/getprogramexecutablename_test.c | 21 ------------------- 2 files changed, 23 deletions(-) diff --git a/libc/calls/getprogramexecutablename.greg.c b/libc/calls/getprogramexecutablename.greg.c index ad85890c9..ddb01b752 100644 --- a/libc/calls/getprogramexecutablename.greg.c +++ b/libc/calls/getprogramexecutablename.greg.c @@ -225,8 +225,6 @@ static inline void InitProgramExecutableNameImpl(void) { // try argv[0], then argv[0].com, then $_, then $_.com. if (TryPath(__argv[0], 1) || - /* TODO(mrdomino): remove after next loader mint */ - TryPath(__getenv(__envp, "COSMOPOLITAN_PROGRAM_EXECUTABLE").s, 0) || TryPath(__getenv(__envp, "_").s, 1)) { goto UseBuf; } diff --git a/test/libc/calls/getprogramexecutablename_test.c b/test/libc/calls/getprogramexecutablename_test.c index 73bc8d525..9a1b4ff59 100644 --- a/test/libc/calls/getprogramexecutablename_test.c +++ b/test/libc/calls/getprogramexecutablename_test.c @@ -103,27 +103,6 @@ TEST(GetProramExecutableName, weirdArgv0NullEnv) { EXITS(0); } -TEST(GetProgramExecutableName, weirdArgv0CosmoVar) { - if (skiptests) return; - char buf[32 + PATH_MAX]; - stpcpy(stpcpy(buf, "COSMOPOLITAN_PROGRAM_EXECUTABLE="), self); - SPAWN(fork); - execve(self, (char *[]){"hello", "Child", self, "hello", 0}, - (char *[]){buf, 0}); - abort(); - EXITS(0); -} - -TEST(GetProgramExecutableName, weirdArgv0WrongCosmoVar) { - if (skiptests) return; - char *bad = "COSMOPOLITAN_PROGRAM_EXECUTABLE=hi"; - SPAWN(fork); - execve(self, (char *[]){"hello", "Child", self, "hello", 0}, - (char *[]){bad, 0}); - abort(); - EXITS(0); -} - TEST(GetProgramExecutableName, movedSelf) { if (skiptests) return; char buf[BUFSIZ];