sort --debug: key underlines are misaligned with control and multibyte characters

Aperta
#16,076 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@DuncanBentley ci sta già lavorando.

Dal 31/10/2026.

  • #16079 di @DuncanBentley — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
rust
Ambito
cli

Direzione di ricerca

Start with the sort --debug implementation and the sort-debug-keys test in test_sort.rs; compare the annotation widths for control characters and multibyte characters under C and UTF-8 locales. The issue points to EXPECTED_DEBUG_KEY_ANNOTATION_LOCALE and LOCALE_FR_UTF8 as relevant test references. Done means debug underlines and indents match display-column behavior; an open linked pull request (#16079) already addresses this issue.

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

Descrizione

U - sort

sort --debug measures the key underline and its indent in bytes (ignoring only NUL). GNU measures them in display columns: control characters take no column, the tab (printed as >) takes one, and in a UTF-8 locale each character takes its display width.

$ printf 'a\x01b\n' | LC_ALL=C sort --debug 2>/dev/null
a^Ab
__        # GNU
___       # uutils

$ printf 'é日 b\n' | LC_ALL=en_US.UTF-8 sort --debug -k2 -k1,1 2>/dev/null
é日 b
   __     # GNU: indent 3 (é=1, 日=2)
___
_____
# uutils counts bytes: the key-2 underline is indented 5,
# and the next two underlines are 5 and 7 wide

The UTF-8 case is what GNU's sort-debug-keys test expects for 1² in fr_FR.UTF-8 (EXPECTED_DEBUG_KEY_ANNOTATION_LOCALE in test_sort.rs has a 23-wide underline where the C locale has 24). That test only runs when LOCALE_FR_UTF8 is set.

Checked on uutils main 824cdb271 against GNU coreutils 8.32.

Lingua principale
Rust
Stelle
24.3k
Fork
2.1k
Merge medio
1g 22h
PR unite (30g)
396

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

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 uutils/coreutils

Tutte le issue di uutils/coreutils

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.