awk: a fatal runtime error still runs the END rules and exits 1 instead of 2

Đang mở
#167 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
66/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
cli

Hướng nghiên cứu

Start by locating the runtime error handling and the tests that exercise END rules; the issue provides a reproduction and a proposed regression test, but names no source or test file. Run the supplied test case and compare its exit status and stdout with the GNU awk behavior. Done means a fatal runtime error skips END rules, exits with status 2, and the regression test passes.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug gnu-compat

After a fatal runtime error, such as using an array in a scalar context, GNU
awk stops right away and exits with status 2. uutils awk reports the error,
then runs the END rules and exits with status 1. An END rule that prints a
summary or writes a file therefore runs on half-processed data.

Reproduction

Rust (incorrect)

$ ./target/release/awk 'BEGIN { a[1] = 1; print a } END { print "end" }' </dev/null 2>/dev/null; echo $?
end
1

GNU (correct)

$ gawk 'BEGIN { a[1] = 1; print a } END { print "end" }' </dev/null 2>/dev/null; echo $?
2

Test

#[test]
fn fatal_error_skips_end() {
    ucmd()
        .arg("BEGIN { v[0] = 0; print v } END { print \"not reached\" }")
        .fails_with_code(2)
        .no_stdout();
}

Exposed by the GNU awk test suite: aryprm2, aryprm5, callparam, defref,
functab1, functab2, functab6, fwtest6, fwtest8, prmarscl, sclifin (they also
compare the message text).

Ngôn ngữ chính
Rust
Star
31
Fork
13
Merge trung bình
23 giờ 42 phút
Pull request đã merge (30 ngày)
29

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của uutils/awk

Tất cả issue của uutils/awk

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.