Skip to content

tr: no output for some inputs #5627

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

Closed
liberodark opened this issue Dec 8, 2023 · 3 comments · Fixed by #5640
Closed

tr: no output for some inputs #5627

liberodark opened this issue Dec 8, 2023 · 3 comments · Fixed by #5640
Labels

Comments

@liberodark
Copy link

liberodark commented Dec 8, 2023

Hi,

when using uutils cannot run this command :

head /dev/urandom | tr -dc A-Za-z0-9

I think is probably tr issue.
But work on GNU Core Utils 9.3

head /dev/urandom | tr -dc A-Za-z0-9
NTqSokD626CJf0WtwAuPFYja02VD5vJ5MWApL9XmqF8d9jjHI7914Duxg5wFNokpJnzWTOL876q3xL7fJfj2EFeCLj6HsUQShoiUL0C32IVPXs79NbHqrCwB5hxsNA98NAGK7meGvPpHEOjnSI3PAaRpvEY9Mj73cO19mcNDOUqwc092raYbML8BBISRTZwmM56nBrzF6qeD0EZjEW6inkP3X9Lxo3njYAvqybwWvOnSF34hBy8C7tsX5PKkZ3RDBYxIOiQfJjH4jFfYsvE90jn4H4sB6bC2lOQuK9yzwMpxcSm66D3GrCsIF7f7Efk50Uf5Q1GDr0dvLlAg7lA2dMVlQWSshPStGBG8ryjJPVr8ytyCTI9kjmk1fVO63a3k6Am7PcO6MYOL5t9gQnYnVW3oLKBzc2rLhfonsErTiY96nGZGwIPYWhsh3nLQJ966QqJFtb3buUQAM553HobvzQWyT5NfBFmf2khnsqUQfdWcrqA6gCKk3fDCtvi7AAPFwUOlJyLjnfIC2D1sxf2qou6iumfUt6cr8AfHXDWaIVmiSzojv63yTTsaDR13t1q35gvbYVQ94LEBZVxPQTWsWmk2efvyRkDm8vpY3CIw20N2C46tovnHNlrLU5OA3X5zscMk7kR1PjL7KoQWcT5hdj6ar2kGfm3V09fetryhKVb430FJuDfMtjtdIP

Best Regards

@cakebaker
Copy link
Contributor

Yes, it seems to be related to tr.

cargo run head /dev/urandom | tr -dc A-Za-z0-9 works fine, whereas head /dev/urandom | cargo run tr -dc A-Za-z0-9 doesn't output anything.

@cakebaker
Copy link
Contributor

A simplified example to reproduce the issue is:

$ printf "\200abc" | tr -dc A-Za-z0-9
abc
$ printf "\200abc" | cargo run tr -dc A-Za-z0-9
// no output

@cakebaker cakebaker changed the title Antropy issue tr: no output for some inputs Dec 9, 2023
@tertsdiepraam
Copy link
Member

Oof, this is because of invalid UTF-8. I think this means that tr needs to be refactored to work entirely on bytes instead of chars. I'll give it a try.

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

Successfully merging a pull request may close this issue.

3 participants