sed - with `--posix`, `-e 'i\'` takes the next `-e` as its text
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
まず GNU sed のテスト compile-errors と issue で言及されているコード compile_text_command_posix を読み、次に提示された再現手順を --posix で実行します。式の境界での a\、i\、c\ に対する、示された回帰テストケースを追加します。POSIX のケースが終了コード 1 と「incomplete command」で失敗し、GNU 拡張のケースは引き続き成功すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
As a GNU extension, sed -e 'i\' -e hello uses the next -e fragment as the
text of a, i or c. With --posix, GNU sed does not join the fragments,
and an a\, i\ or c\ at the end of an -e is an incomplete command.
uutils sed joins them in both modes. The same text in one -f file (i\
followed by hello on the next line) is valid POSIX and works in both
implementations.
The GNU test compile-errors exposes this. Open PR #625 rewrites
compile_text_command_posix, but a build of it still accepts this case.
Reproduction
Rust (incorrect)
$ echo w | ./target/release/sed --posix -e 'i\' -e hello
hello
w
# Exit code: 0
GNU (correct)
$ echo w | sed --posix -e 'i\' -e hello
sed: -e expression #1, char 2: incomplete command
# Exit code: 1
$ echo w | sed -e 'i\' -e hello
hello
w
# Exit code: 0
Test
#[rstest]
#[case::append("a\\")]
#[case::insert("i\\")]
#[case::change("c\\")]
fn test_posix_text_command_stops_at_expression_end(#[case] cmd: &str) {
new_ucmd!()
.args(&["--posix", "-e", cmd, "-e", "second fragment"])
.pipe_in("line\n")
.fails()
.code_is(1)
.no_stdout()
.stderr_contains("incomplete command");
// GNU extension: without --posix the next fragment is the text.
new_ucmd!()
.args(&["-e", cmd, "-e", "second fragment"])
.pipe_in("")
.succeeds()
.no_output();
}
Exposed by the GNU sed test suite: compile-errors.
- 主要言語
- Rust
- スター
- 123
- フォーク
- 53
- 平均マージ
- 2日 8時間
- マージ済み PR(30日)
- 40
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
uutils/sed のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
sed - script parser skips CR, VT, FF (and 0x85, 0xA0) as blanks; GNU skips only space and tab対応中かも @Himanshu-singh04 が 22 日前に担当しました。 オープンbug gnu-compat good first issue oss-scanner
難易度 2/5 1〜3時間 初心者へのやさしさ 89/100
メンテナーはふだん 1 日以内に返信
-
sed - with `-s` or `-i`, the file read by `R` is not restarted for each input file対応中かも @Himanshu-singh04 が 22 日前に担当しました。 オープンbug gnu-compat good first issue oss-scanner
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
sed - output already produced is lost when a runtime error stops processing対応中かも @Himanshu-singh04 が 21 日前に担当しました。 オープンbug gnu-compat good first issue oss-scanner
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信
-
sed - unknown POSIX class names like `[[:foo:]]` or `[[:word:]]` are accepted instead of rejected対応中かも @draarivpatel-ui が 7 日前に担当しました。 オープンbug gnu-compat good first issue oss-scanner
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
autofix:working
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
libracoder/kiri#1138 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
roc-lang/basic-webserver#277 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
samkerrcode/opengent#113 ·
メンテナーはふだん 1 日以内に返信
-
app bug session
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信