]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(dracut-install): add sysfs node parents' modules as dependencies
authorAlper Nebi Yasak <alpernebiyasak@gmail.com>
Mon, 3 Jun 2024 07:07:35 +0000 (10:07 +0300)
committerLaszlo <laszlo.gombos@gmail.com>
Sun, 18 May 2025 10:43:16 +0000 (06:43 -0400)
While searching a sysfs node for suppliers to add as dependencies, we
also consider suppliers of its parent nodes as dependencies. The code
doing so doesn't explore suppliers-of-suppliers chains, which is meant
to be handled elsewhere. More importantly it misses the parent nodes of
the devices themselves, parents-of-suppliers chains, and their
dependencies; all of which is necessary to get a device working.

Consider the parent nodes of a sysfs node as a supplier dependency when
building the `module_suppliers` hashmap. So the suppliers-of-suppliers
handling elsewhere can work with any combination of parent/supplier
relation.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
src/install/dracut-install.c

index d6bc32a7bc8a1de2ec56248891da0445868fdf73..3a8ea0e73bbabc430b85c875dd5e01ece025cef2 100644 (file)
@@ -2231,6 +2231,10 @@ static void find_suppliers_for_sys_node(Hashmap *suppliers, const char *node_pat
                         closedir(d);
                 }
                 strcat(node_path, "/.."); // Also find suppliers of parents
+                char *parent_path = realpath(node_path, NULL);
+                if (parent_path != NULL)
+                        if (hashmap_put(suppliers, parent_path, parent_path) < 0)
+                                free(parent_path);
         }
 }