Skip to contentSkip to conversation

perf tools: Do not require /bin/sh be bash

PATCH New Richard Yao 1 participant 1 message Jul 19, 2015 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf tools: Do not require /bin/sh be bash

Commit fcfd6611fbccdbf2593bd949097a5c0e45cd96da truncated .config-detected by piping echo -n to it. On systems where /bin/sh is not bash and echo is a builtin, echo -n prints "-n", which breaks the build:

.config-detected:1: *** missing separator. Stop.

This broke builds on my Gentoo systems where /bin/sh is dash and possibly other systems where /bin/sh is not bash as well. It is easily solved by piping cat /dev/null. Piping an empty command should have been a suitable substitute, but zsh hangs when asked to do that.

This method of truncating a file works on bash, busybox ash, dash and zsh. Other shells were not tested.

---
 tools/perf/config/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/config/Makefile +1 -1
index 094ddae..70426d6 100644
@@ -11,7 +11,7 @@ ifneq ($(obj-perf),)
 obj-perf := $(abspath $(obj-perf))/
 endif
 
-$(shell echo -n > $(OUTPUT).config-detected)
+$(shell cat /dev/null > $(OUTPUT).config-detected)
 detected     = $(shell echo "$(1)=y"       >> $(OUTPUT).config-detected)
 detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)
 
Signature · 1 line
2.3.6