Landing: f7094fe5ff88

Project / Subsystem

gcc / libstdc++

Date

2026-09-28

Author

Gokbey Gazi Keskin

Commit

f7094fe5ff882f0c206d51ebe93f33f0193ce636

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
libstdc++
patch_id
—
commit_hash
f7094fe5ff882f0c206d51ebe93f33f0193ce636
source_type
github
headline
libstdc++: Fix directory removal for old systems lacking unlinkat
tldr
Ensures `std::filesystem::remove_all` correctly removes non-empty directories on systems without `unlinkat`.
author
Gokbey Gazi Keskin
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • filesystem
  • • compatibility
discussion_id_link
—
bugzilla_pr
—
date
2026-09-28T00:00:00.000Z

On systems lacking unlinkat or dirent::d_type, libstdc++’s directory traversal could fail to correctly identify file types. When __erase was called for a non-empty directory, it would use ::remove which retries as rmdir. If rmdir failed due to the directory not being empty, the error was not handled correctly, leading remove_all to report a failure. This commit adjusts the error handling to accept ENOTEMPTY or EEXIST as valid failure reasons for rmdir in this specific scenario, allowing the operation to proceed.