Skip to contentSkip to conversation

libtraceevent: Fix the /dev/null redirection compatibility in Makefile

PATCH New Haiyue Wang 1 participant 1 message May 13, 2025 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 libtraceevent: Fix the /dev/null redirection compatibility in Makefile

The commit c2ea03541453 ("libtraceevent: Add trace.conf for ld.so if needed") runs with below output message, and the built 'test' will not be removed as expected.

INSTALL /root/linux/libtraceevent/lib/libtraceevent.so.1.8.4 to /usr/local/lib64
INSTALL trace.conf to /etc/ld.so.conf.d/
/bin/sh: 1: /root/linux/libtraceevent/test: not found
DESCEND plugins

Use more compatible syntax to handle shell null redirection.

---
v2:
- Find the root cause why test is not removed as expected.
v1: https://lore.kernel.org/linux-trace-devel/[email protected]/

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
index 0afaef0..b559b6d 100644
@@ -317,8 +317,8 @@ define install_ld_config
 	if $(LDCONFIG); then \
 		if ! grep -q "^$(libdir)$$" $(LD_SO_CONF_PATH)/* ; then \
 			$(CC) -o $(objtree)/test $(srctree)/test.c -I $(includedir_SQ) \
-				-L $(libdir_SQ) -ltraceevent &> /dev/null; \
-			if ! $(objtree)/test &> /dev/null; then \
+				-L $(libdir_SQ) -ltraceevent > /dev/null 2>&1; \
+			if ! $(objtree)/test > /dev/null 2>&1; then \
 				$(call print_install, trace.conf, $(LD_SO_CONF_PATH)) \
 				echo $(libdir_SQ) >> $(LD_SO_CONF_PATH)/trace.conf; \
 				$(LDCONFIG); \
Signature · 1 line
2.49.0