]> git.99rst.org Git - openwrt-packages.git/commit
alfred: handle unreadable files in bat-hosts.lua
authorJosef Schlehofer <redacted>
Thu, 6 Aug 2026 10:42:19 +0000 (12:42 +0200)
committerJosef Schlehofer <redacted>
Tue, 18 Aug 2026 06:39:34 +0000 (08:39 +0200)
commit2312f86f7e7b0eb7029596a04cc878ebe648b921
tree634237d54290c7c0d9f9b0ad88ba6169f9907a4b
parentd47aa37e76355b4d3b9afccdc156959855757612
alfred: handle unreadable files in bat-hosts.lua

get_interface_address() calls io.open() and dereferences the result
without checking it. /sys/class/net does not contain interfaces
only: with the bonding module loaded it also holds the plain file
bonding_masters, which the `ls -1` in get_interfaces_names() returns
and which has no address below it. io.open() then returns nil and
the script dies with "attempt to index a nil value", so no bat-hosts
data is published at all on such a node.

Return nil when the file cannot be opened and skip those entries in
the caller, which would otherwise index the interface table with
nil. get_hostname() gets the same guard.

Reported-by: openwrt-ai[bot]
Signed-off-by: Josef Schlehofer <redacted>
Co-authored-by: Claude Fable 5 <redacted>
net/alfred/files/bat-hosts.lua
git clone https://git.99rst.org/PROJECT