sed - script parser skips CR, VT, FF (and 0x85, 0xA0) as blanks; GNU skips only space and tab
Los mantenedores suelen responder en 1 día
@Himanshu-singh04 ya está trabajando en esto.
Desde el 10/11/2026.
- #665 de @Himanshu-singh04 — abierto
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 89/100
Línea de trabajo
Lee src/sed/script_char_provider.rs, especialmente ScriptCharProvider::eat_spaces, donde el issue señala el tratamiento de los espacios en blanco. Empieza por revisar las pruebas existentes del parser de sed y añade cobertura para retornos de carro después de comandos y tabuladores verticales en texto de una línea, siguiendo los ejemplos del issue. El trabajo estará terminado cuando esas entradas se comporten como en GNU sed y las pruebas pasen.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Wherever the script parser skips blanks (between address and command, after a command, before
one-line a/i/c text, before a w/r file name, ...), GNU sed skips only space and tab.
uutils sed skips every Unicode whitespace character, including carriage return, vertical tab,
form feed and the raw bytes 0x85 and 0xA0. As a result:
- a script saved with CRLF line endings runs here, where GNU stops with
extra characters after command; - a leading
\v,\for\ris silently dropped from one-linea/i/ctext and from
file names.
Reproduction
Rust (incorrect)
$ printf 'a\n' | ./target/release/sed $'p\r'
a
a
# Exit code: 0
$ printf 'a\n' | ./target/release/sed $'1a\vfoo' | od -An -c
a \n f o o \n
# Exit code: 0
GNU (correct)
$ printf 'a\n' | /usr/bin/sed $'p\r'
/usr/bin/sed: -e expression #1, char 2: extra characters after command
# Exit code: 1
$ printf 'a\n' | /usr/bin/sed $'1a\vfoo' | od -An -c
a \n \v f o o \n
# Exit code: 0
Root cause
ScriptCharProvider::eat_spaces in src/sed/script_char_provider.rs:64-69:
/// Advances the position past any whitespace characters.
pub fn eat_spaces(&mut self) {
while self.pos < self.line.len() && self.current().is_whitespace() {
self.advance();
}
}
current() maps each byte to a char, so char::is_whitespace is also true for the bytes
0x85 and 0xA0 (U+0085, U+00A0).
Test
#[test]
fn test_carriage_return_after_command_rejected() {
new_ucmd!()
.arg("p\r")
.pipe_in("a\n")
.fails()
.code_is(1);
}
#[test]
fn test_vertical_tab_kept_in_one_line_text() {
new_ucmd!()
.arg("1a\x0bfoo")
.pipe_in("a\n")
.succeeds()
.stdout_is("a\n\x0bfoo\n");
}
Reported by Anthropic's OSS Scanner (ANT-2026-Q3PRSLF7).
- Lenguaje dominante
- Rust
- Estrellas
- 123
- Forks
- 53
- Merge medio
- 2 d 8 h
- PR fusionados (30 d)
- 40
Preparar el entorno
- 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/sed
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
sed - with `--posix`, `-e 'i\'` takes the next `-e` as its textPosiblemente ocupada @yunusarda-sudo la tomó hace 14 días. Abiertobug gnu-compat good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
sed - with `-s` or `-i`, the file read by `R` is not restarted for each input filePosiblemente ocupada @Himanshu-singh04 la tomó hace 22 días. Abiertobug gnu-compat good first issue oss-scanner
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
sed - output already produced is lost when a runtime error stops processingPosiblemente ocupada @Himanshu-singh04 la tomó hace 21 días. Abiertobug gnu-compat good first issue oss-scanner
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Los mantenedores suelen responder en 1 día
-
sed - unknown POSIX class names like `[[:foo:]]` or `[[:word:]]` are accepted instead of rejectedPosiblemente ocupada @draarivpatel-ui la tomó hace 7 días. Abiertobug gnu-compat good first issue oss-scanner
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
uutils/sed#646 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de uutils/sed
Issues similares
-
autofix:working
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
libracoder/kiri#1138 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
roc-lang/basic-webserver#277 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
samkerrcode/opengent#113 ·
Los mantenedores suelen responder en 1 día
-
app bug session
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día