rpc-sys: packagelist: don't truncate input lines on read openwrt-24.10
authorEric Fahlgren <ericfahlgren@gmail.com>
Sat, 23 Aug 2025 21:36:44 +0000 (14:36 -0700)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 31 Aug 2025 23:39:30 +0000 (01:39 +0200)
commitbba95191ff2f22c9118a1ba1355b83afaa277ae3
tree2181910ed4a7e3abe1e626e8f41e0f5e1d1a679b
parente61d2be87ba1b72a4bcb66b29449e80458c58875
rpc-sys: packagelist: don't truncate input lines on read

When the /usr/lib/opkg/status file is read during 'ubus call rpc-sys
packagelist', long input lines are being truncated, which produces
incorrect package lists.  The line read buffer is increased to 512,
which should be able to handle the longest lines in the file.

The 512 value was arrived at by examining the status file on
several devices.  The list of hostapd/wpad conflicts appears to
have be longest line generated in opkg packages, but that second
line of 259 characters containing the dependencies appears to be
the actual root cause of the issues linked below.

Here are the three longest lines I found on all of my installations
(actual output truncated):

$ awk '{print length(), $0}' /usr/lib/opkg/status  | sort -n
 ...
 188 Depends: kernel (= 6.6.93~35ef4dd36891d37023436baa842fa311-r1), ... kmod-lib-crc32c
 259 Depends: hostapd-common (= 2024.09.15~5ace39b0-r2), libc, ... libmbedtls21
 397 Conflicts: hostapd, hostapd-basic, hostapd-basic-openssl, ... wpad-basic-wolfssl

Suggested-by: @hlhintz
Fixes: https://github.com/efahl/owut/issues/28
Fixes: https://github.com/openwrt/rpcd/issues/16
Signed-off-by: Eric Fahlgren <ericfahlgren@gmail.com>
Link: https://github.com/openwrt/rpcd/pull/18
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
sys.c