From 4974f592485d654fc0b4084030d05df34c8f0241 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Mon, 23 Jan 2023 07:19:43 +0100 Subject: [PATCH] ldconfig.fakechroot: do not ignore it, if ldconfig was already called with -r --- ldconfig.fakechroot | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/ldconfig.fakechroot b/ldconfig.fakechroot index 7a5e3bd..c3455af 100755 --- a/ldconfig.fakechroot +++ b/ldconfig.fakechroot @@ -106,10 +106,24 @@ def main(): 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] )