grep - `-L` with `-m 0` or `-v ''` prints nothing; GNU still lists every file
メンテナーはふだん 2 日以内に返信
評価
調査の方向性
issueでは uu_grep の早期終了が指摘され、Rustの回帰テストも含まれていますが、ソースファイルやテストファイルのパスは示されていません。まずその早期終了箇所と、-L に関する既存のgrepテストを探してください。提示された -m 0 と -v -e '' のケースを追加し、読み取り可能なファイルが一覧表示される一方で終了コードが1のままであることを確認してください。GNUの skip-read ケースについても、-G、-E、-F でテストが必要です。
索引モデルが issue の本文から書いたものです。
説明
When no line can be selected (-m 0, or -v with an empty pattern) uu_grep exits 1 before
opening any file. That is right for plain output, -c, -l and -q, but not for
-L/--files-without-match: every file then has no selected line, and GNU grep lists each
readable file (and still reports files it cannot open). uu_grep prints nothing.
Exposed by the GNU test skip-read (grep -L -m0 y /dev/null and grep -L -v "" /dev/null must print /dev/null, with -G, -E and -F).
Reproduction
$ printf 'red\n' > colors
Rust (incorrect)
$ ./target/release/grep -L -m 0 red colors
# Output: (none)
# Exit code: 1
$ ./target/release/grep -L -v -e '' colors
# Output: (none)
# Exit code: 1
GNU (correct)
$ LC_ALL=C /usr/bin/grep -L -m 0 red colors
colors
# Exit code: 1
$ LC_ALL=C /usr/bin/grep -L -v -e '' colors
colors
# Exit code: 1
$ LC_ALL=C /usr/bin/grep -L -m 0 red colors nosuch
colors
/usr/bin/grep: nosuch: No such file or directory
# Exit code: 2
Test
#[test]
fn files_without_match_with_nothing_selectable() {
for args in [&["-L", "-m", "0", "pine"][..], &["-L", "-v", "-e", ""][..]] {
let (scene, mut c) = ucmd();
scene.fixtures.write("trees.txt", "pine\noak\n");
c.args(args)
.arg("trees.txt")
.fails_with_code(1)
.stdout_only("trees.txt\n");
}
}
Exposed by the GNU grep test suite: skip-read.
- 主要言語
- Rust
- スター
- 147
- フォーク
- 34
- 平均マージ
- 3日 18時間
- マージ済み PR(30日)
- 21
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
uutils/grep のほかの issue
-
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 日以内に返信
-
gnu-compat good first issue oss-scanner
難易度 2/5 1〜3時間 初心者へのやさしさ 75/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 日以内に返信