grep - the interval `{,}` (`\{,\}` in BRE) is rejected or read literally; GNU reads it as `{0,}`
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start by locating the regex parsing and matching paths for basic and extended modes, then review the existing grep tests and the GNU bre test, especially Spencer BRE test #40. Add coverage for \{,\} and {,} matching zero or more occurrences, using the supplied reproduction and expected output. Done means both modes select the same lines as GNU grep and the regression test passes.
索引モデルが issue の本文から書いたものです。
説明
Known: closed PR #152 (closed by its author without merging) — https://github.com/uutils/grep/pull/152
GNU grep reads an interval with neither bound, {,}, as {0,} (the same as *). In basic
mode uu_grep rejects \{,\} with an Oniguruma error and exit 2; in extended mode it reads
{,} as literal text and so selects different lines. PR #152 rewrote the pattern text and
was closed; no issue tracks the behaviour.
Exposed by the GNU test bre (Spencer BRE test #40, a\{,\} must match a\{,\}).
Reproduction
Rust (incorrect)
$ printf 'mo\nmooo\n' | ./target/release/grep 'mo\{,\}'
grep: invalid pattern "mo\{,\}": invalid repeat range {lower,upper}
# Exit code: 2
$ printf 'mo\nmooo\n' | ./target/release/grep -E 'mo{,}'
# Output: (none)
# Exit code: 1
GNU (correct)
$ printf 'mo\nmooo\n' | LC_ALL=C /usr/bin/grep 'mo\{,\}'
mo
mooo
# Exit code: 0
$ printf 'mo\nmooo\n' | LC_ALL=C /usr/bin/grep -E 'mo{,}'
mo
mooo
# Exit code: 0
Test
#[test]
fn empty_interval_means_zero_or_more() {
for args in [&["-c", "bz\\{,\\}"][..], &["-c", "-E", "bz{,}"][..]] {
let (_s, mut c) = ucmd();
c.args(args)
.pipe_in("b\nbzzz\nq\n")
.succeeds()
.stdout_only("2\n");
}
}
Exposed by the GNU grep test suite: bre.
- 主要言語
- Rust
- スター
- 147
- フォーク
- 34
- 平均マージ
- 3日 18時間
- マージ済み PR(30日)
- 21
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
uutils/grep のほかの issue
-
grep - `-L` with `-m 0` or `-v ''` prints nothing; GNU still lists every file対応中かも @yunusarda-sudo が 5 日前に担当しました。 オープンbug gnu-compat good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 2 日以内に返信
-
grep - `-v -o` with `-A`/`-B`/`-C` prints nothing; GNU prints the matches found in the context linesオープンbug gnu-compat good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 2 日以内に返信
-
grep - interval counts above 32767 are accepted; GNU rejects them with `Regular expression too big`対応中かも @yunusarda-sudo が 5 日前に担当しました。 オープンbug gnu-compat good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 2 日以内に返信
-
grep - `--exclude-dir=./dir` does not exclude the operand `./dir`対応中かも @yunusarda-sudo が 5 日前に担当しました。 オープンbug gnu-compat good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 2 日以内に返信
-
bug gnu-compat good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 2 日以内に返信
似ている issue
-
marketing
難易度 2/5 半日 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
S: Untriaged T: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
libnyanpasu/clash-nyanpasu#6537 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1時間未満 初心者へのやさしさ 62/100
tauri-apps/tao#1445 ·
メンテナーはふだん 1 日以内に返信
-
bug P3
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
-
go good first issue test
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 2 日以内に返信