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

expand/unexpand: a bare `-` operand is taken as an obsolete `-N` tab option, so standard input is skipped

Abierto Apto para principiantes
#15,658 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@qiyuhuating ya está trabajando en esto.

Desde el 24/10/2026.

  • #15716 de @qiyuhuating — abierto

Evaluación

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

Línea de trabajo

Empieza leyendo expand_shortcuts() en src/uu/unexpand/src/unexpand.rs y src/uu/expand/src/expand.rs, donde el issue identifica el - sin argumentos como una coincidencia con la opción obsoleta de tabulación. Revisa las pruebas existentes de expand y unexpand y luego reproduce el comportamiento con printf 'stdin\n' | unexpand - f y el comando correspondiente de expand. Se considera terminado cuando un - sin argumentos lee de la entrada estándar junto con el archivo indicado y unexpand no activa --first-only por error.

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

Descripción

U - expand U - unexpand
Describe the bug

expand and unexpand treat a bare - as an empty obsolete -N[,M] tab-stop option instead of the standard-input operand. As a result:

  • expand - FILE and unexpand - FILE never read standard input; they print only FILE and exit 0.
  • In unexpand, the obsolete option also turns on --first-only, so unexpand -t N - converts only leading blanks, and unexpand --first-only - fails with "the argument '--first-only' cannot be used multiple times".

With - as the only operand the output usually looks right, because stdin is read by default anyway.

The GNU manual (expand invocation, and the same sentence in unexpand invocation) says:

expand writes the contents of each given FILE, or standard input if none are given or for a FILE of -, to standard output.

and for unexpand -t: "This option implies the -a option." GNU coreutils 9.12:

printf 'stdin\n' | unexpand - <(printf 'file\n')
# GNU 9.12: stdin / file
# uutils:   file

printf 'stdin\n' | expand - <(printf 'file\n')
# GNU 9.12: stdin / file
# uutils:   file

printf 'a  b\n' | unexpand -t 3 - | od -An -c
# GNU 9.12:  a  \t   b  \n
# uutils:    a           b  \n

Versions. uutils main 342b6f7bd10adee39809516f56d86425422cc9ec (2026-10-22) and the 0.12.0 release binary, macOS 26 aarch64, LC_ALL=C, compared with GNU coreutils 9.12.

Where. expand_shortcuts() in src/uu/unexpand/src/unexpand.rs and in src/uu/expand/src/expand.rs accepts any argument that starts with - and has only digits or commas after it. For a bare - the rest is empty, so it matches; unexpand then also adds --first-only.

Related: the unexpand --first-only - row in #15254 is this bug. Open PR #14291 changes expand_shortcuts() for hyphen-leading tab lists after -t, but a bare - elsewhere still matches there. #11091 (no output for interactive stdin) is a different problem.

Found with an automated differential tester that compares uutils with GNU 9.12. I reproduced it by hand on main and on 0.12.0.

Reproduction steps
export LC_ALL=C
cd "$(mktemp -d)"

printf 'file\n' > f
printf 'stdin\n' | unexpand - f
# GNU 9.12: stdin, then file
# uutils:   file
Lenguaje dominante
Rust
Estrellas
24.3k
Forks
2.1k
Merge medio
1 d 20 h
PR fusionados (30 d)
347

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.