From c5250f4c82ce8d5cde4f65e0c690a923092807e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 7 May 2018 12:11:38 +0200 Subject: Escape double quotes when passing ERLC_OPTS during tests --- core/core.mk | 6 +++++- core/test.mk | 6 +++--- plugins/dialyzer.mk | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/core/core.mk b/core/core.mk index 9925856..0d0fd90 100644 --- a/core/core.mk +++ b/core/core.mk @@ -154,9 +154,13 @@ define comma_list $(subst $(space),$(comma),$(strip $(1))) endef +define escape_dquotes +$(subst ",\",$1) +endef + # Adding erlang.mk to make Erlang scripts who call init:get_plain_arguments() happy. define erlang -$(ERL) $(2) -pz $(ERLANG_MK_TMP)/rebar/ebin -eval "$(subst $(newline),,$(subst ",\",$(1)))" -- erlang.mk +$(ERL) $2 -pz $(ERLANG_MK_TMP)/rebar/ebin -eval "$(subst $(newline),,$(call escape_dquotes,$1))" -- erlang.mk endef ifeq ($(PLATFORM),msys2) diff --git a/core/test.mk b/core/test.mk index fa715e7..c0c7199 100644 --- a/core/test.mk +++ b/core/test.mk @@ -32,17 +32,17 @@ endif ifeq ($(wildcard src),) test-build:: ERLC_OPTS=$(TEST_ERLC_OPTS) test-build:: clean deps test-deps - $(verbose) $(MAKE) --no-print-directory test-dir ERLC_OPTS="$(TEST_ERLC_OPTS)" + $(verbose) $(MAKE) --no-print-directory test-dir ERLC_OPTS="$(call escape_dquotes,$(TEST_ERLC_OPTS))" else ifeq ($(wildcard ebin/test),) test-build:: ERLC_OPTS=$(TEST_ERLC_OPTS) test-build:: clean deps test-deps $(PROJECT).d - $(verbose) $(MAKE) --no-print-directory app-build test-dir ERLC_OPTS="$(TEST_ERLC_OPTS)" + $(verbose) $(MAKE) --no-print-directory app-build test-dir ERLC_OPTS="$(call escape_dquotes,$(TEST_ERLC_OPTS))" $(gen_verbose) touch ebin/test else test-build:: ERLC_OPTS=$(TEST_ERLC_OPTS) test-build:: deps test-deps $(PROJECT).d - $(verbose) $(MAKE) --no-print-directory app-build test-dir ERLC_OPTS="$(TEST_ERLC_OPTS)" + $(verbose) $(MAKE) --no-print-directory app-build test-dir ERLC_OPTS="$(call escape_dquotes,$(TEST_ERLC_OPTS))" endif clean:: clean-test-dir diff --git a/plugins/dialyzer.mk b/plugins/dialyzer.mk index e7f502e..63e64b8 100644 --- a/plugins/dialyzer.mk +++ b/plugins/dialyzer.mk @@ -57,4 +57,4 @@ dialyze: else dialyze: $(DIALYZER_PLT) endif - $(verbose) dialyzer --no_native `$(ERL) -eval "$(subst $(newline),,$(subst ",\",$(call filter_opts.erl)))" -extra $(ERLC_OPTS)` $(DIALYZER_DIRS) $(DIALYZER_OPTS) + $(verbose) dialyzer --no_native `$(ERL) -eval "$(subst $(newline),,$(call escape_dquotes,$(call filter_opts.erl)))" -extra $(ERLC_OPTS)` $(DIALYZER_DIRS) $(DIALYZER_OPTS) -- cgit v1.2.3