Package: mmdebstrap
Version: 1.3.1-2
Severity: minor
Tags: patch

Hi Johannes,

while this is not the cause for my funny ppc64el and s390x boot
failures, I think this is worth fixing anyhow, so here we go:

When --mode=chroot wraps ldconfig, it overwrites and -r argument. As it
happens mkinitramfs passes -r to ldconfig. When mmdebstrap's ldconfig
intercepts that, it overwrites that -r and the initramfs ends up missing
a ld.so.cache, which should be non-fatal, but is a difference anyhow.

I've tried fixing this and my final solution ended up with a ld.so.cache
(even though it still wouldn't boot, but that's another problem). Please
take this patch with a grain of salt.

Helmut
--- a/ldconfig.fakechroot
+++ b/ldconfig.fakechroot
@@ -106,10 +106,24 @@
     for d in get_libdirs(chroot, [chroot / "etc" / "ld.so.conf"]):
         make_relative(d)
 
+    rootarg = chroot
+    argv = sys.argv[1:]
+    for arg in sys.argv[1:]:
+        if arg == "-r":
+            rootarg = None
+        elif rootarg is None:
+            argpath = Path(arg)
+            if argpath.is_absolute():
+                rootarg = chroot / argpath.relative_to("/")
+            else:
+                rootarg = Path.cwd() / argpath
+    if rootarg is None:
+        rootarg = chroot
+
     # we add any additional arguments before "-r" such that any other "-r"
     # option will be overwritten by the one we set
     subprocess.check_call(
-        [chroot / "sbin" / "ldconfig"] + sys.argv[1:] + ["-r", chroot]
+        [chroot / "sbin" / "ldconfig"] + sys.argv[1:] + ["-r", rootarg]
     )
 
 

Reply via email to