Linux block layer
 help / color / mirror / Atom feed
* [PATCH blktests] src/Makefile: fix HAVE_C_DEF probe under a non-bash /bin/sh
@ 2026-09-08 21:48 Mohamed Khalfella
  2026-09-11 11:36 ` Shin'ichiro Kawasaki
  0 siblings, 1 reply; 2+ messages in thread
From: Mohamed Khalfella @ 2026-09-08 21:48 UTC (permalink / raw)
  To: linux-block; +Cc: shinichiro.kawasaki, Randy Jennings, Mohamed Khalfella

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH blktests] src/Makefile: fix HAVE_C_DEF probe under a non-bash /bin/sh
  2026-09-08 21:48 [PATCH blktests] src/Makefile: fix HAVE_C_DEF probe under a non-bash /bin/sh Mohamed Khalfella
@ 2026-09-11 11:36 ` Shin'ichiro Kawasaki
  0 siblings, 0 replies; 2+ messages in thread
From: Shin'ichiro Kawasaki @ 2026-09-11 11:36 UTC (permalink / raw)
  To: Mohamed Khalfella; +Cc: linux-block, Randy Jennings

On Sep 08, 2026 / 14:48, Mohamed Khalfella wrote:
> 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>

I applied the patch. Thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-11 11:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-08 21:48 [PATCH blktests] src/Makefile: fix HAVE_C_DEF probe under a non-bash /bin/sh Mohamed Khalfella
2026-09-11 11:36 ` Shin'ichiro Kawasaki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox