From 9239ed33f6d988b0ed361db64ccd27eacdd367e6 Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Thu, 4 Mar 2021 23:20:32 +0100 Subject: [PATCH] mk: Don't use mime-type to determine type of the lib file Some versions of the file (e.g. 5.33) confuse the sharedlib files with pie-executable ones when they already have the executable bit set. Since this particular bit is already set on the .so.* when they are built, file may report the type as "application/x-pie-executable" instead. As a result, lib files won't have proper permissions set when installed. This is a bit problematic for building the RPMs since when find-provides kicks in to determine the dependencies, said files are not picked up at all - package ends up with empty "provides:" data breaking the dependency lookup during installation of other packages which may depend on the broken one. To mitigate, don't use mime-type, simply run file against the lib in default mode and look for "shared object" string - this should work for most of the file versions available on the supported distribution. Spotted on Fedora31. Signed-off-by: Michal Berger Change-Id: If9974f5acbdad6eb1204b64f0ee1ac9b2e20f85b Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6703 Tested-by: SPDK CI Jenkins Community-CI: Mellanox Build Bot Reviewed-by: Tomasz Zawadzki Reviewed-by: Ben Walker Reviewed-by: Karol Latecki --- mk/spdk.common.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mk/spdk.common.mk b/mk/spdk.common.mk index 236b2c37b..633a05bda 100644 --- a/mk/spdk.common.mk +++ b/mk/spdk.common.mk @@ -394,7 +394,7 @@ endef INSTALL_SHARED_LIB=\ $(Q)echo " INSTALL $(DESTDIR)$(libdir)/$(notdir $(SHARED_LINKED_LIB))"; \ install -d -m 755 "$(DESTDIR)$(libdir)"; \ - if file --mime-type $(SHARED_REALNAME_LIB) | grep -q 'application/x-sharedlib'; then \ + if file $(SHARED_REALNAME_LIB) | grep -q 'LSB shared object'; then \ perm_mode=755; \ else \ perm_mode=644; \