From: Mohamed Khalfella <mkhalfella@purestorage.com>
To: linux-block@vger.kernel.org
Cc: shinichiro.kawasaki@wdc.com,
Randy Jennings <randyj@purestorage.com>,
Mohamed Khalfella <mkhalfella@purestorage.com>
Subject: [PATCH blktests] src/Makefile: fix HAVE_C_DEF probe under a non-bash /bin/sh
Date: Tue, 8 Sep 2026 14:48:23 -0700 [thread overview]
Message-ID: <20260908214823.2366812-1-mkhalfella@purestorage.com> (raw)
HAVE_C_DEF feeds its test program to the compiler with "echo -e". The
$(shell ...) function runs under /bin/sh, which is dash on Debian and
Ubuntu, and dash's echo has no -e option. It prints the flag literally,
so the first line of the probe becomes
-e #include <linux/ublk_cmd.h>
which is no longer a preprocessor directive. The header is never
included, the tested macro is never defined, and the probe reports 0
regardless of what the installed headers contain.
The only user is HAVE_NEW_UBLK_INTF, so miniublk is skipped with
Skip miniublk build due to missing new ublk interface(v6.4+)
Use printf instead, which expands \n in any POSIX shell, and pass the
substituted names as arguments so they are not reinterpreted.
Signed-off-by: Mohamed Khalfella <mkhalfella@purestorage.com>
---
src/Makefile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/Makefile b/src/Makefile
index ef9c887..dd64694 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -8,8 +8,9 @@ HAVE_C_MACRO = $(shell if echo "$(H)include <$(1)>" | \
$(CC) $(CFLAGS) -E - 2>&1 /dev/null | grep $(2) > /dev/null 2>&1; \
then echo 1;else echo 0; fi)
-HAVE_C_DEF = $(shell if echo -e "$(H)include <$(1)>\n$(H)ifdef $(2)\nHAVE_$(2)\n$(H)endif" | \
- $(CC) $(CFLAGS) -E - 2>&1 /dev/null | grep HAVE_$(2) > /dev/null 2>&1; \
+HAVE_C_DEF = $(shell if printf '$(H)include <%s>\n$(H)ifdef %s\nHAVE_%s\n$(H)endif\n' \
+ "$(1)" "$(2)" "$(2)" | \
+ $(CC) $(CFLAGS) -E - 2>/dev/null | grep HAVE_$(2) > /dev/null 2>&1; \
then echo 1;else echo 0; fi)
C_TARGETS := \
--
2.55.0
next reply other threads:[~2026-09-08 21:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 21:48 Mohamed Khalfella [this message]
2026-09-11 11:36 ` [PATCH blktests] src/Makefile: fix HAVE_C_DEF probe under a non-bash /bin/sh Shin'ichiro Kawasaki
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=20260908214823.2366812-1-mkhalfella@purestorage.com \
--to=mkhalfella@purestorage.com \
--cc=linux-block@vger.kernel.org \
--cc=randyj@purestorage.com \
--cc=shinichiro.kawasaki@wdc.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.