From: Dmitry Goncharov Date: Sat, 26 Feb 2022 22:12:03 +0000 (-0500) Subject: [SV 62088] Avoid re-exec due to stdin. X-Git-Tag: 4.3.90~95 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=40a6751abfc7317d9f0201448db0bf924d1a30ee;p=thirdparty%2Fmake.git [SV 62088] Avoid re-exec due to stdin. The fix for SV 60595 causes make to re-execute when the makefile is read from stdin. E.g. $ printf 'all:; $(info hello)' | make -sf - Reported by Sergei Trofimovich Test added by Paul Smith * src/main.c (main): Set the mtime of the stdin temporary file. * tests/scripts/features/reinvoke: Add a test. --- diff --git a/src/main.c b/src/main.c index 0554e526..206e3b33 100644 --- a/src/main.c +++ b/src/main.c @@ -1849,6 +1849,8 @@ main (int argc, char **argv, char **envp) make re-exec. */ f->intermediate = 0; f->dontcare = 0; + /* Avoid re-exec due to stdin. */ + f->last_mtime = f->mtime_before_update = f_mtime (f, 0); } } } diff --git a/tests/scripts/features/reinvoke b/tests/scripts/features/reinvoke index cb3f2cc3..5bcc40b4 100644 --- a/tests/scripts/features/reinvoke +++ b/tests/scripts/features/reinvoke @@ -163,5 +163,17 @@ include hello.d unlink('hello.td'); +# Test DV 62088 : make sure we don't re-invoke for stdin makefiles. +# The test framework doesn't seem to have a good way to do this. + +create_file('input.mk', "all:;\$(info all)\n"); + +close(STDIN); +open(STDIN, "<", 'input.mk') || die "input.mk: $!\n"; + +run_make_test('', '-sf -', "all\n"); + +unlink('input.mk'); + # This tells the test driver that the perl test script executed properly. 1;