sort -Rfu can return multiple records for the same case-insensitive key

Aperta
#16,692 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@costajohnt ci sta già lavorando.

Dal 18/11/2026.

  • #16700 di @costajohnt — aperta

Valutazione

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

Direzione di ricerca

Read the random comparator in src/uu/sort/src/sort.rs around lines 2885–2899 and the existing test_random_ignore_case test. Reproduce the reported command with LC_ALL=C and --random-source=/dev/zero, then add coverage using two case-insensitive keys. Done means -Rfu emits one row for each distinct first-field key; check the open pull request #16700 before starting.

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

Descrizione

U - sort

Shuffling a ticket list and asking for one row per owner can give the same owner two entries.

printf 'Alice ticket-1\nalice ticket-2\nXena ticket-3\n' |
  LC_ALL=C sort -Rfu -k1,1 --random-source=/dev/zero

On uutils 0.12.0 and main at 293a724 (Linux x86_64), this exits 0 and prints:

Alice ticket-1
Xena ticket-3
alice ticket-2

There are two distinct first-field keys under -f, so any shuffle should emit exactly two rows. GNU 9.12 emits tickets 1 and 3. Removing -R and --random-source makes uutils do the same. The fixed random source just makes the failing order repeatable.

The random comparator treats Alice and alice as equal when compared directly, but hashes their original spellings when comparing either to Xena. They can land on opposite sides of Xena, so adjacent deduplication misses them. The existing test_random_ignore_case covers eight spellings of one word. A second distinct key exercises the missing comparison.

Lingua principale
Rust
Stelle
24.4k
Fork
2.2k
Merge medio
2g 23h
PR unite (30g)
402

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.