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] Conflicting repeated field separators are silently accepted

Đang mở Phù hợp với người mới
#636 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
82/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
cli, testing

Hướng nghiên cứu

Đọc builtins/sort/sort.go:154 và builtins/sort/sort.go:207-221 để theo dõi quá trình đăng ký và xác thực cờ dấu phân cách. Thêm một kịch bản hồi quy tại tests/scenarios/cmd/sort/flags/repeated_separator_conflict.yaml và chạy các kịch bản sort tập trung; hoàn thành khi các dấu phân cách lặp lại không tương thích tạo ra mã thoát 2 và thông báo chẩn đoán sort: incompatible tabs, trong khi các kịch bản sort hiện có vẫn chạy thành công.

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

Conflicting repeated field separators silently use the final value instead of rejecting the invocation. GNU reports incompatible tabs and exits 2. This can silently sort by unintended keys. No applicable documented divergence was found.

Contract sources
  • docs/BEHAVIOR_CONTRACTS.md:51-55: Repeated, short, long, and attached flags must follow documented or reference behavior.
  • SHELL_FEATURES.md:33: Supports -t SEP and -k KEYDEF without a repeated-separator divergence.
  • /usr/bin/sort: Native GNU coreutils 9.4 reproducibly emitted the exact expected diagnostic and status.
Implementation references
  • builtins/sort/sort.go:154: Registers the separator as one string value, retaining only the final occurrence.
  • builtins/sort/sort.go:207-221: Validates only the final separator; does not detect conflicting prior values.

Fixture setup

No files required. Both engines were executed twice through Python subprocess.run with captured stdout/stderr/status, LC_ALL=C, and a new tempfile.TemporaryDirectory(prefix='zz_correctness_scan_') for each run.

Reproducer

printf 'b:2\na:1\n' | sort -t : --field-separator=, -k2,2n

Commands used:

  • GOENV_VERSION=1.26.3 timeout 300s go build -o /tmp/zz_correctness_scan_rshell ./cmd/rshell
  • /tmp/zz_correctness_scan_rshell --allowed-commands rshell:sort,rshell:printf -c "printf 'b:2\na:1\n' | sort -t : --field-separator=, -k2,2n"
  • LC_ALL=C bash -c "printf 'b:2\na:1\n' | sort -t : --field-separator=, -k2,2n"
  • GOENV_VERSION=1.26.3 timeout 300s go test ./tests -run '^TestShellScenarios$/^cmd$/^sort$/^(basic|flags|errors|help|pathological|zz_correctness_scan_cases)$' -count=2 -timeout 240s
Expected

Exit code: 2

stdout:


stderr:

sort: incompatible tabs
Actual

Exit code: 0

stdout:

a:1
b:2

stderr:


Verification

  • Reproduction runs: 2
  • Reference: GNU coreutils 9.4 under LC_ALL=C. Two clean direct reproductions; the GNU-derived exact YAML expectations also failed in both focused scenario runs.
  • Temporary test: tests/scenarios/cmd/sort/zz_correctness_scan_cases/zz_correctness_scan_repeated_separator.yaml; removed after verification. Script, stdout, and stderr used YAML |+ scalars.
  • Suggested regression-test location: tests/scenarios/cmd/sort/flags/repeated_separator_conflict.yaml

Fingerprint: 6d4358f484ac1b96dbd4011e33187a11575a8c6deb58d7a3bc317d247dd20537

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.