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

Abierto
#16,692 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@costajohnt ya está trabajando en esto.

Desde el 18/11/2026.

  • #16700 de @costajohnt — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
30/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
rust
Área
cli

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Rust
Estrellas
24.4k
Forks
2.2k
Merge medio
2 d 23 h
PR fusionados (30 d)
402

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de uutils/coreutils

Todos los issues de uutils/coreutils

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.