Skip to content

tail: clamp huge --max-unchanged-stats values - #16037

Merged
sylvestre merged 1 commit into
uutils:mainfrom
Logic769:tail-clamp-max-unchanged-stats
Nov 7, 2026
Merged

sylvestre merged 1 commit into
uutils:mainfrom
Logic769:tail-clamp-max-unchanged-stats

Conversation

@Logic769

Copy link
Copy Markdown
Contributor

Problem

A huge value such as tail --max-unchanged-stats=99999999999999999999 was rejected, while GNU clamps it and runs normally.

Change

Parse the value as a wide integer and clamp it to u32::MAX instead of failing. Added a regression test.

Closes #16007

@Logic769
Logic769 force-pushed the tail-clamp-max-unchanged-stats branch from 9e7cff9 to d0aefba Compare October 30, 2026 13:02
Comment thread src/uu/tail/src/args.rs Resolved
Comment thread src/uu/tail/src/args.rs Resolved
Comment thread tests/by-util/test_tail.rs Resolved
@Logic769
Logic769 force-pushed the tail-clamp-max-unchanged-stats branch from d0aefba to 33e7897 Compare October 31, 2026 01:52
@Logic769

Copy link
Copy Markdown
Contributor Author

Used IntErrorKind::PosOverflow -> u32::MAX like uniq and nproc instead of clamping, and covered > u128::MAX plus -1 and abc.

@Logic769
Logic769 force-pushed the tail-clamp-max-unchanged-stats branch from 33e7897 to 364334e Compare November 2, 2026 01:02
@Logic769
Logic769 force-pushed the tail-clamp-max-unchanged-stats branch from 364334e to 0e4e3c4 Compare November 3, 2026 15:42
@Logic769

Logic769 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Failure

The L10n/Build and Test (macos-latest, feat_os_unix) job (126023932329) failed in test_shred::test_shred_dash_remove_truncates_but_does_not_unlink_stdout:

thread 'test_shred::test_shred_dash_remove_truncates_but_does_not_unlink_stdout' panicked at tests/by-util/test_shred.rs:677:14:
Command was expected to succeed. code: 1
stderr = shred: -: Not a file

Reason

This PR only changes tail's --max-unchanged-stats parsing; the failing test is in the existing shred suite, and no compile error or assertion points at the changed code. The other platform test jobs for this PR passed, so this looks like a macOS-specific test/environment issue unrelated to this PR. Please rerun the job.

@Logic769

Logic769 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Failure

The Build (macos-latest, x86_64-apple-darwin, feat_os_unix, true, PGO) job (126078003821) failed in test_tail::test_follow_symlink_appends:

thread 'test_tail::test_follow_symlink_appends' panicked at tests/by-util/test_tail.rs:5564:14:
assertion failed: `(left == right)`
Diff < left / right :
 a
 b
>c

test result: FAILED. 5976 passed; 1 failed; 69 ignored

Reason

This is the known intermittent failure tracked in #15568: the report contains the same command (tail -s.1 --max-unchanged-stats=1 -f latest.log) and the same missing appended line. This PR's only code change is the IntErrorKind::PosOverflow branch for values above u32::MAX; the test uses the value 1, which takes the unchanged Ok(1) path. The failing test function is not modified by this PR. Please rerun the job.

@sylvestre
sylvestre merged commit 6070088 into uutils:main Nov 7, 2026
151 of 153 checks passed
@sylvestre

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 --max-unchanged-stats values should be accepted

2 participants