Skip to content

tr: fix complemented class truncation ordering#11406

Open
can1357 wants to merge 1 commit intouutils:mainfrom
can1357:tr-fix-complemented-class-truncation-ordering
Open

tr: fix complemented class truncation ordering#11406
can1357 wants to merge 1 commit intouutils:mainfrom
can1357:tr-fix-complemented-class-truncation-ordering

Conversation

@can1357
Copy link
Contributor

@can1357 can1357 commented Mar 18, 2026

uutils tr applies the complemented-character-class guard before --truncate-set1, then truncates the translated set afterward. That allows -ct to translate only a subset of complemented bytes, while GNU rejects this shape instead of allowing partial mapping.

Reproduction Steps

printf A | tr -ct '[:digit:]' X
# Expected (GNU): exit 1 with "when translating with complemented character classes, string2 must map all characters in the domain to one"
# Actual (uutils): exit 0 & outputs "A"

Impact

This breaks GNU compatibility and weakens sanitization pipelines that rely on tr -ct to enforce translation coverage. Inputs that should be rejected can be accepted with under-filtered output.

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.

1 participant