]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(dracut): use "-name" to avoid find matching temporary directory
authorDeli Zhang <deli.zhang@cloud.com>
Mon, 18 Aug 2025 01:41:10 +0000 (01:41 +0000)
committerLaszlo <laszlo.gombos@gmail.com>
Fri, 22 Aug 2025 03:24:44 +0000 (23:24 -0400)
$initdir includes a temporary directory, and the "-path" option of
find attempts to match the entire path. If the temporary directory
happens to contain ".ko", e.g.
  initdir=/var/tmp/dracut.ko79pT/initramfs
this can lead to a incorrect match, finally all executable files are
excluded.

Signed-off-by: Deli Zhang <deli.zhang@cloud.com>
dracut.sh

index 839b5309cafbc6c6249eda13b71e22375123a6c9..d0d58c09a670f5fc02a23275152a3379da845658 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -2214,7 +2214,7 @@ if [[ $kernel_only != yes ]]; then
     if [[ ${DRACUT_RESOLVE_LAZY-} ]] && [[ $DRACUT_INSTALL ]]; then
         dinfo "*** Resolving executable dependencies ***"
         # shellcheck disable=SC2086
-        find "$initdir" -type f -perm /0111 -not -path '*.ko*' -print0 \
+        find "$initdir" -type f -perm /0111 -not -name '*.ko*' -print0 \
             | xargs -r -0 $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${dracutsysrootdir:+-r "$dracutsysrootdir"} -R ${DRACUT_FIPS_MODE:+-f} --
         # shellcheck disable=SC2181
         if (($? == 0)); then