JianyuWang0623 opened a new pull request, #3737: URL: https://github.com/apache/nuttx-apps/pull/3737
*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).* ## Summary This series improves the `system/nxinit` init.rc parser. It contains four self-contained commits: 1. **parse default cpu-specific configs** — On top of the configured rc file (`CONFIG_SYSTEM_NXINIT_RC_FILE_PATH`, e.g. `/etc/init.d/init.rc`), `init_parse_configs()` now also loads an optional per-cpu config derived from that path (`<rc-path>.cpu${CPUID}`, e.g. `/etc/init.d/init.cpu0.rc`). The configurable rc path support is preserved and the unused directory scanning path is dropped. 2. **extract init_parse_config_buffer()** — Factor the per-line parsing out of `init_parse_config_file()` into a shared `init_parse_config_lines()` helper, and expose an `init_parse_config_buffer()` interface so an in-memory config buffer can be parsed with the same logic. Blank-line skipping is preserved in the extracted helper. 3. **add check loop to init_parse_config_buffer** — Add the `parser[n].check` validation loop to `init_parse_config_buffer()`, matching the pattern already used in `init_parse_config_file()`, so services and actions parsed from in-memory buffers are validated after parsing. 4. **fix argument parser treating --option as -- separator** — `init_parse_arguments()` only compared the first two characters when detecting the `--` separator, so options like `--system` / `--nofork` were mistaken for the standalone `--` separator and the remaining arguments were truncated. Add an `isblank()` check on the third character so only a standalone `--` followed by whitespace triggers the separator logic. Commits 2→3 are ordered (the helper is extracted first, then the check loop is added to it); the other two are independent parser improvements. ## Impact - **Users**: `nxinit` gains optional per-cpu init.rc support and correctly passes through long options (e.g. `--system`) to services/actions. Existing single-file init.rc setups are unaffected (the per-cpu file is optional). - **Build**: No new Kconfig options; no build-flag changes. Only `system/nxinit/{parser.c,parser.h,init.c}` are touched. - **Hardware / compatibility**: No ABI or on-flash format change. Behavior for configs that do not use per-cpu files or `--`-style options is unchanged. - **Documentation / security**: None. ## Testing Host: - OS: Linux (x86_64) - Compiler: xtensa-esp32s3-elf-gcc (ESP toolchain) Target: - arch: xtensa - board:config: `lckfb-szpi-esp32s3:adb` Verification: - `./tools/checkpatch.sh -f` passes cleanly on all touched files (`parser.c`, `parser.h`, `init.c`) — `All checks pass.` - The full nxinit series (of which this is the first batch) builds and boots on the target above; init.rc is parsed and services start as expected. -- 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]
