[correctness][confirmed-defect][sort] GNU NUL field-separator notation is rejected
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 84/100
Research direction
Start with builtins/sort/sort.go:215-219, where separator arguments longer than one byte are rejected, and compare the handling with the GNU sort -t '\0' behavior described in the issue. Add the regression case at tests/scenarios/cmd/sort/flags/nul_field_separator.yaml and run the focused sort scenarios. Done means the command accepts the separator and produces b\na\n with exit code 0 and no stderr.
Written by the indexing model from the issue text.
Description
Generated by the rshell behavior correctness scanner.
- Contract:
BEH-005 - Classification:
confirmed-defect - Impact:
medium - Target:
sort - Scanned commit:
514d1cb8188fda6b1accca5955dfab3b0e8aa34a
The supported -t option rejects GNU's documented two-character notation for an ASCII NUL separator. With a missing second field and stable sorting, GNU preserves the input order; rshell instead rejects the valid separator before reading input. No applicable divergence is documented.
Contract sources
docs/BEHAVIOR_CONTRACTS.md:13-19,51-55: Supported option values follow reference behavior absent a documented divergence.SHELL_FEATURES.md:33: The supported surface includes -t SEP, stable sorting, and key definitions./usr/share/info/coreutils.info.gz: sort invocation, --field-separator: The GNU manual explicitly says to specify ASCII NUL using the two-character string '\0', for example sort -t '\0'.
Implementation references
builtins/sort/sort.go:215-219: All separator arguments longer than one byte are rejected, including GNU's special backslash-zero notation.
Fixture setup
Create a fresh temporary directory for each execution containing data.txt with exact bytes "b\na\n". Execute from that directory. The script's quoted separator contains one literal backslash followed by zero.
Reproducer
sort -s -t '\0' -k2,2 data.txt
Commands used:
GOENV_VERSION=1.26.3 timeout 300s go build -o /tmp/zz_correctness_scan_rshell ./cmd/rshellIn a fresh fixture directory, save the exact script as zz_correctness_scan_script.sh, then run: /tmp/zz_correctness_scan_rshell --allowed-commands rshell:sort --allowed-paths "$PWD" zz_correctness_scan_script.shIn an equivalent fresh fixture directory: LC_ALL=C bash --noprofile --norc zz_correctness_scan_script.shGOENV_VERSION=1.26.3 timeout 300s go test ./tests -run '^TestShellScenarios$/cmd/sort' -count=2 -v
Expected
Exit code: 0
stdout:
b
a
stderr:
Actual
Exit code: 2
stdout:
stderr:
sort: multi-character tab "\\0"
Verification
- Reproduction runs: 4
- Reference: Local GNU sort 9.4 reference verified twice from fresh fixtures. rshell CLI reproduced twice; the YAML scenario failed identically in both focused scenario runs. Docker comparison was attempted but skipped after HTTP 502.
- Temporary test: tests/scenarios/cmd/sort/zz_correctness_scan_cases/zz_correctness_scan_nul_separator.yaml (removed)
- Suggested regression-test location:
tests/scenarios/cmd/sort/flags/nul_field_separator.yaml
Fingerprint: 2bcca49cfc44c5ea39c1f1dcf2a53cc5baa5d2a2278af231bb767ae3e324491c
- Dominant language
- Go
- Stars
- 31
- Forks
- 3
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 14
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DataDog/rshell
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
[correctness][confirmed-defect][builtins/wc] wc pads regular-file stdin as though it were a pipeOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
prime-radiant-inc/evener#4329 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
openwatersio/aiscast#277 ·
Maintainers usually reply within 1 day