From 7b63ea57500c352c668b4fc1af97dbc5c28b5a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Tue, 5 Jul 2022 15:46:55 +0200 Subject: [PATCH] Makefile: remove mandatory "spatch" arguments from SPATCH_FLAGS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "--patch ." part of SPATCH_FLAGS added in f57d11728d1 (coccinelle: put sane filenames into output patches, 2018-07-23) should have been added unconditionally to the "spatch" invocation instead, using it isn't optional. Let's also move the other mandatory flag to come after $(SPATCH_FLAGS), to ensure that our "--sp-file" overrides any provided in the environment, both --sp-file and --patch are last-option-wins as far as spatch(1) option parsing is concerned. The environment variable override was initially added in a9a884aea57 (coccicheck: use --all-includes by default, 2016-09-30). In practice there's probably nobody that's using SPATCH_FLAGS to try to intentionally break our invocations, but since we're changing this let's make it clear what (if anything) we expect to be overridden by user-supplied flags. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 04d0fd1fe6..c1d02f0449 100644 --- a/Makefile +++ b/Makefile @@ -1286,7 +1286,7 @@ SANITIZE_ADDRESS = # For the 'coccicheck' target; setting SPATCH_BATCH_SIZE higher will # usually result in less CPU usage at the cost of higher peak memory. # Setting it to 0 will feed all files in a single spatch invocation. -SPATCH_FLAGS = --all-includes --patch . +SPATCH_FLAGS = --all-includes SPATCH_BATCH_SIZE = 1 include config.mak.uname @@ -3131,7 +3131,8 @@ check: $(GENERATED_H) limit='-n $(SPATCH_BATCH_SIZE)'; \ fi; \ if ! echo $(COCCI_SOURCES) | xargs $$limit \ - $(SPATCH) --sp-file $< $(SPATCH_FLAGS) \ + $(SPATCH) $(SPATCH_FLAGS) \ + --sp-file $< --patch . \ >$@+ 2>$@.log; \ then \ cat $@.log; \