]> git.kaiwu.me - haproxy.git/commitdiff
BUILD: Makefile: force $(shell command -v ...) to run through the shell
authorOlivier Houchard <ohouchard@haproxy.com>
Tue, 10 Nov 2026 15:48:50 +0000 (16:48 +0100)
committerOlivier Houchard <cognet@ci0.org>
Thu, 12 Nov 2026 12:34:49 +0000 (13:34 +0100)
$(shell) commands with no metacharacter and not starting with a shell
builtin may be execvp()'d directly instead of being run through the
shell. "command" is a shell builtin that only appears in make's own
builtin list since version 4.3, so with make <= 4.2 the USE_MINIDEBUG
probe failed with "Command not found" and silently disabled the
embedded symbol table. Adding "2>/dev/null || :" brings metacharacters
which force the shell path on all make versions.

This should fix build on older distributions such as Ubuntu 18.04.

Makefile

index 050f1e2a00a14b8a40f5428d1fe2cb5b1041de19..a2d493993df64ab449737cd72fffbeec55989679 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -597,7 +597,7 @@ EXTRA_OBJS =
 # This should work with GNU binutils, LLVM tools, elftoolchain, and OpenBSD's
 # nm.
 ifeq ($(origin USE_MINIDEBUG),undefined)
-USE_MINIDEBUG := $(if $(and $(shell command -v $(XZ)),$(shell $(CC) -dM -E -xc - </dev/null 2>/dev/null | grep __ELF__),$(shell \
+USE_MINIDEBUG := $(if $(and $(shell command -v $(XZ) 2>/dev/null || :),$(shell $(CC) -dM -E -xc - </dev/null 2>/dev/null | grep __ELF__),$(shell \
        printf 'static int _probe_local;\nint _probe_global;\nint main(void){ return _probe_local + _probe_global; }\n' > .minidbg_probe.c && \
        $(CC) -rdynamic .minidbg_probe.c -o .minidbg_probe >/dev/null 2>&1 && \
        $(NM) -P .minidbg_probe 2>/dev/null | grep -q '^_probe_local ' && \