]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
whereis: include native multiarch path in lib search paths
authorAndreas Henriksson <andreas@fatal.se>
Sun, 30 Jul 2017 17:52:17 +0000 (19:52 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 31 Jul 2017 11:48:04 +0000 (13:48 +0200)
This includes atleast the native multiarch path in the paths to search.
(Maybe also other multiarch paths should also be searched? But atleast
this is a first step.)

Before this change (on Debian):
$ whereis libc
libc: /usr/share/man/man7/libc.7.gz

After this change:
$ whereis libc
libc: /usr/lib/x86_64-linux-gnu/libc.so /usr/lib/x86_64-linux-gnu/libc.a /usr/share/man/man7/libc.7.gz

Addresses: https://bugs.debian.org/856968
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
configure.ac
misc-utils/whereis.c

index 38b968878a7d13d32740d3d5638b057103ff50a9..dc71faa00a4d57f1f14e8ac2356714ca8b74c73d 100644 (file)
@@ -1490,6 +1490,11 @@ AM_CONDITIONAL([BUILD_MCOOKIE], [test "x$build_mcookie" = xyes])
 UL_BUILD_INIT([namei], [yes])
 AM_CONDITIONAL([BUILD_NAMEI], [test "x$build_namei" = xyes])
 
+matriplet="$($CC -print-multiarch 2>/dev/null || true)"
+if test "x$matriplet" != "x"; then
+  AC_DEFINE_UNQUOTED([MULTIARCHTRIPLET], ["$matriplet"],
+  ["Multi-arch triplet for whereis library search path"])
+fi
 UL_BUILD_INIT([whereis], [yes])
 AM_CONDITIONAL([BUILD_WHEREIS], [test "x$build_whereis" = xyes])
 
index bac158d46451bdbac0c1416c82db9151a0435f4b..caa155ca344dfc8421b8d298a81158ad144bb1e0 100644 (file)
@@ -96,6 +96,11 @@ struct wh_dirlist {
 static const char *bindirs[] = {
        "/usr/bin",
        "/usr/sbin",
+#if defined(MULTIARCHTRIPLET)
+       "/lib/" MULTIARCHTRIPLET,
+       "/usr/lib/" MULTIARCHTRIPLET,
+       "/usr/local/lib/" MULTIARCHTRIPLET,
+#endif
        "/usr/lib",
        "/usr/lib64",
        "/bin",