Skip to content
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

Replace newer tr command syntax with older ascii specific operations #1343

Merged
merged 2 commits into from
May 14, 2024

Conversation

alangonzalez
Copy link
Contributor

@alangonzalez alangonzalez commented Oct 28, 2022

For busybox support, some commands don't support the newer syntax :alnum: :cntrl: etc options.

I replaced them with the older counterparts and in one case replaced upper->lower lower->upper with awk replacements.

Only issue I can see if we are allowing for LOCALE specific optimizations for using tr with the posix callbacks. I suspect we aren't since in the grep statement on line 71 we use the ASCII syntax of a-z.

So I believe this patch will preserve functionality for all platforms, but if there is concerns on still using :alnum: I can submit revised patch where I check if the tr command supports advanced functionality and then everytime the tr command is about to run put an if statement. I thought this would be klunky given how many uses of tr

The test for tr functionality is like this:

DATA=$(echo testing | tr -d '[:alnum:]')
if [ -n "${DATA}" ]; then
 # tr doesn't work
fi

@mboelen mboelen merged commit a29a578 into CISOfy:master May 14, 2024
@mboelen mboelen self-assigned this May 14, 2024
@mboelen
Copy link
Member

mboelen commented May 14, 2024

Thanks for your work on this. Looks good to me, so I have merged it.

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

Successfully merging this pull request may close these issues.

None yet

2 participants