Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

tests: replace Windows-reserved nul.txt fixtures in tail and awk

Đang mở Phù hợp với người mới
#676 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ó
1/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
88/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
testing

Hướng nghiên cứu

Đọc ba bài kiểm thử được nêu trong builtins/tail/tail_test.go và builtins/tests/awk/awk_test.go. Đổi tên các tệp fixture và toán hạng lệnh từ nul.txt thành một tên có tính di động như records.txt, đồng thời giữ nguyên các byte NUL, tùy chọn và khẳng định. Chạy TestTailZeroTerminatedLines, TestTailZeroTerminatedOffsetMode và TestAwkSingleCharacterRecordSeparator trên Windows và Linux hoặc macOS; hoàn tất khi cả ba đều đạt trên mỗi hệ thống.

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

Mô tả

pre-migration
Describe the bug

Three record-separator tests use nul.txt as a fixture filename. Windows reserves NUL, including names with extensions such as nul.txt, so rshell's confined filesystem access rejects the path before the intended NUL-delimited input can be processed.

Pre-migration work: Fix these fixtures in rshell before migrating the tests into datadog-agent. This is a test portability issue; the failures do not establish a defect in tail/awk record parsing.

Affected tests, still present on rshell main at 7d23f9f1d22cae7f3f581efb03ba02fc1ed4717e:

Steps to reproduce

Run these three tests on Windows. The tail fixtures contain alpha\x00beta\x00gamma\x00; the awk fixture contains alpha\x00beta\x00. Each command opens the fixture using the name nul.txt.

Expected behavior

The tests should open ordinary temporary files and verify their existing record-separator assertions on Windows as well as Linux/macOS.

Actual behavior

The tail tests return exit code 1 and empty stdout rather than the expected beta\x00gamma\x00.

The awk test reports:

awk: fatal: cannot open file `nul.txt' for reading: openat nul.txt: path escapes from parent

The NUL-delimited records are missing from its output; the subsequent comma-delimited command still produces output. The error is the filesystem API rejecting a reserved Windows path, not evidence that the test attempted directory traversal.

Proposed fix and validation

Rename the affected fixtures and command operands to a portable filename such as records.txt. Preserve the NUL bytes, command options, and existing assertions. Validate all three tests on Windows and retain Linux/macOS coverage; no change to filesystem restrictions or command parsing is needed for the fixture fix.

Environment and evidence
Ngôn ngữ chính
Go
Star
31
Fork
3
Merge trung bình
1 ngày 18 giờ
Pull request đã merge (30 ngày)
12

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

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 DataDog/rshell

Tất cả issue của DataDog/rshell

Issue tương tự

Thêm issue về Go

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.