[PATCH] buildsys: Preserve arguments passed on

Joseph Benden <[email protected]> Thu, 21 Mar 2019 19:26:09 -0700
Newsgroups gmane.comp.lib.uclibc.general
Message-ID <[email protected]>
This patch ensures all arguments are quoted, during command-line
construction.

This fixes compilation where spaces occur within the arguments.

Additional Information:

  https://github.com/openwrt/openwrt/pull/1620

Signed-off-by: Joseph Benden <[email protected]>
---
 bin/Makefile.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/Makefile.in b/bin/Makefile.in
index 8d11316..17e0ae5 100644
--- a/bin/Makefile.in
+++ b/bin/Makefile.in
@@ -34,7 +34,7 @@ define do_wrapper
 	$(Q)echo 'WRAPPER_INCLIB="Y"' >> [email protected]
 	$(Q)echo 'while [ -n "$$1" ]' >> [email protected]
 	$(Q)echo 'do' >> [email protected]
-	$(Q)echo '	WRAPPER_OPTIONS="$$WRAPPER_OPTIONS $$1"' >> [email protected]
+	$(Q)echo '	WRAPPER_OPTIONS="$$WRAPPER_OPTIONS '"'"'$$1'"'"'"' >> [email protected]
 	$(Q)echo '	if [ "$$1" = "-c" -o "$$1" = "-E" -o "$$1" = "-S" ]' >> [email protected]
 	$(Q)echo '	then' >> [email protected]
 	$(Q)echo '		WRAPPER_INCLIB="N"' >> [email protected]
@@ -51,7 +51,7 @@ define do_wrapper
 	$(Q)echo 'fi' >> [email protected]
 	$(Q)echo '' >> [email protected]
 	$(Q)echo '[ -n "$$V" ] && [ $$V -gt 1 ] && echo $(CXX) $(GEN_CFLAGS) $(GEN_CXXFLAGS) $(EH_CXXFLAGS) $$WRAPPER_INCLUDEDIR $$WRAPPER_OPTIONS' >> [email protected]
-	$(Q)echo 'exec $(CXX) $(GEN_CFLAGS) $(GEN_CXXFLAGS) $(EH_CXXFLAGS) $$WRAPPER_INCLUDEDIR $$WRAPPER_OPTIONS' >> [email protected]
+	$(Q)echo 'eval $(CXX) $(GEN_CFLAGS) $(GEN_CXXFLAGS) $(EH_CXXFLAGS) "$$WRAPPER_INCLUDEDIR" "$$WRAPPER_OPTIONS"' >> [email protected]
 	$(Q)echo '' >> [email protected]
 	$(Q)chmod 0755 [email protected]
 	$(Q)mv [email protected] $@
-- 
2.7.4