737328c
From 6d886bb74d1608e4565d926aa259ea5afc9df7b9 Mon Sep 17 00:00:00 2001
737328c
From: Mike Gilbert <floppym@gentoo.org>
737328c
Date: Thu, 4 Oct 2018 16:45:47 -0400
737328c
Subject: [PATCH] dracut-install: simplify ldd parsing logic
737328c
737328c
The previous logic would not handle absolute paths on the left side of
737328c
the "=>" properly. For example, on Gentoo ARM64, ldd outputs this:
737328c
737328c
	/lib/ld-linux-aarch64.so.1 => /lib64/ld-linux-aarch64.so.1
737328c
737328c
At runtime, the kernel tries to load the file from /lib, and fails if we
737328c
only provide it in /lib64.
737328c
737328c
Instead of looking for the first slash after the "=>", just look for the
737328c
first slash, period. This would fail if we somehow had a relative path
737328c
on the left side (foo/libbar.so), but I'm not aware of any binaries that
737328c
would contain such an entry in DT_NEEDED.
737328c
737328c
Bug: https://bugs.gentoo.org/667752
737328c
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
737328c
---
737328c
 install/dracut-install.c | 6 +-----
737328c
 1 file changed, 1 insertion(+), 5 deletions(-)
737328c
737328c
diff --git a/install/dracut-install.c b/install/dracut-install.c
737328c
index 88bca1d4..5f352b36 100644
737328c
--- a/install/dracut-install.c
737328c
+++ b/install/dracut-install.c
737328c
@@ -479,11 +479,7 @@ static int resolve_deps(const char *src)
737328c
                 if (strstr(buf, destrootdir))
737328c
                         break;
737328c
 
737328c
-                p = strstr(buf, "=>");
737328c
-                if (!p)
737328c
-                        p = buf;
737328c
-
737328c
-                p = strchr(p, '/');
737328c
+                p = strchr(buf, '/');
737328c
                 if (p) {
737328c
                         char *q;
737328c
 
737328c