Skip to content

tr: reject unknown character classes during sequence parsing#11398

Merged
sylvestre merged 1 commit intouutils:mainfrom
can1357:tr-reject-unknown-character-classes-during-sequence-parsing
Mar 19, 2026
Merged

tr: reject unknown character classes during sequence parsing#11398
sylvestre merged 1 commit intouutils:mainfrom
can1357:tr-reject-unknown-character-classes-during-sequence-parsing

Conversation

@can1357
Copy link
Contributor

@can1357 can1357 commented Mar 18, 2026

uutils tr accepts malformed character classes like [:fooclass:] as literal bytes, so invalid input continues processing instead of failing. GNU tr treats unknown class names as a parse error and exits non-zero.

Reproduction Steps

printf 'abc\n' | tr '[:fooclass:]' 'x'
# Expected (GNU): stderr contains "tr: invalid character class 'fooclass'" and exits 1
# Actual (uutils): outputs "xbx" with exit code 0

Impact

This is a fail-open validation bug that breaks GNU-compatible error handling.


@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/follow-name (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tty/tty-eof (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/seq/seq-epipe is now passing!

@sylvestre sylvestre merged commit 7369f4d into uutils:main Mar 19, 2026
161 checks passed
sylvestre added a commit to sylvestre/coreutils-1 that referenced this pull request Mar 19, 2026
* tests/tr/tr.pl (invalid-class): New test.
  Identified : uutils/coreutils#11398
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.

2 participants