Userland: Fix PATH environment variable ordering

This commit is contained in:
Jean-Baptiste Boric 2021-08-07 14:05:33 +02:00 committed by Andreas Kling
parent b1add5860b
commit 2084289162
Notes: sideshowbarker 2024-07-18 07:05:19 +09:00
5 changed files with 5 additions and 5 deletions

View file

@ -103,7 +103,7 @@ The system server entry looks as below:
[TestRunner@ttyS0]
Executable=/home/anon/tests/run-tests-and-shutdown.sh
StdIO=/dev/ttyS0
Environment=DO_SHUTDOWN_AFTER_TESTS=1 TERM=xterm PATH=/bin:/usr/bin:/usr/local/bin
Environment=DO_SHUTDOWN_AFTER_TESTS=1 TERM=xterm PATH=/usr/local/bin:/usr/bin:/bin
User=anon
WorkingDirectory=/home/anon
BootModes=self-test

View file

@ -96,7 +96,7 @@ static void run_command(String command, bool keep_open)
args[arg_index++] = "-c";
args[arg_index++] = command.characters();
}
const char* envs[] = { "TERM=xterm", "PAGER=more", "PATH=/bin:/usr/bin:/usr/local/bin", nullptr };
const char* envs[] = { "TERM=xterm", "PAGER=more", "PATH=/usr/local/bin:/usr/bin:/bin", nullptr };
int rc = execve(shell.characters(), const_cast<char**>(args), const_cast<char**>(envs));
if (rc < 0) {
perror("execve");

View file

@ -114,7 +114,7 @@ static void update_path_environment_variable()
path.append(getenv("PATH"));
if (path.length())
path.append(":");
path.append("/bin:/usr/bin:/usr/local/bin");
path.append("/usr/local/bin:/usr/bin:/bin");
setenv("PATH", path.to_string().characters(), true);
}

View file

@ -70,7 +70,7 @@ static void run_command(int ptm_fd, String command)
args[1] = "-c";
args[2] = command.characters();
}
const char* envs[] = { "TERM=xterm", "PATH=/bin:/usr/bin:/usr/local/bin", nullptr };
const char* envs[] = { "TERM=xterm", "PATH=/usr/local/bin:/usr/bin:/bin", nullptr };
rc = execve("/bin/Shell", const_cast<char**>(args), const_cast<char**>(envs));
if (rc < 0) {
perror("execve");

View file

@ -1821,7 +1821,7 @@ Shell::Shell()
path.append(getenv("PATH"));
if (path.length())
path.append(":");
path.append("/bin:/usr/bin:/usr/local/bin");
path.append("/usr/local/bin:/usr/bin:/bin");
setenv("PATH", path.to_string().characters(), true);
}