Skip to content

ptx: fix panic caused by improper assert - #10916

Merged
sylvestre merged 2 commits into
uutils:mainfrom
WhateverAWS:fix-panic-ptx
Jun 7, 2026
Merged

ptx: fix panic caused by improper assert#10916
sylvestre merged 2 commits into
uutils:mainfrom
WhateverAWS:fix-panic-ptx

Conversation

@WhateverAWS

Copy link
Copy Markdown
Contributor

fixes #10893

@ChrisDryden

Copy link
Copy Markdown
Collaborator

Would it be possible to add a test case for the example in the issue?

@ChrisDryden

Copy link
Copy Markdown
Collaborator

I think this doesn't fully resolve the issue, we're still using before.len() and after.len() instead of the chars.count in the head and tail chunk calculation

@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/tty/tty-eof (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/pr/bounded-memory is no longer failing!
Congrats! The gnu test tests/csplit/csplit-heap is now passing!
Congrats! The gnu test tests/cut/bounded-memory is now passing!
Congrats! The gnu test tests/rm/many-dir-entries-vs-OOM is now passing!

@WhateverAWS

Copy link
Copy Markdown
Contributor Author

I think this doesn't fully resolve the issue, we're still using before.len() and after.len() instead of the chars.count in the head and tail chunk calculation

Ah yeah that make sense.

@oech3

oech3 commented Feb 13, 2026

Copy link
Copy Markdown
Contributor

No need to fix everything at 1 PR.

@sylvestre

Copy link
Copy Markdown
Contributor

but please still provide a test :)

@oech3

oech3 commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

Any progress?

@sylvestre sylvestre left a comment

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.

LGTM — before.len() counts bytes, not characters. Using .chars().count() is the correct fix for multi-byte input.

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tty-eof (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/tail-n0f (passes in this run but fails in the 'main' branch)

@sylvestre sylvestre left a comment

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.

needs a test

@sylvestre
sylvestre merged commit 8a107b6 into uutils:main Jun 7, 2026
163 of 173 checks passed
@sylvestre

Copy link
Copy Markdown
Contributor

i will fix it in a follow up 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.

ptx <<< "🎉 34054698701234657890123456789 0" panics

4 participants