It would seem that libstdc++.so.0.6.28 does not end up built with -D_TS_ERRNO defined (e.g., via -D_REENTRANT). This results in errno checks in, for example, std::filesystem::status() looking at the global errno rather than using *___errno() as it should to local the thread-specific error number.
This was noticed when trying to use Clickhouse, a large C++ program that makes heavy use of threads. The std::filesystem::exists() call would throw unexpectedly for files or directories that did not exist -- but it would report "Error 0" as the reason.
It's possible to pass -D_TS_ERRNO in via CFLAGS and CXXFLAGS while building GCC -- but I expect we should enable this by default and always in the source itself, in order to ensure correct binaries are always created.
It would seem that
libstdc++.so.0.6.28does not end up built with-D_TS_ERRNOdefined (e.g., via-D_REENTRANT). This results inerrnochecks in, for example,std::filesystem::status()looking at the globalerrnorather than using*___errno()as it should to local the thread-specific error number.This was noticed when trying to use Clickhouse, a large C++ program that makes heavy use of threads. The
std::filesystem::exists()call would throw unexpectedly for files or directories that did not exist -- but it would report "Error 0" as the reason.It's possible to pass
-D_TS_ERRNOin viaCFLAGSandCXXFLAGSwhile building GCC -- but I expect we should enable this by default and always in the source itself, in order to ensure correct binaries are always created.