ptx: contexts stop at line ends without -S, and -S drops the sentence end
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start in src/uu/ptx/src/ptx.rs, especially read_lines around line 327 and the -S handling around line 323. Compare default and -S output with the two examples in the issue, then check the ptx tests for coverage. Done means default mode joins contexts across lines as GNU ptx does, while -S preserves the matched sentence end and does not mark the final sentence as truncated.
索引モデルが issue の本文から書いたものです。
説明
Without -S, GNU ptx (in its default GNU mode) builds contexts from sentences, not lines: a sentence ends at ., ? or ! (optionally followed by closing quotes or brackets) that is followed by an end of line, a tab or two spaces, and lines in between are joined. uutils ptx uses each line on its own:
$ printf 'one two\nthree four\n' > f
$ ptx f
three four
one two
three four
one two
$ gnuptx f # GNU coreutils 9.12
one two three four
one two three four
one two three four
one two three four
-G output matches, as there a line is the unit for both.
Passing a sentence regexp with -S gets closer, but two more differences show up there: the matched sentence end is dropped from the context, and the last sentence ends with a truncation flag because the final newline becomes a trailing space:
$ printf 'Hello world. Foo bar\n' > g
$ ptx -S '\. ' g
Foo bar/
Hello world
Foo bar/
Hello world
$ gnuptx -S '\. ' g
Foo bar
Hello world.
Foo bar
Hello world.
The line split is buffer.lines() in read_lines (src/uu/ptx/src/ptx.rs:327); with -S, re.split(&buffer) throws away the matched text and s.replace('\n', " ") (ptx.rs:323) turns the final newline into the trailing space.
uutils coreutils main 91d4f6ada, GNU coreutils 9.12.
- 主要言語
- Rust
- スター
- 24.3k
- フォーク
- 2.1k
- 平均マージ
- 2日 6時間
- マージ済み PR(30日)
- 399
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
uutils/coreutils のほかの issue
-
難易度 2/5 半日 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
pr: -n repeats line numbers after a form feed対応中かも @1kailas が今日担当しました。 オープンU - pr
難易度 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対応中かも @huuan26 が 1 日前に担当しました。 オープンU - uniq
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
uutils/coreutils の issue をすべて見る
似ている issue
-
Perl - Readme Drift対応中かも @Omnideth が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
CommunityToolkit/Aspire#2375 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信