> C Doesn't Want to Fix It<p>Or: C knows that <i>it doesn't need fixing.</i><p>How often do I need to `setenv()` anything? The answer is "Never" in the vast majority of programs, because ENVVRS are usually read rather than set, so this issue is nonexistent for them.<p>For the vast majority of the small amount of programs that actually need to use `setenv()`, the answer is: "Maybe once or twice during the entire lifetime of the process, and then only at the very start, probably even before running any threads", meaning this issue is nonexistent for them as well.<p>So, is there a potential issue with thread safetey? Yes. Does it matter given where and under what circumstances it occurs? Not really.<p>> such as Go's os.Setenv (Go issue)<p>Here is the link to the "issue":<p><a href="https://github.com/golang/go/issues/63567">https://github.com/golang/go/issues/63567</a><p>What kind of actual real life production code would continuously set envvars while simutaneously calling a function that tries to read the environment?<p>Yes, this is a footgun. But even the issues author acknowledges, in the issue thread:<p><pre><code> Realistically: this is a pretty rare problem, and documenting
it is probably a fine solution. This is probably going to cost
someone else a couple of days of debugging every couple of
years
</code></pre>
> It has wasted thousands of hours of people's time, either debugging the problems, or debating what to do about it.<p>Source?