Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta Adatta ai principianti
#634 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go, shell
Ambito
backend, cli

Direzione di ricerca

Inizia da builtins/sort/sort.go:215-219, dove gli argomenti separatore più lunghi di un byte vengono rifiutati, e confronta la gestione con il comportamento di GNU sort -t '\0' descritto nell’issue. Aggiungi il caso di regressione in tests/scenarios/cmd/sort/flags/nul_field_separator.yaml ed esegui gli scenari sort mirati. Il risultato atteso è che il comando accetti il separatore e produca b\na\n con codice di uscita 0 e senza stderr.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
Go
Stelle
31
Fork
3
Merge medio
2g 11h
PR unite (30g)
13

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DataDog/rshell

Tutte le issue di DataDog/rshell

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.