3 ms·
> Please show me from which book you got the idea that env variables are expected to change throughout the lifetime of a process. POSIX specifies two functions
by jeroenhd 3y ago
> Please show me from which book you got the idea that env variables are expected to change throughout the lifetime of a process.
POSIX specifies two functions that alter environment variables. It could've specified that env variables are supposed to be mapped into a read-only memory page where available to indicate that they shouldn't be altered, but it didn't, and instead provided an explicit read/write system.
- rewmie 3y ago> POSIX specifies two functions that alter environment variables. The same POSIX spec you're citing also states in no ambiguous terms that setenv is not thread-safe. It's pointless to quote a section of a spec to try to justify failing to comply with the very same section of the very same spec.
- jeroenhd 3y agoI'm not saying it doesn't. I'm just saying the spec indicates that environment variables can change during runtime. The spec is the problem in my opinion, you can't implement it in a way that doesn't introduce footguns.