[correctness][confirmed-defect][builtins/cut] cut silently accepts repeated selection lists
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
- 72/100
Hướng nghiên cứu
Lỗi nằm trong builtins/cut/cut.go: cờ danh sách được đăng ký bằng StringP gần dòng 101, vì vậy -b thứ hai ghi đè -b thứ nhất, còn modeCount gần dòng 143 đếm số tên cờ khác nhau thay vì số lần xuất hiện. Hãy bắt đầu bằng việc đọc phần thiết lập cờ và logic đếm chế độ, sau đó chạy đoạn tái hiện printf được pipe vào cut -b 1 -b 2. Công việc hoàn thành khi một cờ danh sách lặp lại thoát với mã 1 và thông báo 'cut: only one list may be specified', và một kiểm thử kịch bản trong tests/scenarios/cmd/cut/errors/ bao phủ trường hợp này.
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:
low - Target:
builtins/cut - Scanned commit:
514d1cb8188fda6b1accca5955dfab3b0e8aa34a
Repeating -b selects only the final list instead of rejecting the second list. GNU rejects repeated list specifications, even when the selection mode is unchanged.
Contract sources
[SHELL_FEATURES.md:15](https://github.com/datadog/rshell/blob/514d1cb8188fda6b1accca5955dfab3b0e8aa34a/SHELL_FEATURES.md#L15): Supported surface; Bash/GNU behavior applies where no intentional divergence is documented.
Implementation references
[builtins/cut/cut.go:101](https://github.com/datadog/rshell/blob/514d1cb8188fda6b1accca5955dfab3b0e8aa34a/builtins/cut/cut.go#L101): StringP overwrites the previous list value.[builtins/cut/cut.go:143](https://github.com/datadog/rshell/blob/514d1cb8188fda6b1accca5955dfab3b0e8aa34a/builtins/cut/cut.go#L143): modeCount counts distinct changed flag names, not occurrences.
Fixture setup
Use a fresh empty working directory for each run. Build from /workspace/repo first. No fixture files are needed. Run the CLI and reference commands with that directory as cwd.
Reproducer
printf 'abc\n' | cut -b 1 -b 2
Commands used:
GOENV_VERSION=1.26.3 timeout 300s go build -o /tmp/zz_correctness_scan_rshell ./cmd/rshell/tmp/zz_correctness_scan_rshell --allow-all-commands --allowed-paths "$PWD" -c 'printf '"'"'abc\n'"'"' | cut -b 1 -b 2 'LC_ALL=C.UTF-8 /usr/bin/bash --noprofile --norc -c 'printf '"'"'abc\n'"'"' | cut -b 1 -b 2 'GOENV_VERSION=1.26.3 timeout 300s go test ./tests -run '^TestShellScenarios$/^.$/zz_correctness_scan_' -count=2 -v -timeout 300s
Expected
Exit code: 1
stdout:
stderr:
cut: only one list may be specified
Try 'cut --help' for more information.
Actual
Exit code: 0
stdout:
b
stderr:
Verification
- Reproduction runs: 4
- Reference: Two fresh CLI fixtures and two fresh scenario fixtures; exploratory runs excluded. Native Bash 5.2.21, GNU coreutils 9.4, grep 3.11, sed 4.9, LC_ALL=C.UTF-8. Docker comparison attempted but image pull returned HTTP 502.
- Temporary test: tests/scenarios/zz_correctness_scan_cut_repeated_selection.yaml (removed after evidence capture)
- Suggested regression-test location:
tests/scenarios/cmd/cut/errors/
Fingerprint: 35184ca1c99d958e0fb6e93d5680324e326cc94e1fd52bcd8e712e814d7dd3b8
- Ngôn ngữ chính
- Go
- Star
- 31
- Fork
- 3
- Merge trung bình
- 2 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 14
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của DataDog/rshell
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[correctness][confirmed-defect][builtins/wc] wc pads regular-file stdin as though it were a pipeĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của DataDog/rshell
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
SAP/crossplane-provider-btp#1118 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
benchmark: `make setup` fails because audit-exporter builds with Go 1.25.0 while go.mod requires 1.26.0Có thể đã có người làm @xsvm đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
volcano-sh/volcano#6097 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
os: RawConn methods of a closed File return internal/poll.ErrFileClosing instead of ErrClosedĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Bedrock invoke-with-response-stream reports `stop_reason: "end_turn"` for tool-use turnsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày