Skip to content

find: skip broken pipe errors in wasm executions - #802

Merged
sylvestre merged 2 commits into
uutils:mainfrom
aki-kong:fix/find-wasm-pipe-break
Aug 1, 2026
Merged

find: skip broken pipe errors in wasm executions#802
sylvestre merged 2 commits into
uutils:mainfrom
aki-kong:fix/find-wasm-pipe-break

Conversation

@aki-kong

Copy link
Copy Markdown
Contributor

Fixes #801.

out.flush().unwrap() in Printer::print panics when stdout is a
closed pipe (e.g. find . | head -5), since the flush fails with
EPIPE. Only visible on wasm32-wasip1: there's no SIGPIPE there, so
the write error reaches this unwrap() and panics. On native Linux
the same unguarded unwrap() exists, but SIGPIPE usually kills the
process before this code runs, so the bug goes unnoticed.

Treat io::ErrorKind::BrokenPipe on write!/flush() as expected
and exit 0, instead of panicking.

@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.93%. Comparing base (6ef1fd6) to head (965d734).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #802      +/-   ##
==========================================
+ Coverage   91.90%   91.93%   +0.03%     
==========================================
  Files          35       35              
  Lines        7248     7251       +3     
  Branches      376      378       +2     
==========================================
+ Hits         6661     6666       +5     
+ Misses        444      443       -1     
+ Partials      143      142       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed-hq

codspeed-hq Bot commented Jul 31, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 20 untouched benchmarks


Comparing aki-kong:fix/find-wasm-pipe-break (965d734) with main (6ef1fd6)

Open in CodSpeed

@github-actions

Copy link
Copy Markdown

Commit 18052b1 has test result changes:

bfs testsuite:

Test results comparison:
  Current:   TOTAL: 314 / PASSED: 265 / FAILED: 43 / SKIPPED: 6
  Reference: TOTAL: 315 / PASSED: 267 / FAILED: 42 / SKIPPED: 6

Changes from main branch:
  TOTAL: -1
  PASSED: -2
  FAILED: +1

New test failures (2):
  - gnu/exec_flush_fail
  - gnu/print_error

Test improvements (1):
  + gnu/files0_from_ok

@sylvestre

Copy link
Copy Markdown
Contributor

could you please add a test to make sure it doesn't regress ?

flush() only checked for BrokenPipe, silently ignoring other errors
(e.g. ENOSPC). Add regression tests for both cases.
@aki-kong

Copy link
Copy Markdown
Contributor Author

could you please add a test to make sure it doesn't regress ?

I've tried fixing the new test failures from the bfs test suite. Also added the regression tests. Let me know if it is good to go.

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

Commit 965d734 has test result changes:

bfs testsuite:

Test results comparison:
  Current:   TOTAL: 313 / PASSED: 267 / FAILED: 40 / SKIPPED: 6
  Reference: TOTAL: 315 / PASSED: 267 / FAILED: 42 / SKIPPED: 6

Changes from main branch:
  TOTAL: -2
  PASSED: +0
  FAILED: -2

Test improvements (2):
  + gnu/files0_from_ok
  + gnu/okdir_path_empty

@sylvestre
sylvestre merged commit 9350384 into uutils:main Aug 1, 2026
23 checks passed
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.

bug(find): unwrap() panic / wasm trap on EPIPE when piped to head (WASI target)

2 participants