Skip to content

grep: reject misspelled character classes like [:space:] - #100

Merged
sylvestre merged 2 commits into
uutils:mainfrom
sylvestre:grep-char-class-syntax
Aug 8, 2026
Merged

grep: reject misspelled character classes like [:space:]#100
sylvestre merged 2 commits into
uutils:mainfrom
sylvestre:grep-char-class-syntax

Conversation

@sylvestre

Copy link
Copy Markdown
Contributor

No description provided.

@codspeed-hq

codspeed-hq Bot commented Aug 8, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 10 untouched benchmarks
⏩ 17 skipped benchmarks1


Comparing sylvestre:grep-char-class-syntax (5aea8c3) with main (54a846c)

Open in CodSpeed

Footnotes

  1. 17 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown

GNU grep testsuite comparison:

Test results comparison:
  Current:   TOTAL: 128 / PASSED: 76 / FAILED: 31 / SKIPPED: 21
  Reference: TOTAL: 128 / PASSED: 75 / FAILED: 32 / SKIPPED: 21

Changes from main branch:
  TOTAL: +0
  PASSED: +1
  FAILED: -1

Test improvements (1):
  + warn-char-classes

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown

GNU grep testsuite comparison:

Test results comparison:
  Current:   TOTAL: 128 / PASSED: 77 / FAILED: 30 / SKIPPED: 21
  Reference: TOTAL: 128 / PASSED: 76 / FAILED: 31 / SKIPPED: 21

Changes from main branch:
  TOTAL: +0
  PASSED: +1
  FAILED: -1

Test improvements (1):
  + warn-char-classes

@sylvestre
sylvestre merged commit f88244c into uutils:main Aug 8, 2026
22 checks passed
@sylvestre
sylvestre deleted the grep-char-class-syntax branch August 8, 2026 22:46
Comment thread src/matcher.rs
}

/// True when `pattern` holds a bracket expression that looks like a misspelled
/// character class, e.g. `[:space:]` instead of `[[:space:]]`. GNU grep rejects

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not disable ONIG_SYN_OP_POSIX_BRACKET instead? From the oniguruma documentation it sounds like the same thing:
https://github.com/kkos/oniguruma/blob/master/doc/SYNTAX.md#24-onig_syn_op_posix_bracket-enable-posix-xxxx

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see that controls both [:foo:] and [[:foo:]]. 😢

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.

2 participants