You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When complementing, we basically translate all bytes not mentioned in STRING1 to bytes in STRING2. This means that only the first 256-len(ARRAYISH1) bytes of ARRAY2 can be accessed.
GNU tr issues a (confusing, but well-intentioned) error message if the command-line argument contains garbage:
$ x230="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
$ echo -n 'hello'| ../gnu/src/tr -c '[:upper:]'"${x230}"# 256-26 times 'x'xxxxx
$ echo -n 'hello'| ../gnu/src/tr -c '[:upper:]'"${x230}x"# 256-26+1 times 'x'../gnu/src/tr: when translating with complemented character classes,string2 must map all characters in the domain to one[$? = 1]
$ echo -n 'hello'| cargo run tr -c '[:upper:]'"${x230}"# we accidentally treat this correctlyxxxxx
$ echo -n 'hello'| cargo run tr -c '[:upper:]'"${x230}x"# this needs to changexxxxx
Computing the ideal size should be easy, but checking it isn't:
If we just consider the length of STRING2, then this will obviously fail due to expansions
I believe there was some reason why checking the length of ARRAY2 didn't work. Hmm. I'm confused.
When complementing, we basically translate all bytes not mentioned in STRING1 to bytes in STRING2. This means that only the first 256-len(ARRAYISH1) bytes of ARRAY2 can be accessed.
GNU
tr
issues a (confusing, but well-intentioned) error message if the command-line argument contains garbage:Computing the ideal size should be easy, but checking it isn't:
(Original issue: #6133)
The text was updated successfully, but these errors were encountered: