News for hackers. Stuff that matters.
Re:Don't setenv in multi-threaded code on glibc by cesarb on Tuesday January 31, 2017 @05:31AM (#13529339)
> However, I guess if you fork() (which is not something you can do with the standard rust library AFAIK, so requires unsafe)

https://github.com/rust-lang/rust/blob/0c85f2a1bdb01666e74cd...

Command::spawn() calls fork(). And you can schedule things to run on the child with CommandExt::before_exec().

Re:Don't setenv in multi-threaded code on glibc by amluto on Tuesday January 31, 2017 @12:02PM (#13532512)
That's an unfortunate implementation. posix_spawn() is much faster in large applications because it doesn't need to make all MAP_PRIVATE mappings read-only for CoW purposes.

Rust could hand-roll it by calling clone() directly, but the code is a bit tricky.

Re:Don't setenv in multi-threaded code on glibc by roblabla on Tuesday January 31, 2017 @05:52AM (#13529466)
before_exec is unstable AFAIK ?

EDIT: To be stabilized in 1.15 coming in two days.

Oh well, at least, it shouldn't be possible to invoke UB. Hopefully :D