nl: section delimiters reset --join-blank-lines grouping
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
バグは src/uu/nl/src/nl.rs の442行目から448行目付近にあります。セクション区切りの判定が実行される前に、空でない行ごとに consecutive_empty_lines がリセットされています。まず cargo build --locked -p uu_nl でビルドし、issue の再現手順を実行して、出力が GNU と異なることを確認してください。区切り文字をまたいで空行の数が引き継がれ、期待される出力と一致し、nl のテストに回帰テストケースが追加されていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
With -ba -l2, a section delimiter resets the count of blank lines in uutils. GNU preserves that count across the delimiter. This makes uutils omit a line number and shifts the numbering of subsequent text.
Reproduced on Linux x86_64 (Debian 13), with LC_ALL=C LANG=C, using uutils 0.13.0 built from current main at 43eb6205c20c551480057cdee98e6e7529cd984d. Compared with GNU coreutils 9.12 from the reference package linked in CONTRIBUTING.md; GNU 9.7 gives the same expected result.
Reproduction
From the repository root:
cargo build --locked -p uu_nl
export LC_ALL=C LANG=C
printf '%s\n' '' '\:\:' '' X | target/debug/nl -ba -l2 -w1 -s: | cat -A
The input is a blank line, a body-section delimiter, another blank line, and X. cat -A marks each line ending with $; the spaces below are literal.
Actual output:
$
$
$
1:X$
Expected output, produced by GNU 9.12 and 9.7 with the same arguments:
$
$
1:$
2:X$
Both implementations exit 0 with empty stderr. GNU numbers the second blank line as 1 and the following text as 2; uutils leaves the blank line unnumbered and numbers the text as 1.
Adding -p also reproduces the difference, so this is separate from restarting line numbers at a section boundary. As controls, both implementations agree when the delimiter is removed, or replaced with ordinary text.
Cause
In nl.rs:442–448, consecutive_empty_lines is reset for every nonempty input line before checking whether the line is a section delimiter. The delimiter therefore clears the pending blank-line group.
No matching report was found in searches of open and closed issues and related PRs for nl, blank-line grouping, and section delimiters. #15586 concerns retaining the current section across input files; this reproduction uses a single input stream and still fails after that fix.
- 主要言語
- Rust
- スター
- 24.3k
- フォーク
- 2.1k
- 平均マージ
- 2日 7時間
- マージ済み PR(30日)
- 397
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
uutils/coreutils のほかの issue
-
難易度 2/5 半日 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
uniq: overflowing -f/-s/-w values with trailing garbage are silently accepted対応中かも @huuan26 が 2 日前に担当しました。 オープンU - uniq
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
fold: tab after an 8 KiB buffer flush exceeds the requested width対応中かも @gibkim が 4 日前に担当しました。 オープンU - fold
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
ls: `--block-size=0` is accepted when `--si` comes later対応中かも @Logic769 が 6 日前に担当しました。 オープンgood first issue U - ls
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
uutils/coreutils#16008 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
uutils/coreutils の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
nervosnetwork/fiber#1723 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
メンテナーはふだん 1 日以内に返信
-
needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 71/100
pbakaus/impeccable#1314 ·
メンテナーはふだん 1 日以内に返信
-
marmite skill: `curl ... | sh` is the first install method, bypassing review and integrity checksオープン
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
rochacbruno/marmite#565 ·