From 5f9f3c00d8af198012398be7b4c0721295d0e566 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20Korn?= Date: Fri, 31 Jan 2025 18:31:13 +0100 Subject: [PATCH] Make sure `kernelver` array doesn't contain empty element The shift from the `< <(cmd)` idom to `<<<"$(cmd)"` which is needed to work without /proc being mounted has the unfortunate side effect that the exit status of `cmd` is ignored where it wasn't before. This can cause statements that previously always had valid input to be called on empty strings. One such occurrence was in `setup_kernels_arches()`, which, among other things, populates the `kernelver` array; after the `<<<` change, this array could contain an empty string as an element. This commit adds a sanity check to make sure we don't pretend there is a kernel whose version number is the empty string. --- dkms.in | 1 + 1 file changed, 1 insertion(+) diff --git a/dkms.in b/dkms.in index 6b037904..35ca8e77 100644 --- a/dkms.in +++ b/dkms.in @@ -374,6 +374,7 @@ setup_kernels_arches() local i i=0 while read line; do + [[ -n "$line" ]] || continue line=${line#*/}; line=${line#*/}; # (I would leave out the delimiters in the status output # in the first place.)