Skip to contentSkip to conversation

whereis: include native multiarch path in lib search paths

PATCH In review Andreas Henriksson 2 participants 2 messages Jul 30, 2017 – Jul 31, 2017 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 whereis: include native multiarch path in lib search paths

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

---
 configure.ac         | 5 +++++
 misc-utils/whereis.c | 5 +++++
 2 files changed, 10 insertions(+)
configure.ac +5 -0
index 38b968878..dc71faa00 100644
@@ -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])
 
misc-utils/whereis.c +5 -0
index bac158d46..caa155ca3 100644
@@ -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",
Signature · 1 line
2.11.0
maintainer
#1 lore raw
Quoted 3 lines · Andreas Henriksson
 configure.ac         | 5 +++++
 misc-utils/whereis.c | 5 +++++
 2 files changed, 10 insertions(+)

Good idea. Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com