Skip to content

expr: Fix parsing negated character classes "[^a]" #7884

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

Merged
merged 5 commits into from
May 4, 2025

Conversation

frendsick
Copy link
Contributor

Fix the logic for parsing carets (^) when used as a character class negation token. Also, the '' character is now only interpreted as an escape token if it is not already escaped.

Added tests to verify the caret parsing and escaping logic.

fixes #7880

frendsick added 4 commits May 4, 2025 15:50
We have to track if the previous character was already escaped to determine
if the '\' character should be interpreted as an escape character.
Copy link

github-actions bot commented May 4, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/stdbuf (passes in this run but fails in the 'main' branch)

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
@frendsick frendsick requested a review from cakebaker May 4, 2025 14:57
Copy link

github-actions bot commented May 4, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/misc/stdbuf (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

@cakebaker cakebaker merged commit 4ee53ac into uutils:main May 4, 2025
70 checks passed
@cakebaker
Copy link
Contributor

Thanks!

@frendsick frendsick deleted the fix/expr-negated-character-classes branch May 4, 2025 15:43
RenjiSann pushed a commit to RenjiSann/coreutils that referenced this pull request May 23, 2025
* expr: Fix regex escape logic

We have to track if the previous character was already escaped to determine
if the '\' character should be interpreted as an escape character.

* expr: Fix parsing caret (^) as character class negation token

* expr: Add tests for parsing carets in regex

* expr: Add missing semicolon

* expr: Simplify boolean assignment

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
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: incorrectly handle regexp and breaks configure scripts
2 participants