JianyuWang0623 opened a new pull request, #3520:
URL: https://github.com/apache/nuttx-apps/pull/3520

   *Note: Please adhere to [Contributing 
Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
   
   ***Pick from open-vela: 
https://github.com/open-vela/nuttx-apps/commits/dev/system/init***
   ## Summary
   
   A bundle of fixes and small improvements for `system/nxinit`, accumulated
   while bringing it up on real hardware (esp32s3) and porting it to upstream
   NuttX. Each commit is self-contained; together they address parser
   robustness, signal-handling races, action/import edge cases, and a few
   build warnings.
   
   Commits (oldest first):
   
   - `Handle trailing file '\0'`
   - `fix compilation errors in action.c`
   - `fix uninitialized 'wstatus' warning`
   - `Fix timespec incomplete error in action.h`
   - `prevent parser from reading past string boundary`
   - `Avoid SIGCHLD race with ppoll()`
   - `fix unused variable warning`
   - `Fix missing check for import argument`
   - `Fix signal mask inheritance`
   - `fix init parser to handle multiple quoted arguments`
   
   Cumulative diff: 7 files, +122/-25.
   
   ```
    system/nxinit/action.c  |  2 +-
    system/nxinit/action.h  |  2 ++
    system/nxinit/builtin.c | 75 ++++++++++++++++-----------
    system/nxinit/import.c  |  8 +++++-
    system/nxinit/init.c    | 19 +++++++++++--
    system/nxinit/parser.c  | 12 +++++++-
    system/nxinit/service.c | 29 ++++++++++++++++++-
   ```
   
   ## Impact
   
   - User: services declared in `init.rc` are more robustly parsed (quoted
     args, trailing `\0`, string-boundary safety) and the SIGCHLD race in the
     init main loop is fixed; child signal masks are no longer inherited
     unintentionally.
   - Build: removes `-Wuninitialized` / unused-variable warnings and a
     `timespec` incomplete-type error on some toolchains.
   - API/compat: no public API change. Behavior change is limited to
     edge cases that previously misbehaved or were unsafe.
   - Documentation / security: none.
   
   ## Testing
   
   Host: Ubuntu 22.04, `xtensa-esp32s3-elf-gcc`, `esptool.py 4.8.1`.
   Target: `lckfb-szpi-esp32s3:adb` with `CONFIG_SYSTEM_NXINIT=y` (companion
   PR in apache/nuttx switches the defconfig to `init_main`).
   
   Build & flash:
   
   ```
   $ ./tools/configure.sh lckfb-szpi-esp32s3:adb
   $ make -j$(nproc)
   $ make flash ESPTOOL_PORT=/dev/ttyUSB0 ESPTOOL_BINDIR=./
   ```
   
   Runtime check after boot — `init.rc` defines `console (sh)` and `adbd`
   services, both spawned and reaped by `init_main`:
   
   ```
   $ adb -s 1234 shell 'uname -a; ps'
   NuttX 12.13.0 ... lckfb-szpi-esp32s3
     TID   PID  PPID PRI POLICY  TYPE     ...  COMMAND
       3     3     0 100 RR      Task     ...  init_main
       4     4     3 100 RR      Task     ...  sh
       5     5     3 100 RR      Task     ...  adbd
   ```
   
   `init_main` (PID 3) is the parent of both `sh` (PID 4) and `adbd`
   (PID 5); `adb shell` is fully interactive. Killing `sh` (e.g. `exit`
   on the console) is recovered within the configured `restart_period`
   (1 s), exercising the service auto-restart path covered by the
   SIGCHLD/ppoll race fix.
   
   No regressions observed on default `nxinit` test runs (action triggers,
   import, quoted-arg parsing) on the device.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to