https://savannah.gnu.org/bugs/?30653 2012-09-09 Paul Smith * remake.c (update_file_1): Force intermediate files to be considered, not pruned, if their non-intermediate parent needs to be remade. Fixes Savannah bug #30653. Index: remake.c =================================================================== RCS file: /sources/make/make/remake.c,v retrieving revision 1.153 retrieving revision 1.154 diff -u -r1.153 -r1.154 --- remake.c 5 Mar 2012 14:10:45 -0000 1.153 +++ remake.c 10 Sep 2012 02:36:05 -0000 1.154 @@ -612,6 +612,10 @@ d->file->dontcare = file->dontcare; } + /* We may have already considered this file, when we didn't know + we'd need to update it. Force update_file() to consider it and + not prune it. */ + d->file->considered = !considered; dep_status |= update_file (d->file, depth); Index: tests/scripts/features/parallelism =================================================================== RCS file: /sources/make/make/tests/scripts/features/parallelism,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- tests/scripts/features/parallelism 4 Mar 2012 00:24:32 -0000 1.19 +++ tests/scripts/features/parallelism 10 Sep 2012 02:36:05 -0000 1.20 @@ -214,6 +214,23 @@ rmfiles(qw(foo.y foo.y.in main.bar)); } +# Ensure intermediate/secondary files are not pruned incorrectly. +# See Savannah bug #30653 + +utouch(-15, 'file2'); +utouch(-10, 'file4'); +utouch(-5, 'file1'); + +run_make_test(q! +.INTERMEDIATE: file3 +file4: file3 ; @mv -f $< $@ +file3: file2 ; touch $@ +file2: file1 ; @touch $@ +!, + '--no-print-directory -j2', "touch file3"); + +#rmfiles('file1', 'file2', 'file3', 'file4'); + if ($all_tests) { # Jobserver FD handling is messed up in some way. # Savannah bug #28189