[correctness][confirmed-defect][builtins/uniq] uniq ignores an invalid count overwritten by a later flag
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
フラグは builtins/uniq/uniq.go の133行目付近で単一の文字列として保存されており、151行目の検証は最後の値しか確認していません。フラグの設定とその検証を読んでから、再現手順 printf 'a\na\n' | uniq -f wrong -f 0 を実行して終了コードを確認してください。前の無効な -f の値が GNU 形式のメッセージと終了コード 1 で失敗するようになり、tests/scenarios/cmd/uniq/errors/ 配下にシナリオがあれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Generated by the rshell behavior correctness scanner.
- Contract:
BEH-003 - Classification:
confirmed-defect - Impact:
low - Target:
builtins/uniq - Scanned commit:
514d1cb8188fda6b1accca5955dfab3b0e8aa34a
An invalid -f value must fail when encountered. Storing only the final value allows -f wrong -f 0 to silently succeed and process input.
Contract sources
[SHELL_FEATURES.md:55](https://github.com/datadog/rshell/blob/514d1cb8188fda6b1accca5955dfab3b0e8aa34a/SHELL_FEATURES.md#L55): Supported surface; Bash/GNU behavior applies where no intentional divergence is documented.
Implementation references
[builtins/uniq/uniq.go:133](https://github.com/datadog/rshell/blob/514d1cb8188fda6b1accca5955dfab3b0e8aa34a/builtins/uniq/uniq.go#L133): skip-fields is stored as a single StringP value.[builtins/uniq/uniq.go:151](https://github.com/datadog/rshell/blob/514d1cb8188fda6b1accca5955dfab3b0e8aa34a/builtins/uniq/uniq.go#L151): Validation checks only the final stored value.
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 'a\na\n' | uniq -f wrong -f 0
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 '"'"'a\na\n'"'"' | uniq -f wrong -f 0 'LC_ALL=C.UTF-8 /usr/bin/bash --noprofile --norc -c 'printf '"'"'a\na\n'"'"' | uniq -f wrong -f 0 '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:
uniq: wrong: invalid number of fields to skip
Actual
Exit code: 0
stdout:
a
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_uniq_overridden_invalid_count.yaml (removed after evidence capture)
- Suggested regression-test location:
tests/scenarios/cmd/uniq/errors/
Fingerprint: 4f71efcff5df3d86c97abda5e62ade3317a632e940403ad1ba88ab9b1f83be7f
- 主要言語
- Go
- スター
- 31
- フォーク
- 3
- 平均マージ
- 2日 9時間
- マージ済み PR(30日)
- 14
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DataDog/rshell のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
[correctness][confirmed-defect][builtins/wc] wc pads regular-file stdin as though it were a pipeオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
chaitin/agent-compose#770 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
kind/bug
難易度 1/5 1〜3時間 初心者へのやさしさ 85/100
kubernetes-sigs/vsphere-csi-driver#4351 ·
メンテナーはふだん 1 日以内に返信
-
component/gpu-kubelet-plugin component/helm needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
kubernetes-sigs/dra-driver-nvidia-gpu#1559 ·
メンテナーはふだん 1 日以内に返信
-
workflow: redundant goroutine in scheduleRetry対応中かも @moodbased が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 2 日以内に返信