[correctness][missing-coverage][sort] Mixed files and repeated stdin lack a regression test
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
阅读 builtins/sort/sort_test.go:380-415 中现有的输入源测试,以及 tests/scenarios/cmd/sort/basic/ 下的场景测试。使用所述文件和重复的 - 操作数,添加建议的 tests/scenarios/cmd/sort/basic/mixed_files_repeated_stdin.yaml 用例。运行 go test ./tests -run '^TestShellScenarios$/cmd/sort';用例通过并确认预期的排序输出,其中未终止的记录彼此分开,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Generated by the rshell behavior correctness scanner.
- Contract:
BEH-004 - Classification:
missing-coverage - Impact:
low - Target:
sort - Scanned commit:
514d1cb8188fda6b1accca5955dfab3b0e8aa34a
Existing tests cover stdin, one '-' operand, multiple files, and unterminated records separately. They do not meaningfully cover their interaction: a file followed by repeated '-' operands must consume stdin once and preserve separate record boundaries when both inputs lack final newlines. The tested behavior matched GNU; no defect was demonstrated.
Contract sources
docs/BEHAVIOR_CONTRACTS.md:45-49: Standard input, '-', file operands, and multiple inputs must interact like the reference command.sort --help: Command help promises sorted concatenation and stdin reading for '-' operands.builtins/sort/sort_test.go:380-415: Existing input-source tests exercise these cases separately.
Implementation references
builtins/sort/sort.go:372-387: Operands are read individually and their records appended before sorting.builtins/sort/sort.go:427-446: Each '-' operand wraps the same stdin reader.
Fixture setup
Create data.txt with exact bytes "b\nd" and stdin.txt with exact bytes "c\na" in a fresh temporary directory. Neither file ends with a newline.
Reproducer
sort data.txt - - < stdin.txt
Commands used:
GOENV_VERSION=1.26.3 timeout 300s go build -o /tmp/zz_correctness_scan_rshell ./cmd/rshellIn a fresh fixture directory: /tmp/zz_correctness_scan_rshell --allowed-commands rshell:sort --allowed-paths "$PWD" -c 'sort data.txt - - < stdin.txt'In an equivalent fresh fixture directory: LC_ALL=C bash --noprofile --norc -c 'sort data.txt - - < stdin.txt'GOENV_VERSION=1.26.3 timeout 300s go test ./tests -run '^TestShellScenarios$/cmd/sort' -count=2 -v
Verification
- Reproduction runs: 4
- Reference: GNU sort 9.4 matched the expected result twice from fresh fixtures. Both CLI executions and both temporary scenario executions passed.
- Temporary test: tests/scenarios/cmd/sort/zz_correctness_scan_cases/zz_correctness_scan_mixed_inputs.yaml (removed)
- Suggested regression-test location:
tests/scenarios/cmd/sort/basic/mixed_files_repeated_stdin.yaml
Fingerprint: f38bb9f21b7f40b8e04041b1bb63daaa0387a24dcc0256fd43134ff98b63622f
- 主要语言
- Go
- 星标
- 31
- 派生
- 3
- 平均合并
- 1 天 13 小时
- 30 天内合并 PR
- 23
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
DataDog/rshell 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 75/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/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 天内回复
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
ovh/ovhcloud-cli#309 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
-
area/docs
难度 1/5 1 小时以内 新手友好度 92/100
layer5io/getnighthawk#380 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复