Repository navigation
tr: accept an unused upper/lower class past the end of set1 - #16764
Merged
Merged
Conversation
When translating, every [:upper:] or [:lower:] in set2 had to line up with one in set1, even a class that starts past the end of set1 and is never used. GNU only checks a class that starts at or before the end of set1, so tr a 'ab[:lower:]' translates there and failed here with "misaligned [:upper:] and/or [:lower:] construct". Fixes uutils#15589
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Contributor
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #15589 (case 3; cases 1 and 2 already behave like GNU on
mainsince #15652).When translating, every
[:upper:]/[:lower:]in set2 had to line up with one in set1, even a class that starts past the end of set1 and is never used. GNU only checks a class that starts at or before the end of set1:The alignment check now skips a class whose position in set2 is greater than set1's length. A class starting right at the end of set1 is still refused, as GNU does.
I compared 11 command lines with GNU tr (output and exit code), including the four above, a range in set1, a class followed by a character, and
[:upper:]/[:lower:]in both sets, and all now match. The newtest_unused_upper_lower_past_set1_is_acceptedcases fail onmain, and twoclass_at_end_of_set1cases were added totest_misaligned_upper_lower_constructto pin the boundary.cargo test --features tr --no-default-features -- test_tr::passes (197), andcargo clippy -p uu_tr --target x86_64-unknown-linux-gnu -- -D warningsis clean.This change was written with the help of an AI assistant (Claude); I reviewed and tested it.
🤖 Generated with Claude Code