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

   ## Summary
   
   Two independent, low-risk fixes carried over from the internal (vela) fork 
of this component:
   
   1. Increase `SYSTEM_NXINIT_SERVICE_ARGS_MAX` default from 8 to 16. The 
previous default is insufficient for services with many arguments (e.g. ptpd 
needs 10 argv slots). When exceeded, argv lacks a NULL terminator, causing 
`posix_spawnp` to read out of bounds.
   2. Add a `set KEY VALUE` builtin command. Previously `set` in init.rc fell 
through to `posix_spawnp()`, which ran it in a temporary child shell — the 
environment variable was set only in that child and lost when it exited, so 
later services never inherited it. `cmd_set` now calls `setenv()` directly in 
the init process, guarded by `CONFIG_DISABLE_ENVIRON`, so child processes 
(which inherit init's environment) see it correctly.
   
   ## Impact
   
   - system/nxinit/Kconfig: change default range value, no new config surface.
   - system/nxinit/builtin.c: add one builtin command entry, no changes to 
existing command behavior.
   
   ## Testing
   
   Built for `esp32p4-function-ev-board:nsh` (CONFIG_SYSTEM_NXINIT=y) with the 
actual toolchain (`riscv-none-elf-gcc`):
   
   ```
   $ make -j$(nproc)
   ...
   LD:  nuttx
   MKIMAGE: NuttX binary
   Generated: nuttx.bin
   ```
   
   Verified via `nm nuttx` that `cmd_set` is linked into the image, and 
confirmed `CONFIG_SYSTEM_NXINIT_SERVICE_ARGS_MAX=16` takes effect in the 
generated `.config`.
   
   Ran `nxstyle` on the changed file (`builtin.c`) with no violations.


-- 
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