uutils / uutils/coreutils

all: many utils incorrectly retries when write failed with EINTR

Open
#12,469 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

U - All
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

https://github.com/uutils/coreutils/issues/1275 and https://github.com/uutils/coreutils/pull/8946 introduced retry when read/write catched EINTR. But it seems unconditional retry (without sighandler) is incorrect.

https://github.com/coreutils/coreutils/issues/268#issuecomment-4529837577

For example, strace -o /dev/null -e inject=write:error=EINTR:when=2 tee should cause
tee: 'standard output': Interrupted system call (until we introduce zero-copy code path), but we don't do that.

We don't need to exactly match when=N, but we should not infinitely retry.

[Edit] read is unrelated. write should not retly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the retry changes in uutils/coreutils issue #1275 and pull request #8946, then trace the affected write paths across the utilities. Run the provided strace injection against tee and verify that write interrupted by EINTR reports the error instead of retrying indefinitely; read behavior is out of scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.