You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
os: Root.RemoveAll error does not name correct filepath #82509
This example removes a directory with a read-only subdirectory, once with os.RemoveAll and once with Root.RemoveAll for comparison.
Both fail on the same file but only os.RemoveAll reports the correct file path.
package main
import (
"fmt""os"
)
funcmain() {
// test/dir/locked/file where locked is read-onlyos.MkdirAll("test/dir/locked", 0o755)
os.WriteFile("test/dir/locked/file", nil, 0o644)
os.Chmod("test/dir/locked", 0o555)
fmt.Println(os.RemoveAll("test/dir"))
root, err:=os.OpenRoot("test")
iferr!=nil {
panic(err)
}
fmt.Println(root.RemoveAll("dir"))
}
Root.RemoveAll reports only the name it was given and the caller cannot tell which entry could not be removed. All other similar functiosn report the correct path like os.RemoveAll does
What did you expect to see?
Root.RemoveAll should correctly report the full path of the file that triggered the error, like or.RemoveAll and others do.
there was a related bug in os.RemoveAll reported in #30491
Activity
gabyhelp commentedon Oct 25, 2026
Related Issues
Related Code Changes
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
gopherbot commentedon Oct 26, 2026
Change https://go.dev/cl/853985 mentions this issue:
os: preserve child paths in Root.RemoveAll errors