util: [refactor] Remove unused create_directories workaround
What changed, and why it matters
This commit removes a helper function that worked around a compiler/library bug in older versions of GCC. The project now requires a newer GCC version where the bug is fixed, so the workaround is no longer needed. There is no security issue here—this is routine code cleanup.
No action required. The commit is a safe refactor; standard review/merge process is sufficient.
Security signals we found
No security-relevant change: pure refactor removing dead workaround code
No modification of call sites, permissions, path handling, or I/O logic
No vendor disclosure of security relevance in commit message or diff
Evidence from the diff
The change deletes fs::create_directories, a thin wrapper around std::filesystem::create_directories that avoided a libstdc++ bug (GCC PR101510) where creating a directory through a symlink could incorrectly report success. The wrapper also deleted the error_code overload to prevent accidental use. Since Bitcoin Core now requires g++-12 or later, the upstream fix is present and the wrapper is dead code. The diff is purely subtractive and does not alter any call sites or behavior on supported toolchains.
Changed components
src/util/fs.hInspect captured patch +0 / −23
diff --git a/src/util/fs.h b/src/util/fs.h
index 8b5c0460..147904d0 100644
--- a/src/util/fs.h
+++ b/src/util/fs.h
@@ -185,29 +185,6 @@ static inline path PathFromString(const std::string& string)
return std::filesystem::path(string);
#endif
}
-
-/**
- * Create directory (and if necessary its parents), unless the leaf directory
- * already exists or is a symlink to an existing directory.
- * This is a temporary workaround for an issue in libstdc++ that has been fixed
- * upstream [PR101510].
- * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101510
- */
-static inline bool create_directories(const std::filesystem::path& p)
-{
- if (std::filesystem::is_symlink(p) && std::filesystem::is_directory(p)) {
- return false;
- }
- return std::filesystem::create_directories(p);
-}
-
-/**
- * This variant is not used. Delete it to prevent it from accidentally working
- * around the workaround. If it is needed, add a workaround in the same pattern
- * as above.
- */
-bool create_directories(const std::filesystem::path& p, std::error_code& ec) = delete;
-
} // namespace fs
/** Bridge operations to C stdio */
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.