| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
shred used Path::exists() and Path::is_file() to pre-check the target, but both return false on any metadata error, so a file whose parent directory lacks search permission was reported as "No such file or directory". Inspect the metadata directly so a genuine ENOENT stays a not-found error while a permission error falls through to the open-for-writing path, which surfaces the real reason.
Merging this PR will improve performance by 24.47%⚠️ Different runtime environments detected
⚡ 1 improved benchmark Performance Changes
Tip Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent. Comparing 0xfandom:shred-inaccessible-real-error (8b695ce) with main (197eac4) Footnotes
|
Sorry, something went wrong.
|
GNU testsuite comparison: Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch) Skipping an intermittent issue tests/cut/bounded-memory (passes in this run but fails in the 'main' branch) Skipping an intermittent issue tests/date/resolution (passes in this run but fails in the 'main' branch) Skip an intermittent issue tests/tail/tail-n0f (was skipped on 'main', now failing) |
Sorry, something went wrong.
|
thanks |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #13639.
shred's pre-checks used Path::exists() and Path::is_file(), both of which return false for any metadata access error, including a permission error. As a result, a file whose parent directory lacks search permission was reported as:
even though it exists.
This replaces the two checks with a single fs::metadata() match:
All the normal cases (missing file, dangling symlink, directory, regular file) keep their existing behaviour. Added a #[cfg(unix)] regression test that shreds a file inside a 0o000 directory and asserts the error mentions "Permission denied" and not "No such file"; it fails on the old Path::exists() code and passes with the fix. This mirrors the fix in #9789 (chmod).