Why would the author think that the PATH environment variable is being used by the kernel? What an odd assumption.
Path Isn't Real on Linux
11–20 of 120 posts
Re: Path Isn't Real on Linux
#12Path globbing, pipes, redirection, job control (fg/bg), and all shell variables -- not just $PATH -- are all handled by the shell. The kernel has no idea what the current process' environment $PATH is, and doesn't even parse any process environment variables at all.
Re: Path Isn't Real on Linux
#13Why would the author think that the PATH environment variable is being used by the kernel? What an odd assumption.
Re: Path Isn't Real on Linux
#14I did get one thing out of this though. I had honestly wondered for the longest time why we need to call env to get the same functionality as PATH in a shebang.
Ironically, thanks to either an article I read here (or on the crustacean site) recently, I already knew that the shebang is something which is parsed by the kernel, but had not put two and two together at all.
Much like the author. So goes to show the benefits of exploring and thinking about seemingly "obvious" concepts.
Re: Path Isn't Real on Linux
#15Why would the author think that the PATH environment variable is being used by the kernel? What an odd assumption.
One thing I was surprised to learn a couple years ago is that users and groups aren't really tracked much by the Linux kernel: they're just numeric IDs that track process and file ownership. So if you setuid() to a user ID that doesn't exist in /etc/passwd or anywhere else, the kernel won't stop you.
Re: Path Isn't Real on Linux
#16Re: Path Isn't Real on Linux
#17It's real in GNU/Linux tho...
Re: Path Isn't Real on Linux
#18Re: Path Isn't Real on Linux
#19Why would the author think that the PATH environment variable is being used by the kernel? What an odd assumption.
You and I and bunch of other people know it and take it to be self-evident, but someone discovered it (maybe recently, maybe they have known it for a while) and did the nice write up for people who had not have known that yet. https://xkcd.com/1053/
Re: Path Isn't Real on Linux
#20Path globbing, pipes, redirection, job control (fg/bg), and all shell variables -- not just $PATH -- are all handled by the shell. The kernel has no idea what the current process' environment $PATH is, and doesn't even parse any process environment variables at all.
PATH isn't just handled by the shell though. Many (but not all!) of the exec* family of functions in libc respect PATH.