Skip to content

Commit

Permalink
Make sure kernelver array doesn't contain empty element
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
akorn committed Jan 31, 2025
1 parent 7098abf commit 5f9f3c0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions dkms.in
Original file line number Diff line number Diff line change
Expand Up @@ -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.)
Expand Down

0 comments on commit 5f9f3c0

Please sign in to comment.