Join Nostr
2023-11-20 09:48:45 UTC

Fabio Manganiello on Nostr: A good write up that summarizes my criticism to the often sclerotic POSIX standard - ...

A good write up that summarizes my criticism to the often sclerotic POSIX standard - yes, I love it, but, like in all relations, nobody is supposed to love forever something that refuses any form of change.

The argument for getenv/setenv can be extended to many other POSIX functions. You'll find countless functions in the specs that state "this function is not thread-safe. If you wanna use it in a threaded environment, you're on your own".

Many bugs in a lot of today's software can be traced back the POSIX functions stubbornly refusing to be thread-safe.

It's almost like if the specs were telling us "you have to read the documentation of each of these functions before using them, so you'll know how they can break, and you're only supposed to use them in single-threaded applications like it's 1985".

What infuriates me is that it's almost trivial to implement a multilock read/write map-based mechanism for environment variables. But POSIX stubbornly refuses to do so, it keeps seeing threads as some experimental feature that the standard isn't even supposed to fully support, and thousands of developers around the world are supposed to implement this mechanism themselves once their application crashes on a getenv.

We deserve better than this.

https://www.evanjones.ca/setenv-is-not-thread-safe.html