Skip to content

tail: fix panic on write error in bounded_tail#11886

Merged
cakebaker merged 3 commits intouutils:mainfrom
rossilor95:fix-panic-on-write-bounded-tail
Apr 19, 2026
Merged

tail: fix panic on write error in bounded_tail#11886
cakebaker merged 3 commits intouutils:mainfrom
rossilor95:fix-panic-on-write-bounded-tail

Conversation

@rossilor95
Copy link
Copy Markdown
Contributor

Fixes #11809

tail huge-file > /dev/full panicked with unwrap() at tail.rs:594 because
bounded_tail and print_target_section did not propagate write errors.

  • Change print_target_section to return UResult<()>, replacing .unwrap()
    with ?
  • Change bounded_tail to return UResult<()> and propagate the error to its
    caller
  • Add test_failed_write_is_reported_on_seekable_input (Linux-only, uses
    /dev/full with a large seekable file to exercise the bounded_tail path)

@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

Note: The gnu test tests/tail/tail-n0f is now being skipped but was previously passing.
Skip an intermittent issue tests/cut/bounded-memory (was skipped on 'main', now failing)

Comment thread tests/by-util/test_tail.rs Outdated
let ts = TestScenario::new("tail");
let at = &ts.fixtures;

at.write("bigfile", &"x\n".repeat(100_000));
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 don't know if it's machine-specific, but on my machine I have to use a much higher value (1_100_000) to make this test fail when running it without your changes to tail.rs.

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.

Hey @cakebaker, thank you for your review! I think it's system-specific, but I'd like to use a value high enough to exceed any realistic block size. I bumped it to 1_100_000.

@cakebaker cakebaker merged commit fbefc2b into uutils:main Apr 19, 2026
184 of 231 checks passed
@cakebaker
Copy link
Copy Markdown
Contributor

Thanks for your PR!

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.

tail huge-file >/dev/full panics with unwrap()

2 participants