-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
In a STRING
with 256 given characters and [y*]
, this "repeated character" should expand to the empty string ""
. With only 255 given characters, it should expand to "y"
, i.e. a single character.
$ x226="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
$ echo -n 'hello' | ../gnu/src/tr -c '[:upper:]' ${x226}'[y*]xxx' # "[y*]" expands to "y", and now set2 contains two distinct characters.
../gnu/src/tr: when translating with complemented character classes,
string2 must map all characters in the domain to one
[$? = 1]
$ echo -n 'hello' | ../gnu/src/tr -c '[:upper:]' ${x226}'[y*]xxxx' # "[y*]" expands to "", so set2 contains only one distinct character.
xxxxx
$ echo -n 'hello' | cargo run tr -c '[:upper:]' ${x226}'[y*]xxxx' # We handle the "" case correctly, accidentally.
xxxxx
$ echo -n 'hello' | cargo run tr -c '[:upper:]' ${x226}'[y*]xxx' # \342\200\246 but we fail in the "y" case.
xxxxx
There are some other ways to detect it, but this is probably the easiest way.
(Original issue: #6133)