Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Isn’t best practice to read all environment variables on boot and never use setenv? The only place where setenv would matter is for spawning new processes where you should probably be creating an new environ cloned from the current one and update the new values. Using getenv/setenv as an IPC messaging mechanism seems to be an opportunity for lots of issues aside from it historically not being multithreaded-safe on Linux and having all sorts of potential memory leaks hiding (which is what the post ignores when it says that it’s thread safe on MacOS).


No. Because you might end up using a library that calls getenv().

Java does what you say, but it still presents problems for JNI code using libraries that want to getenv().




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: