C stdlib isn't threadsafe and even safe Rust didn't save us
1–10 of 370 posts
Re: C stdlib isn't threadsafe and even safe Rust didn't save us
#2Re: C stdlib isn't threadsafe and even safe Rust didn't save us
#3I hate envvars. It’s “the Linux way”. I avoid them like the plague. A++ strong recommend.
libc is terrible. The world needs to move on.
Re: C stdlib isn't threadsafe and even safe Rust didn't save us
#4https://doc.rust-lang.org/stable/std/env/fn.set_var.html
There is a patch for glibc which makes `getenv` safe in more cases where the environment is modified but C still allows direct access to the environ so it can't be completely safe in the face of modification https://github.com/bminor/glibc/commit/7a61e7f557a97ab597d6f...
Re: C stdlib isn't threadsafe and even safe Rust didn't save us
#5Re: C stdlib isn't threadsafe and even safe Rust didn't save us
#6Mutable global state is evil. Friends don’t let friends use mutable global state. I hate envvars. It’s “the Linux way”. I avoid them like the plague. A++ strong recommend. libc is terrible. The world needs to move on.
Re: C stdlib isn't threadsafe and even safe Rust didn't save us
#7Mutable global state is evil. Friends don’t let friends use mutable global state. I hate envvars. It’s “the Linux way”. I avoid them like the plague. A++ strong recommend. libc is terrible. The world needs to move on.
Re: C stdlib isn't threadsafe and even safe Rust didn't save us
#8Yet another person is burned by calling setenv() in a multi-threaded context. There really needs to be a big warning banner on the manpage for setenv() that warns about this because it seems like a far more common problem than you would expect.
Re: C stdlib isn't threadsafe and even safe Rust didn't save us
#9Yet another person is burned by calling setenv() in a multi-threaded context. There really needs to be a big warning banner on the manpage for setenv() that warns about this because it seems like a far more common problem than you would expect.
> POSIX.1 does not require setenv() or unsetenv() to be reentrant.
A non-reentrant function cannot be thread safe.
In general (for POSIX, libc and many other libraries: if the docs do not explicitly say "this function is thread safe" they are not).
Re: C stdlib isn't threadsafe and even safe Rust didn't save us
#10Mutable global state is evil. Friends don’t let friends use mutable global state. I hate envvars. It’s “the Linux way”. I avoid them like the plague. A++ strong recommend. libc is terrible. The world needs to move on.