linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "linux-trace-devel@vger.kernel.org"  <linux-trace-devel@vger.kernel.org>
Subject: [PATCH] libtraceevent: Fix make install_libs updating of ldconfig
Date: Thu, 8 Apr 2021 21:21:49 -0400	[thread overview]
Message-ID: <20210408212149.6940fdda@oasis.local.home> (raw)

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

The ldconfig file /etc/ld.conf.d/trace.conf was being updated when it did
not need to be, and should not be updated if ldconfig is not in the patch
when installing.

Add a check to see if ldconfig can successfully run before testing if conf
file should be updated. Also fix the grep of the conf file that looks for
the path such that the output is not displayed to the console.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index e5574ce..b617baa 100644
--- a/Makefile
+++ b/Makefile
@@ -290,16 +290,17 @@ ifeq ("$(DESTDIR)", "")
 # and running ldconfig, if the library is visible by ld.so.
 # If not, add the path to /etc/ld.so.conf.d/trace.conf and run ldconfig again.
 define install_ld_config
-	$(LDCONFIG); \
-	if ! grep "^$(libdir)$$" $(LD_SO_CONF_PATH)/* &> /dev/null ; then \
-		$(CC) -o $(OUTPUT)test $(srctree)/test.c -I $(includedir_SQ) \
-			-L $(libdir_SQ) -ltraceevent &>/dev/null; \
-		if ! $(OUTPUT)test &> /dev/null; then \
-			$(call PRINT_INSTALL, trace.conf) \
-			echo $(libdir_SQ) >> $(LD_SO_CONF_PATH)/trace.conf; \
-			$(LDCONFIG); \
+	if $(LDCONFIG); then \
+		if ! grep -q "^$(libdir)$$" $(LD_SO_CONF_PATH)/* ; then \
+			$(CC) -o $(OUTPUT)test $(srctree)/test.c -I $(includedir_SQ) \
+				-L $(libdir_SQ) -ltraceevent &>/dev/null; \
+			if ! $(OUTPUT)test &> /dev/null; then \
+				$(call PRINT_INSTALL, trace.conf) \
+				echo $(libdir_SQ) >> $(LD_SO_CONF_PATH)/trace.conf; \
+				$(LDCONFIG); \
+			fi; \
+			$(RM) $(OUTPUT)test; \
 		fi; \
-		$(RM) $(OUTPUT)test; \
 	fi
 endef
 else
-- 
2.29.2


                 reply	other threads:[~2021-04-09  1:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210408212149.6940fdda@oasis.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).