From 4e758b8bfbc1a2d0d7a79a49d9f3720f7d426340 Mon Sep 17 00:00:00 2001 From: persmule Date: Thu, 1 Mar 2018 15:13:01 +0800 Subject: [PATCH] Walkaround envvars passed through make(1) when generating etc/config "export" statements included or declared in a Makefile proves literally (with no escape) passed to the shell, which may result in shell envvars containing literal double quote if SHELL is set as bash, and they further becomes statements containing `\"` when printed with command export. This behavior could be observed by the makefile inlined at the end. This commit adds a regexp to sed to remove those `\"`. export QUOTE="QUOTE" SHELL := /bin/bash .SHELLFLAGS := -o pipefail -c export-quote: export|grep QUOTE --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 840a186f..084ca825 100644 --- a/Makefile +++ b/Makefile @@ -426,7 +426,8 @@ $(build)/$(BOARD)/tools.cpio: \ mkdir -p "$(initrd_dir)/etc" ; \ export \ | grep ' CONFIG_' \ - | sed 's/^declare -x /export /' \ + | sed -e 's/^declare -x /export /' \ + -e 's/\\\"//g' \ > "$(initrd_dir)/etc/config" \ ) $(call do-cpio,$@,$(initrd_dir))