Skip to content

Fix pr -o/--indent overflow handling#12974

Merged
cakebaker merged 1 commit into
uutils:mainfrom
TheAdamWarlock:fix/pr-indent-offset-overflow
Jun 19, 2026
Merged

Fix pr -o/--indent overflow handling#12974
cakebaker merged 1 commit into
uutils:mainfrom
TheAdamWarlock:fix/pr-indent-offset-overflow

Conversation

@TheAdamWarlock

Copy link
Copy Markdown
Contributor

Fixes #12764

Parse the indent margin as i32 (matching GNU pr's behavior) instead of usize. Offsets larger than i32::MAX now fail with '-o MARGIN' invalid line offset: <val>: Value too large for defined data type instead of attempting a huge
allocation. Negative and non-numeric values exit with code 1 and a clear invalid line offset message. Adds tests covering too-large, negative, and non-numeric offsets.

Parse the indent margin as i32 to match GNU pr's behavior.  Add test cases as well.
@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/cut/bounded-memory (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/tail/pipe-f is now passing!

@cakebaker cakebaker merged commit de30f0a into uutils:main Jun 19, 2026
173 of 175 checks passed
@cakebaker

Copy link
Copy Markdown
Contributor

Thanks!

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(pr): panics when -o is a large number

2 participants