From 3135a2502bd03f1838ad42ed7b9828a68ab6a28b Mon Sep 17 00:00:00 2001 From: Christian Werner Date: Sat, 20 Jun 2026 05:13:48 +0200 Subject: [PATCH] fix(kernel): Handle unreadable module files in selftest.sh Improve error handling in module discovery by identifying unreadable `.ko` files and providing detailed error messages. Suggest actions like unzip or rebuild to resolve issues. --- kernel/selftest.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/kernel/selftest.sh b/kernel/selftest.sh index 9327686..1b39b7a 100755 --- a/kernel/selftest.sh +++ b/kernel/selftest.sh @@ -107,8 +107,14 @@ if [ -z "$KO" ]; then [ -d "$dir" ] || continue for cand in "$dir"/${MODULE}*.ko; do [ -f "$cand" ] || continue - vm="$(modinfo -F vermagic "$cand" 2>/dev/null)" - msg="$msg"$'\n'" $cand (built for ${vm%% *})" + if vm="$(modinfo -F vermagic "$cand" 2>/dev/null)" && [ -n "$vm" ]; then + note="built for ${vm%% *}" + else + # modinfo couldn't read it - usually not an ELF .ko at all + # (e.g. a still-zipped release file). Show what it really is. + note="UNREADABLE: $(file -b "$cand" 2>/dev/null || echo 'not a kernel module') - unzip/rebuild?" + fi + msg="$msg"$'\n'" $cand ($note)" any=1 done done