3 ms·
ok, I'm hooked - how is setting an env var in the current process unsafe? My gut says it's not unsafe in a memory-ownership sense, but rather in a race conditio
by andy_xor_andrew 1y ago
ok, I'm hooked - how is setting an env var in the current process unsafe? My gut says it's not unsafe in a memory-ownership sense, but rather in a race condition sense?
whatever the issue is, "setting an env var is unsafe" is so interesting to me that I'm now craving a blog post explaining this
- Orangeair 1y agoIt's a long standing bug, setenv and unsetenv are not thread-safe https://www.evanjones.ca/setenv-is-not-thread-safe.html https://www.evanjones.ca/setenv-is-not-thread-safe.html
- robertlagrant 1y agoI honestly think using setenv is just a terrible idea.
- ak_111 1y agocan you elaborate what is the simpelist alternative?
- darthwalsh 1y agoSimple, you don't set any env vars after starting new threads
- estebank 1y agohttps://doc.rust-lang.org/std/env/fn.set_var.html#safety https://doc.rust-lang.org/std/env/fn.set_var.html#safety