unexpand: final newline prevents conversion of leading Unicode blanks
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 86/100
Línea de trabajo
Empieza en src/uu/unexpand/src/unexpand.rs, en la ruta rápida de unexpand_buf alrededor de las líneas 512–523, y sigue cómo gestiona la entrada terminada en salto de línea antes de tratar los espacios en blanco según Unicode. Reproduce el problema con el comando del issue y compara el modo predeterminado con -a; el trabajo estará terminado cuando el modo predeterminado convierta los caracteres U+3000 iniciales en una tabulación con un salto de línea final y pasen las pruebas pertinentes de unexpand.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
In a UTF-8 locale, unexpand leaves leading Unicode blanks unchanged when the line ends in a newline. Removing that newline makes the same blanks convert to a tab. GNU coreutils 9.12 converts them in both cases.
Reproduced on main c1f172886c6643f61ffde5a1ce3db0aaf14e182b on Linux, in both debug and release builds:
python3 -c 'print("\u3000" * 4 + "X")' |
LC_ALL=C.UTF-8 coreutils unexpand | od -An -tx1
The input is four U+3000 IDEOGRAPHIC SPACE characters (eight display columns), followed by X and a newline.
Expected, as printed by GNU unexpand 9.12:
09 58 0a
Actual:
e3 80 80 e3 80 80 e3 80 80 e3 80 80 58 0a
The same command with unexpand -a produces the expected tab. So does default unexpand if the final newline is omitted. --first-only has the same failure as default mode.
The first fast path in unexpand_buf (src/uu/unexpand/src/unexpand.rs:512-523) checks only for ASCII space and tab before copying a newline-terminated buffer unchanged. This bypasses the Unicode blank handling later in the function.
I compared 416 cases against GNU 9.12 across 13 Unicode blank characters, two UTF-8 locales, file/pipe input, with/without a final newline, and four option sets. Both uutils builds had the same 104 mismatches, all in default/--first-only mode with a final newline. All 44 existing unexpand integration tests pass.
- Lenguaje dominante
- Rust
- Estrellas
- 24.3k
- Forks
- 2.1k
- Merge medio
- 1 d 21 h
- PR fusionados (30 d)
- 357
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de uutils/coreutils
-
fmt: stops at an unreadable file operand and says only 'read error' for a directoryPosiblemente ocupada @emirmrkaljevic la tomó hace 1 día. AbiertoU - fmt
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
shuf: exhausted random source destroys the input during an in-place shufflePosiblemente ocupada @limadog9 la tomó hace 1 día. AbiertoU - shuf
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
paste: serial mode exhausts file descriptors by opening every input simultaneouslyPosiblemente ocupada @binhvq la tomó hace 1 día. AbiertoU - paste
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
chmod -v: missing 'could not be accessed' line for operands that can't be stat'edPosiblemente ocupada @emirmrkaljevic la tomó hace 1 día. AbiertoU - chmod
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
chown, chgrp: 'cannot dereference' instead of 'cannot access' for a missing operandPosiblemente ocupada @emirmrkaljevic la tomó hace 2 días. AbiertoU - chgrp U - chown
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
Todos los issues de uutils/coreutils
Issues similares
-
desktop documentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
vfarcic/dot-agent-deck#2008 ·
Los mantenedores suelen responder en 1 día
-
L: javascript
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
dependabot/dependabot-core#16744 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
nautechsystems/nautilus_trader#5486 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Bump rustls-webpki, webpki-roots and webpki-root-certs for the emSign distrust (CVE-2026-111943)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día