Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tr: Should not accept unaligned [:upper:] #6341

Closed
BenWiederhake opened this issue May 4, 2024 · 4 comments
Closed

tr: Should not accept unaligned [:upper:] #6341

BenWiederhake opened this issue May 4, 2024 · 4 comments
Labels

Comments

@BenWiederhake
Copy link
Collaborator

$ echo -en '123456789' | tr -t "123456789" "[:upper:]"
tr: misaligned [:upper:] and/or [:lower:] construct
[$? = 1]
$ echo -en '123456789' | cargo run tr -t "123456789" "[:upper:]"
00000000  41 42 43 44 45 46 47 48  49                       |ABCDEFGHI|
00000009
$

Note that this really checks for alignment, not just presence:

$ echo -en '123abcABC' | tr -t "1[:lower:]" "[:upper:]_"
tr: misaligned [:upper:] and/or [:lower:] construct
[$? = 1]
$ echo -en '123abcABC' | cargo run tr -t "1[:lower:]" "[:upper:]_"
A23BCDABC

(Original issue: #6133)

@BenWiederhake
Copy link
Collaborator Author

Fixed by #6445.

@cvonelm
Copy link
Contributor

cvonelm commented Jun 16, 2024

We have to reopen this issue as my PR fails to address the root problem.

this command line is fine in GNU tr but fails with uutils

tr '[:upper:][:lower:]' 'a-z[:upper:]'

Apparently GNU tr fully expands the tokens left of the upper in set2 and lower in set1 before checking.

@cakebaker cakebaker reopened this Jun 17, 2024
@BenWiederhake
Copy link
Collaborator Author

This looks like it has been resolved by #6513, hasn't it? At least currently it works, and the test added by that PR looks very similar.

@cvonelm
Copy link
Contributor

cvonelm commented Jul 3, 2024

Yeah, this Issue is what that PR was all about

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants