Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[correctness][confirmed-defect][sort] GNU NUL field-separator notation is rejected

Closed Beginner friendly
#634 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go, shell
Domain
backend, cli

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/rshell
  • In 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.sh
  • In an equivalent fresh fixture directory: LC_ALL=C bash --noprofile --norc zz_correctness_scan_script.sh
  • GOENV_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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DataDog/rshell

All issues in DataDog/rshell

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.