Skip to content

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

Merged
cakebaker merged 1 commit intouutils:mainfrom
cobaweel:issue-5576
Nov 23, 2023
Merged

Fix issue 5576 (regex matching bug in expr)#5577
cakebaker merged 1 commit intouutils:mainfrom
cobaweel:issue-5576

Conversation

@cobaweel
Copy link
Copy Markdown
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.
@github-actions
Copy link
Copy Markdown

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
@cakebaker
Copy link
Copy Markdown
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