pr: -n repeats line numbers after a form feed
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
バグは src/uu/pr/src/pr.rs の 1153-1156 行目付近にある get_pages にあります。フォームフィード分岐は line_num を増やさずに FileLine を追加しますが、改行分岐は 1183 行目付近で line_num を増やします。cargo build --locked -p uu_pr の後に printf 'a\fb\nc\n' | target/debug/pr -T -n:1 で再現します。出力が GNU と同じく 1:a、2:b、3:c となり、末尾の改行の有無や -N10 の指定にかかわらず -n の番号付けが正しく保たれれば完了です。
索引モデルが issue の本文から書いたものです。
説明
pr -n does not advance the line counter when a form feed ends a line. The next line receives the same number, and later line numbers are too small.
Reproduced on Linux x86_64 (Debian 13), using uutils 0.13.0 from main at 43eb6205c20c551480057cdee98e6e7529cd984d, with LC_ALL=C LANG=C. GNU coreutils 9.12 (the reference package linked in CONTRIBUTING.md) and 9.7 both produce the expected result.
From the repository root:
cargo build --locked -p uu_pr
export LC_ALL=C LANG=C
printf 'a\fb\nc\n' | target/debug/pr -T -n:1
Actual output:
1:a
1:b
2:c
Expected output (GNU 9.12 and 9.7):
1:a
2:b
3:c
Both exit 0 with empty stderr. -T removes pagination, making the numbering difference visible without headers or page separators.
The problem also occurs without a trailing newline and with -N10. With a\fb\fc\n, all three lines receive number 1. As controls, a\nb\nc\n and a\n\fb\nc\n produce 1, 2, 3 in both implementations.
In get_pages, pr.rs:1153–1156, the form-feed branch pushes a FileLine without incrementing line_num. The newline branch increments it at line 1183.
No matching report was found in searches of open and closed issues and related PRs for pr numbering and form feeds. Existing #12313 and #14334 describe column formatting and page padding, rather than repeated line numbers.
- 主要言語
- Rust
- スター
- 24.3k
- フォーク
- 2.1k
- 平均マージ
- 1日 22時間
- マージ済み PR(30日)
- 396
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
uutils/coreutils のほかの issue
-
U - od
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
U - nl
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
uniq: overflowing -f/-s/-w values with trailing garbage are silently accepted対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンU - uniq
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
U - unexpand
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
uutils/coreutils の issue をすべて見る
似ている issue
-
docs(metrics): replace stale src/metrics.rs line anchors in dashboard-metrics.md with symbol namesオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
ci-cd desktop size:low telemetry-improvement telemetry-round-1
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
vfarcic/dot-agent-deck#2079 ·
メンテナーはふだん 1 日以内に返信
-
enhancement user-priority/P3
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 2 日以内に返信