awk: `--debug` / `-D` with `-f` panics

オープン 初心者向け
#168 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
cli

調査の方向性

src/main.rs:86 と src/main.rs:93 の panic 発生箇所から始め、-f を使ったときに --debug と -D がどのようにプログラムのテキストを取得するかを追ってください。提供されているテスト debug_with_program_file_does_not_panic を実行し、ソース範囲がファイルのテキストを使っていることを確認してください。両方の再現が panic せずに完了すれば作業完了です。

索引モデルが issue の本文から書いたものです。

説明

bug crash good first issue

The debugger is not implemented: --debug currently prints a bytecode table.
That code reads the positional program text, so with -f it panics. With
-D -f, the source spans are also sliced out of the wrong text.

Reproduction

Rust (incorrect)

$ echo 'BEGIN { x = 1 }' > d.awk
$ ./target/release/awk --debug -f d.awk </dev/null
thread 'main' panicked at src/main.rs:86:30:
called `Option::unwrap()` on a `None` value
# Exit code: 2

-D -f prog.awk input, with a longer program, panics at src/main.rs:93 with
start byte index ... is out of bounds.

GNU: starts the interactive debugger, which reads commands from stdin.

Test

#[test]
fn debug_with_program_file_does_not_panic() {
    let ts = uutests::util::TestScenario::new("awk");
    ts.fixtures.write("prog.awk", "BEGIN { y = 2 }\n");
    ts.cmd(crate::TESTS_BINARY)
        .args(&["--debug", "-f", "prog.awk"])
        .run()
        .stderr_does_not_contain("panicked");
}

Exposed by the GNU awk test suite: dbugarray1, dbugarray2, dbugarray4,
dbugeval2, dbugeval3, dbugeval4, dbugtypedre1, dbugtypedre2, watchpoint1 (they
need the debugger to pass).

主要言語
Rust
スター
31
フォーク
13
平均マージ
23時間 42分
マージ済み PR(30日)
29

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

uutils/awk のほかの issue

uutils/awk の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。