Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

sort aborts instead of exiting non-zero when a temp-file write fails during external-sort spill

Abierto Apto para principiantes
#14,377 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

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

Línea de trabajo

Comienza en src/uu/sort/src/ext_sort/threaded.rs alrededor de las líneas 300-305, donde se escriben los chunks volcados, y reproduce el fallo con un sistema de archivos -T pequeño y -S 0. Confirma que un fallo al escribir en un archivo temporal termina con un valor distinto de cero sin provocar un panic ni un aborto, mientras la salida sigue dirigiéndose a /dev/null.

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

Descripción

U - sort

When sort spills sorted chunks to temporary files during an external sort (any time the input exceeds the sort buffer), it writes each chunk with write_all(...).unwrap(). If that temp-file write fails — e.g. the -T temp directory is on a full or size-limited filesystem — the unwrap() panics.

This is distinct from #13653 ("sort aborts … when the output write fails during a merge"): that was the output write path (merge.rs) and was fixed by #13654, which touched only merge.rs. The temp-file spill write in ext_sort/threaded.rs was not covered and still aborts at current main.

Steps to reproduce

Point -T at a small filesystem and force a spill with a tiny buffer (-S 0).
Using a 1 MiB tmpfs as the temp dir; output goes to /dev/null, so it is the
temp-file write that fails, not the output:

$ # ~18 MB of shuffled lines
$ python3 -c "import random; open('big.txt','w').write(''.join(f'{random.randint(0,10**9):09d}-padding-payload\n' for _ in range(400000)))"

$ # temp dir on a 1 MiB tmpfs (e.g. mount -t tmpfs -o size=1m tmpfs /st)
$ sort -S 0 -T /st big.txt -o /dev/null
thread 'main' panicked at src/uu/sort/src/ext_sort/threaded.rs:302:34:
called `Result::unwrap()` on an `Err` value: Os { code: 28, kind: StorageFull, message: "No space left on device" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted (core dumped)
$ echo $?
134

Root cause

The chunk-spill writer unwraps every temp-file write:

https://github.com/uutils/coreutils/blob/5426f41b62ec27692ab043b3807306f3a6b5361b/src/uu/sort/src/ext_sort/threaded.rs#L300-L305

Lenguaje dominante
Rust
Estrellas
24.2k
Forks
2.1k
Merge medio
1 d 6 h
PR fusionados (30 d)
320

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.