mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCHi v2] rootfs: Fix handling of empty variables
@ 2021-02-03  8:12 Sascha Hauer
  2021-02-05  6:50 ` [ptxdist] [APPLIED] " Michael Olbrich
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2021-02-03  8:12 UTC (permalink / raw)
  To: ptxdist

$(PTXCONF_PROJECT_VENDOR) and $(PTXCONF_ROOTFS_ETC_HOSTNAME) can be
empty variables in which case bash answers with:

/bin/bash: command substitution: line 0: syntax error near unexpected token `newline'
/bin/bash: command substitution: line 0: `sed -r 's/ ?([\.:;,]) ?/ \1 /' <<< '

Fix this warning by adding quotes to make the empty string explicit.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---

Changes since v1:
- use remove_quotes

 rules/rootfs.make | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/rules/rootfs.make b/rules/rootfs.make
index 419ca001e..1c1e5501c 100644
--- a/rules/rootfs.make
+++ b/rules/rootfs.make
@@ -217,12 +217,14 @@ ifdef PTXCONF_ROOTFS_ISSUE
 		$(call remove_quotes,$(PTXCONF_ROOTFS_ETC_HOSTNAME)))
 	@$(call install_replace_figlet, rootfs, /etc/issue, \
 		@FIGLET:VENDOR@, \
-		`sed -r 's/ ?([\.:;,]) ?/ \1 /' <<< $(PTXCONF_PROJECT_VENDOR)`, \
-		etcissue)
+		`sed -r 's/ ?([\.:;,]) ?/ \1 /' <<< \
+			"$(call remove_quotes,$(PTXCONF_PROJECT_VENDOR))"`, \
+			etcissue)
 	@$(call install_replace_figlet, rootfs, /etc/issue, \
 		@FIGLET:HOSTNAME@, \
-		`sed -r 's/ ?([\.:;,]) ?/ \1 /' <<< $(PTXCONF_ROOTFS_ETC_HOSTNAME)`, \
-		etcissue)
+		`sed -r 's/ ?([\.:;,]) ?/ \1 /' <<< \
+			"$(call remove_quotes,$(PTXCONF_ROOTFS_ETC_HOSTNAME))"`, \
+			etcissue)
 endif
 
 ifdef PTXCONF_ROOTFS_HOSTS
-- 
2.20.1


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

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

end of thread, other threads:[~2021-02-05  6:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-03  8:12 [ptxdist] [PATCHi v2] rootfs: Fix handling of empty variables Sascha Hauer
2021-02-05  6:50 ` [ptxdist] [APPLIED] " Michael Olbrich

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