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

[correctness][confirmed-defect][sort] GNU NUL field-separator notation is rejected

Đang mở Phù hợp với người mới
#634 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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
84/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, shell
Lĩnh vực
backend, cli

Hướng nghiên cứu

Bắt đầu với builtins/sort/sort.go:215-219, nơi các đối số dấu phân cách dài hơn một byte bị từ chối, và so sánh cách xử lý với hành vi của GNU sort -t '\0' được mô tả trong issue. Thêm trường hợp hồi quy tại tests/scenarios/cmd/sort/flags/nul_field_separator.yaml và chạy các kịch bản sort tập trung. Kết quả đạt yêu cầu khi lệnh chấp nhận dấu phân cách và tạo ra b\na\n với mã thoát 0 và không có stderr.

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

Mô tả

Generated by the rshell behavior correctness scanner.

  • Contract: BEH-005
  • Classification: confirmed-defect
  • Impact: medium
  • Target: sort
  • Scanned commit: 514d1cb8188fda6b1accca5955dfab3b0e8aa34a

The supported -t option rejects GNU's documented two-character notation for an ASCII NUL separator. With a missing second field and stable sorting, GNU preserves the input order; rshell instead rejects the valid separator before reading input. No applicable divergence is documented.

Contract sources
  • docs/BEHAVIOR_CONTRACTS.md:13-19,51-55: Supported option values follow reference behavior absent a documented divergence.
  • SHELL_FEATURES.md:33: The supported surface includes -t SEP, stable sorting, and key definitions.
  • /usr/share/info/coreutils.info.gz: sort invocation, --field-separator: The GNU manual explicitly says to specify ASCII NUL using the two-character string '\0', for example sort -t '\0'.
Implementation references
  • builtins/sort/sort.go:215-219: All separator arguments longer than one byte are rejected, including GNU's special backslash-zero notation.

Fixture setup

Create a fresh temporary directory for each execution containing data.txt with exact bytes "b\na\n". Execute from that directory. The script's quoted separator contains one literal backslash followed by zero.

Reproducer

sort -s -t '\0' -k2,2 data.txt

Commands used:

  • GOENV_VERSION=1.26.3 timeout 300s go build -o /tmp/zz_correctness_scan_rshell ./cmd/rshell
  • In a fresh fixture directory, save the exact script as zz_correctness_scan_script.sh, then run: /tmp/zz_correctness_scan_rshell --allowed-commands rshell:sort --allowed-paths "$PWD" zz_correctness_scan_script.sh
  • In an equivalent fresh fixture directory: LC_ALL=C bash --noprofile --norc zz_correctness_scan_script.sh
  • GOENV_VERSION=1.26.3 timeout 300s go test ./tests -run '^TestShellScenarios$/cmd/sort' -count=2 -v
Expected

Exit code: 0

stdout:

b
a

stderr:


Actual

Exit code: 2

stdout:


stderr:

sort: multi-character tab "\\0"

Verification

  • Reproduction runs: 4
  • Reference: Local GNU sort 9.4 reference verified twice from fresh fixtures. rshell CLI reproduced twice; the YAML scenario failed identically in both focused scenario runs. Docker comparison was attempted but skipped after HTTP 502.
  • Temporary test: tests/scenarios/cmd/sort/zz_correctness_scan_cases/zz_correctness_scan_nul_separator.yaml (removed)
  • Suggested regression-test location: tests/scenarios/cmd/sort/flags/nul_field_separator.yaml

Fingerprint: 2bcca49cfc44c5ea39c1f1dcf2a53cc5baa5d2a2278af231bb767ae3e324491c

Ngôn ngữ chính
Go
Star
31
Fork
3
Merge trung bình
2 ngày 11 giờ
Pull request đã merge (30 ngày)
13

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.