Repository navigation
fix(grep): match GNU grep 3.11 output, options and POSIX regex dialects - #2609
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 347fcef | Commit Preview URL Branch Preview URL |
Oct 07 2026, 11:30 PM |
- Output follows GNU prtext/prline: FILE:LINE:BYTE: prefix order, `-` for context lines, group separators between groups and files whenever a context option is given (-NUM, --group-separator, --no-group-separator), full trailing context after -m, -T, -o skips empty matches and gives each match's offset with -b. - New grep_pattern module translates GNU BRE/ERE (POSIX brackets, intervals, \< \> \b \w, literal leading * in BRE, dropped leading ERE operator with GNU's warning, glibc error messages) onto awk's leftmost-longest AwkRegex; back-references work via fancy-regex under the existing backtrack cap. - getopt_long-style option parsing (unique prefixes, --label, -d, -D, -R, -y, --exclude-from), `-` as stdin, empty -f file matches nothing, directory operands report "Is a directory", invalid UTF-8 output turns the file binary, \r is line data. One FileScan engine serves buffered and streaming runs. Debian-oracle grep score 60.5% -> 96.8% (185 cases); grep probes in the regex set 663 -> 877 of 879. Gaps recorded as L-GREP-002/003.
chaliy
force-pushed
the
claude/project-thread-1mku65
branch
from
October 7, 2026 23:29
6b6e6c1 to
347fcef
Compare
Merged
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Михайло · project thread
What changed
\{m,n\},\+ \? \|,\< \> \b \B \w \W \s \Sand repeated operators.\(abc\)\1. They run on the backtracking engine, which already has a step cap (TM-DOS-025 updated).-o. Matches are leftmost-longest, reusing awk's POSIX matcher.Unmatched ( or \(,Invalid range end) and exit 2.-on context lines.--separator goes between groups and between files whenever any context option is given.--group-separatorand--no-group-separatorare supported.-m, trailing context is printed in full.-NUM,-T,--label,-d,-D,-R(follows symlinks;-rdoes not),-yand--exclude-from.-reads stdin.-ffile matches nothing.-rreports "Is a directory".\ris part of the line, sox$no longer matchesx\r.Why
grep scored 64% on the Debian-oracle bench from pseudo-linus. Agents write
grep -o, back-references and context flags the GNU way, and they hit wrong output or "backreferences are not supported" errors.Before / After
Each case below was also run through GNU grep 3.11 on the host, and the After output matches it in every case.
Debian-oracle bench:
regexset: 663 to 877 of 879.regexset: 64.1% to 81.7% lenient. The sed and awk cases in that set are unchanged.The 6 grep cases still failing differ only in recursive directory order (L-GREP-003).
Risk
-om1now prints every match on the first line, because-mcounts lines.-obinary detection works per line, and NUL is not a line separator in binary files.Checklist
grep_gnu_output_tests,grep_patternunit tests, limitation evidence tests). The full lib suite (2866) and integration suite (1368) pass. The bash comparison run shows no grep mismatches.Generated by Claude Code