Skip to content

pipes.rs: add missing count on fallback#12451

Open
oech3 wants to merge 1 commit into
uutils:mainfrom
oech3:lost-count
Open

pipes.rs: add missing count on fallback#12451
oech3 wants to merge 1 commit into
uutils:mainfrom
oech3:lost-count

Conversation

@oech3
Copy link
Copy Markdown
Contributor

@oech3 oech3 commented May 23, 2026

No description provided.

@oech3 oech3 marked this pull request as ready for review May 23, 2026 13:11
Comment thread src/uucore/src/lib/features/pipes.rs Outdated
let mut drain = Vec::with_capacity(s);
broker_r.take(s as u64).read_to_end(&mut drain)?;
RawWriter(&target).write_all(&drain)?;
bytes_written += s as u64;
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.

As the same calculation is also done in the if case, I would move it outside of the if/else.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ofcause so. But I hesitate += before &drain)?; which might fail.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If read/write fallback failed after +=, std::io::Error is raised. So it is able to dedup.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

And I found another one...

@oech3 oech3 requested a review from cakebaker May 24, 2026 15:13
@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/csplit/csplit-heap is now passing!
Congrats! The gnu test tests/cut/bounded-memory is now passing!

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.

2 participants