nuttx-apps/system
aviralgarg05 455af497ca system/nxpkg: address lifecycle review findings.
Fix real correctness/security gaps found during review, on top of the
network sync and CLI completion work:

- pkg_install(): commit the installed database before writing the
  current/previous pointer files, and before advancing transaction
  state past ACTIVATED. Those are recovery bookkeeping and convenience
  mirrors respectively - once the installed database itself is
  durably committed, a failure to refresh either one must not trigger
  the failure-cleanup path, which could otherwise delete a payload the
  database now legitimately points at. Also stop treating an existing
  version directory as newly created when reinstalling an
  already-installed version, so a failed reinstall can't delete a
  working install.

- pkg_uninstall()/pkg_rollback(): acquire the per-package install lock
  in addition to the installed-db lock, drop the entry from the
  authoritative database first, and only then remove payload files -
  a crash between those two steps can leave orphaned files, which are
  reclaimable, but never leaves the database pointing at a payload
  that's already gone.

- pkg_sync(): stage each sync to a PID-qualified temp filename instead
  of a single fixed name, so concurrent sync calls can no longer race
  on the same staging file. Return real negative errno codes instead
  of EXIT_SUCCESS/EXIT_FAILURE, matching the rest of this API; pkg_main.c
  maps that back to a process exit code at the CLI boundary.

- pkg_metadata_parse_installed_entry(): validate that name/current/
  previous/every entry in versions[] are safe path components, and that
  current (and previous, if set) actually appear in versions[] - a
  corrupted or tampered installed-packages database can no longer
  reference a nonexistent version or smuggle a path-traversal sequence
  through a field this code already trusted implicitly.

- pkg_store_write_all()/pkg_repo_sink(): treat a zero-byte write() as
  -EIO instead of looping on it silently.

- Removed the malloc()-falls-back-to-kmm_malloc() logic in pkg_malloc/
  pkg_zalloc/pkg_realloc/pkg_free entirely - it required tracking which
  allocator owned a given pointer via kmm_heapmember(), which is
  specific to this target's flat, single-heap memory model and not a
  sound general application API. These are now plain wrappers around
  malloc/calloc/realloc/free.

- Added pkg_metadata_load_manifest_path(), so a caller (e.g. the
  nxstore GUI frontend, launching an installed package) can load the
  manifest actually recorded for a specific installed version, instead
  of combining a rollback-selected version with whatever the current
  catalog happens to describe for that package name - those can
  disagree after a rollback if the catalog has since moved on.

- Storage root default changed from /tmp/nxpkg to /var/lib/nxpkg,
  following the conventional persistent application-data location
  instead of a path whose own name suggests non-persistent storage. A
  board without persistent storage mounted at /var, or that wants a
  different location (e.g. an SD card), still overrides this via
  CONFIG_SYSTEM_NXPKG_ROOT as before.

- Moved system/nxpkg/README.txt into the companion NuttX documentation
  PR rather than shipping user-facing documentation as an in-tree
  README.

Assisted-by: Claude:claude-sonnet-5
Signed-off-by: aviralgarg05 <gargaviral99@gmail.com>
2026-07-24 15:25:58 +05:30
..
adb !apps: Simplify NuttX initialization 2026-05-06 13:27:05 +08:00
adcscope !apps: Simplify NuttX initialization 2026-05-06 13:27:05 +08:00
argtable3 cmake: remove empty strings from FetchContent 2025-03-30 14:20:21 +08:00
batterydump system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
cdcacm include/debug.h: Use <nuttx/debug.h> in apps 2026-04-11 10:39:27 -03:00
cfgdata mtd/nvs: modify config name to MTD_CONFIG_NVS part1 2026-02-02 11:01:19 +08:00
cle include/debug.h: Use <nuttx/debug.h> in apps 2026-04-11 10:39:27 -03:00
composite include/debug.h: Use <nuttx/debug.h> in apps 2026-04-11 10:39:27 -03:00
conntrack system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
coredump !apps: drop redundant casts on tv_sec/tv_nsec and fix printf formats 2026-05-22 13:38:25 +08:00
cpuload system/cpuload: Fix application's Make.defs location 2025-02-20 08:34:52 +01:00
critmon system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
cu include/debug.h: Use <nuttx/debug.h> in apps 2026-04-11 10:39:27 -03:00
curl system/curl: add a small curl-like HTTP client command 2026-07-20 10:21:57 +02:00
dd apps: Fix O_ACCMODE bitmask checks after Linux flag alignment 2026-06-30 12:19:58 -04:00
debugpoint system/debugpoint: fix bug the length option parsing error 2025-02-25 13:07:58 -03:00
dhcp6c include/debug.h: Use <nuttx/debug.h> in apps 2026-04-11 10:39:27 -03:00
dhcpc system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
dumpstack system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
fastboot system: fastboot: bound filedump path parsing 2026-07-16 15:59:21 +08:00
fdt apps: add missing module metadata for executable tools 2026-06-22 22:27:07 +08:00
flash_eraseall system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
flatbuffers system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
gcov gcov: Output mode judgment is implemented in the kernel layer 2025-06-26 23:48:01 +08:00
gdbstub system/gdbstub: Add depends of LIB_GDBSTUB 2025-07-18 22:42:03 +08:00
gprof system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
hex2bin system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
hexed system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
hostname system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
i2c include/debug.h: Use <nuttx/debug.h> in apps 2026-04-11 10:39:27 -03:00
iptables iptables: add file lock to prevent concurrent overwrite 2026-01-15 17:20:03 +08:00
irtest system/irtest: Set irtest command line size to CONFIG_LINE_MAX 2026-04-24 14:58:05 +02:00
libffi system/libffi: Add libffi package integration 2026-05-22 21:51:31 +08:00
libuv apps: add missing module metadata for executable tools 2026-06-22 22:27:07 +08:00
lm75 system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
lsan testing: add missing header files 2026-01-26 19:32:27 +08:00
lzf system/lzf: Fix missing space in Kconfig help text. 2026-05-28 21:27:01 +02:00
mdio system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
microros system/microros: Add UDP and serial custom transport backends. 2026-06-02 00:15:25 +08:00
netdb system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nsh system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
ntpc system/ntpc: update ntpc messages 2025-09-05 23:47:36 +02:00
nxcamera apps: Fix codespell warnings. 2026-05-22 13:39:04 +08:00
nxcodec system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
nxdiag system/nxdiag: add CMake support for NXDiag tool 2026-05-21 12:34:05 +08:00
nxinit system: nxinit: bound debug argv dump 2026-07-07 09:47:23 +08:00
nxlooper include/debug.h: Use <nuttx/debug.h> in apps 2026-04-11 10:39:27 -03:00
nxmbclient modbus: add nxmodbus 2026-04-20 12:45:17 -03:00
nxpkg system/nxpkg: address lifecycle review findings. 2026-07-24 15:25:58 +05:30
nxplayer system: audio: parse command filenames with PATH_MAX 2026-07-11 12:40:07 -03:00
nxrecorder system: audio: parse command filenames with PATH_MAX 2026-07-11 12:40:07 -03:00
ofloader !apps: Simplify NuttX initialization 2026-05-06 13:27:05 +08:00
ping system/ping: Fix a segmentation fault when using ping 2026-07-09 09:42:30 +08:00
ping6 system/ping: Fix a segmentation fault when using ping 2026-07-09 09:42:30 +08:00
popen apps: Fix O_ACCMODE bitmask checks after Linux flag alignment 2026-06-30 12:19:58 -04:00
psmq system/psmq: add proper include path for embedlog 2025-02-20 08:39:13 +01:00
ptpd !apps: drop redundant casts on tv_sec/tv_nsec and fix printf formats 2026-05-22 13:38:25 +08:00
readline include/debug.h: Use <nuttx/debug.h> in apps 2026-04-11 10:39:27 -03:00
resmonitor system: resmonitor: check CPU load reads 2026-07-06 16:31:38 +08:00
sched_note system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
sensorscope system/sensorscope: support for fixe16 data 2026-05-06 08:54:32 +02:00
sensortest signals: fix build and runtime issues when signals all isabled 2026-01-19 22:55:19 +08:00
setlogmask system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
settings system/settings: Bound storage string handling 2026-05-28 14:35:54 +02:00
smf system/smf: Port SMF .c/.h files to NuttX 2026-01-05 12:50:04 -05:00
spi include/debug.h: Use <nuttx/debug.h> in apps 2026-04-11 10:39:27 -03:00
stackmonitor system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
syslogd system/syslogd: Initial implementation 2025-06-17 20:43:58 +08:00
system include/debug.h: Use <nuttx/debug.h> in apps 2026-04-11 10:39:27 -03:00
taskset apps/system: replace CONFIG_NSH_LINELEN to LINE_MAX 2025-01-14 19:31:54 +08:00
tcpdump pkt: Set sll_protocol for raw socket to ETH_P_ALL 2026-01-04 21:41:21 +08:00
tee include/debug.h: Use <nuttx/debug.h> in apps 2026-04-11 10:39:27 -03:00
telnet apps: Fix unchecked strdup()/asprintf() as requested in #1727 2026-05-23 16:30:52 -04:00
telnetd system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
termcurses include/debug.h: Use <nuttx/debug.h> in apps 2026-04-11 10:39:27 -03:00
trace apps/system/trace: support binary dump of noteram 2026-01-26 19:32:42 +08:00
ubloxmodem include/debug.h: Use <nuttx/debug.h> in apps 2026-04-11 10:39:27 -03:00
uniqueid system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
uorb system/uorb: introduce CONFIG_UORB_FORMAT for format string control 2026-06-09 17:02:03 +08:00
usbmsc apps: Fix O_ACCMODE bitmask checks after Linux flag alignment 2026-06-30 12:19:58 -04:00
vi include/debug.h: Use <nuttx/debug.h> in apps 2026-04-11 10:39:27 -03:00
vncviewer system/vncviewer: Drain truncated desktop names 2026-07-09 09:28:13 +08:00
ymodem apps/system/ymodem: Optimized ymodem for burn during bootloader 2026-02-02 11:00:19 +08:00
zlib apps: Fix minor issues for latest toolchains 2026-01-23 10:00:52 +08:00
zmodem !apps: replace sclock_t with clock_t and drop redundant time_t/off_t casts 2026-05-11 17:38:32 +08:00
.gitignore Remove extra whitespace from files (#43) 2020-01-31 08:29:24 -06:00
CMakeLists.txt system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
Make.defs system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00
Makefile system: migrate to SPDX identifier 2024-12-30 18:02:50 +08:00