Skip to content

rm: report traversal failed on getdents EIO - #15209

Open
Franklin-Qi wants to merge 1 commit into
uutils:mainfrom
Franklin-Qi:feature-issue#15206-rm-traversal-failed
Open

Franklin-Qi wants to merge 1 commit into
uutils:mainfrom
Franklin-Qi:feature-issue#15206-rm-traversal-failed

Conversation

@Franklin-Qi

Copy link
Copy Markdown
Contributor

When directory listing fails mid-walk (e.g. injected getdents EIO), emit GNU's "traversal failed" even under -f instead of later "Directory not empty".

Closes: #15206

Comment thread tests/by-util/test_rm.rs Outdated
Comment thread src/uu/rm/src/platform/unix.rs Outdated
@Franklin-Qi
Franklin-Qi force-pushed the feature-issue#15206-rm-traversal-failed branch from d0e68dc to 63bd6f2 Compare October 10, 2026 10:44
@codspeed

codspeed Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Merging this PR will improve performance by 4.45%

⚠️ 4 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

⚡ 1 improved benchmark
✅ 7 untouched benchmarks
⏩ 464 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ ⚠️ Simulation rm_recursive_tree 14.4 ms 13.8 ms +4.45%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing Franklin-Qi:feature-issue#15206-rm-traversal-failed (166a6a6) with main (175f6e1)2

Open in CodSpeed

Footnotes

  1. 464 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. No successful run was found on main (b8657e8) during the generation of this report, so 175f6e1 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

Comment thread tests/by-util/test_rm.rs Outdated
Comment thread tests/by-util/test_rm.rs Outdated
Comment thread tests/by-util/test_rm.rs Outdated
Comment thread tests/by-util/test_rm.rs Outdated
@Franklin-Qi
Franklin-Qi force-pushed the feature-issue#15206-rm-traversal-failed branch from 63bd6f2 to 13e0456 Compare October 13, 2026 07:39
Comment thread tests/by-util/test_rm.rs Outdated
Comment thread tests/by-util/test_rm.rs Outdated
@Franklin-Qi
Franklin-Qi force-pushed the feature-issue#15206-rm-traversal-failed branch from 13e0456 to 444e7a5 Compare October 13, 2026 09:59
Comment thread src/uu/rm/src/platform/unix.rs
When directory listing fails mid-walk (e.g. injected getdents EIO),
emit GNU's "traversal failed" even under -f instead of later
"Directory not empty".

Closes: uutils#15206
@Franklin-Qi
Franklin-Qi force-pushed the feature-issue#15206-rm-traversal-failed branch from 444e7a5 to 166a6a6 Compare October 16, 2026 02:46
Comment thread tests/by-util/test_rm.rs
/// even under `-f`. Without that, rm later fails with "Directory not empty".
#[test]
#[cfg(target_os = "linux")]
#[cfg(not(wasi_runner))]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WASMTIME_LOG can't unblock these tests — it's trace-only, with no fault= equivalent to inject the getdents64 EIO — so #[cfg(not(wasi_runner))] is correct. It's still a useful WASI-side strace substitute for debugging; #15453 wires it into wasi.yml.

Comment thread tests/by-util/test_rm.rs
.current_dir(scene.fixtures.as_string())
.output()
else {
return; // missing strace

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this only skips if strace is missing, if ptrace is blocked (containers) strace fails and the test fails too. could you please probe like test_no_preserve_root_literal_root does?

Comment thread tests/by-util/test_rm.rs
#[test]
#[cfg(target_os = "linux")]
#[cfg(not(wasi_runner))]
fn test_recursive_getdents_eio_subdirectory_reports_traversal_failed() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is almost the same code as the test above, could you please dedup with a helper taking the when= and the expected path?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can for loop

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rm: "traversal failed" is not shown when 2nd getdents64 failed on broken device

4 participants