[glibc/release/2.44/master] elf: test: handle different rootsbindir in tst-ldconfig-cache

Sam James via Glibc-cvs <[email protected]>
Newsgroups gmane.comp.lib.glibc.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4662c4675d7f3ba87637c61730f06071f305c5cb

commit 4662c4675d7f3ba87637c61730f06071f305c5cb
Author: Xi Ruoyao <[email protected]>
Date:   Sun Jul 26 00:11:44 2026 +0800

    elf: test: handle different rootsbindir in tst-ldconfig-cache
    
    When compiling a glibc for a merged-/usr distro people may set
    rootsbindir=/usr/sbin.  But tst-ldconfig-cache has hard-coded
    /sbin/ldconfig path and so it fails with a different rootsbindir.
    
    Fix it by using support_install_rootsbindir like run_ldconfig in
    test-container.c.
    
    Signed-off-by: Xi Ruoyao <[email protected]>
    Reviewed-by: Florian Weimer <[email protected]>
    (cherry picked from commit 02ea17b5add83a205d8b204dce28f38fe0498ea3)

Diff:
---
 elf/tst-ldconfig-cache.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/elf/tst-ldconfig-cache.c b/elf/tst-ldconfig-cache.c
index 9f71418b3a..f4820a1822 100644
--- a/elf/tst-ldconfig-cache.c
+++ b/elf/tst-ldconfig-cache.c
@@ -85,7 +85,10 @@ corrupt (void)
 static void
 ldconfig (void)
 {
-  xsystem ("/sbin/ldconfig -X");
+  char *cmd = xasprintf("%s/ldconfig -X", support_install_rootsbindir);
+  xsystem (cmd);
+
+  free(cmd);
 }
 
 /* Change ld.so.conf to refer to the new directory, and generate a new
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.