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

Fix issue 5576 (regex matching bug in expr) #5577

Merged
merged 1 commit into from
Nov 23, 2023

Conversation

cobaweel
Copy link
Contributor

@cobaweel cobaweel commented Nov 23, 2023

Fixes #5576

Issue 5576 reported a bug in expr, found by the fuzzer. The problem
turns out to be with the regex match operator :, which is defined in
POSIX and the GNU manual to match the pattern only when it occurs at
the beginning of the string, i.e., the regex has an implicit ^
prepended to it. We hadn't been doing that.

References:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/expr.html
https://www.gnu.org/software/coreutils/manual/html_node/String-expressions.html

@uutils uutils deleted a comment from github-actions bot Nov 23, 2023
Issue 5576 reported a bug in expr, found by the fuzzer. The problem
turns out to be with the regex match operator `:`, which is defined in
POSIX and the GNU manual to match the pattern only when it occurs at
the beginning of the string, i.e., the regex has an implicit `^`
prepended to it. We hadn't been doing that.
Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/tail/symlink is no longer failing!

@cakebaker cakebaker merged commit 97d30bd into uutils:main Nov 23, 2023
51 of 53 checks passed
@cakebaker
Copy link
Contributor

Thanks for your PR!

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.

expr: gnu generates a division by zero when we don't
2 participants