system/cle: overlong line executed as a truncated command at EOL
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
- 72/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- c
- Área
- cli, embedded-iot
Línea de trabajo
Lee system/cle/cle.c: empieza en struct cle_s y en el bucle cle() que inserta caracteres imprimibles y tabulaciones, luego encuentra dónde se gestiona \n y se devuelve la línea a NSH. Añade un indicador bool overflow que se activa cuando la inserción ya no cabe (emite BEL y sigue consumiendo). Al recibir un salto de línea mientras hay desbordamiento, vacía el búfer, haz eco de \r\n y devuelve OK. Para verificarlo, compila sim:nsh con CONFIG_NSH_CLE=y y CONFIG_LINE_MAX=80 y envía una línea demasiado larga poweroff seguida de uname -a; está terminado cuando la línea demasiado larga se descarta, el comando siguiente se ejecuta y una línea que cabe exactamente sigue ejecutándose.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Repository: apache/nuttx-apps · Component: system/cle/cle.c (selected by CONFIG_NSH_CLE=y)
Environment: NuttX Apps 13.1.0, also master 7196658dffde; host sim:nsh (not QEMU, not a board); Linux x86_64, gcc 11.4; CONFIG_NSH_CLE=y, CONFIG_SYSTEM_CLE=y, CONFIG_LINE_MAX=80 (79 usable bytes).
Repro
- Build
sim:nshwith the configuration above. - Write
powerofffollowed by 200Aand\nto stdin. - After 0.5 s write
uname -a\n, then observe whether the process is still alive and whether the follow-up command runs. The test driver kills the process after a 2 s timeout if it did not exit on its own.
Actual (stock 13.1.0) — insertion stops at 79 bytes and further bytes ring the bell, but the newline still submits the truncated buffer:
nsh> poweroff AAAA... <- 79 bytes accepted, further bytes rejected with BEL
(process exits with status 0 within 0.5 s; the follow-up command never runs)
The tail of the line is not discarded: it is consumed as new input and runs as further commands (e.g. a run of C characters ends up executed as a command named C).
Expected — the whole line is discarded through EOL and the next command runs:
nsh> poweroff AAAA...<BEL> <- discarded; poweroff is not executed
(empty line returned to NSH)
nsh> uname -a
NuttX ... sim sim <- follow-up command runs normally
(process stays alive; the harness kills it after the 2 s timeout)
Fix suggestion: add bool overflow to struct cle_s. When a printable or tab character no longer fits, set overflow, emit BEL, and keep consuming bytes without inserting them. On \n while overflowing, clear the buffer, echo \r\n, and return OK so NSH receives an empty line. A line that exactly fits must still execute, and a failed newline insertion alone must not set overflow. The patch changes only system/cle/cle.c.
Patch: 0002-cle-discard-overlong-line.patch, posted in the first comment. It applies to master 7196658dffde (git apply --check returns 0). CLE only covers the interactive editor; NSH script mode still calls readline_fd(), so a product using CLE needs both patches.
Reported from an audit of NSH input handling. Patch is in the first comment; happy to rework it if maintainers prefer a different approach.
- Lenguaje dominante
- C
- Estrellas
- 474
- Forks
- 807
- Merge medio
- 1 d 11 h
- PR fusionados (30 d)
- 181
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin 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 apache/nuttx-apps
-
[FEATURE] Shrink getprime runs for OSTestPosiblemente ocupada @linguini1 la tomó hace 41 días. AbiertoType: Enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
apache/nuttx-apps#3620 · 6 comentarios · 1 reacción · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 50/100
apache/nuttx-apps#4107 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
[TODO] move graphics/input -> input.Quizá libre de nuevo @cederom la tomó hace 241 días y no hay ningún pull request abierto. Abierto
apache/nuttx-apps#3436 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Type: Enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
apache/nuttx-apps#3258 · 1 comentario · 2 reacciones ·
Los mantenedores suelen responder en 1 día
-
Community: Question
Dificultad 4/5 3-5 días Aptitud para principiantes 20/100
apache/nuttx-apps#3134 ·
Los mantenedores suelen responder en 1 día
Todos los issues de apache/nuttx-apps
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
trezor/trezor-firmware#8357 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
good first issue kernel
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
JackFurton/who-would-build-a-kernel-in-java#316 ·
Los mantenedores suelen responder en 1 día
-
Bandwidth selector rotary direction is inconsistent with the regular menu on portable modelsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
PE5PVB/TEF6686_ESP32#970 ·
-
bug sev-3
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100