Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[correctness][confirmed-defect][builtins/uniq] uniq ignores an invalid count overwritten by a later flag

オープン 初心者向け
#663 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
go, shell
領域
cli

調査の方向性

フラグは 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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

DataDog/rshell のほかの issue

DataDog/rshell の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。