Skip to contentSkip to conversation

pkg-utils: qstrip MESSAGE

PATCH New Yann E. MORIN 2 participants 2 messages Sep 28, 2014 – Sep 29, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pkg-utils: qstrip MESSAGE

Currently, the MESSAGE macro double-quotes the message. But a few call sites also double-quote the message, resulting in a borked call to echo, like:

    $(call MESSAGE,"user text")

would expand to:
echo "Leading text "user message" trailign text"

Just use qstrip on the user message, so we get protected from either a comma in the user text (so make does not interpret it), or a semi-colon (so the shell does not interpret it.)

Cc Peter Korsgaard <[email protected]>
Cc Thomas De Schampheleire <[email protected]>
---
 package/pkg-utils.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-utils.mk +1 -1
index 89ad9e9..44766a0 100644
@@ -67,7 +67,7 @@ INFLATE.tar  = cat
 suitable-extractor = $(INFLATE$(suffix $(1)))
 
 # MESSAGE Macro -- display a message in bold type
-MESSAGE     = echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION) $(1)$(TERM_RESET)"
+MESSAGE     = echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION) $(call qstrip,$(1))$(TERM_RESET)"
 TERM_BOLD  := $(shell tput smso)
 TERM_RESET := $(shell tput rmso)
 
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 pkg-utils: qstrip MESSAGE

Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Currently, the MESSAGE macro double-quotes the message. But a few call sites also double-quote the message, resulting in a borked call to echo, like:

    $(call MESSAGE,"user text")

would expand to:
echo "Leading text "user message" trailign text"

Quoted 7 lines

Just use qstrip on the user message, so we get protected from either a comma in the user text (so make does not interpret it), or a semi-colon (so the shell does not interpret it.)

Cc Peter Korsgaard <[email protected]>
Cc Thomas De Schampheleire <[email protected]>

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard