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