* src/file.c (remove_intermediates): Fix an error message about a
failure to remove an intermediate file.
* tests/scripts/features/patternrules: Add tests.
}
if (status < 0)
{
- perror_with_name ("\nunlink: ", f->name);
+ if (doneany)
+ fputs ("\n", stdout);
+ fflush (stdout);
+ perror_with_name ("unlink: ", f->name);
/* Start printing over. */
doneany = 0;
}
}
}
+# SV 66268. An error message about a failure to remove an intermediate file.
+run_make_test(q!
+all: hello.x
+%.x: b/%.q; $(info $@ from $<)
+b/%.q:; @mkdir b; touch $@; chmod -w b
+!, '', "hello.x from b/hello.q\nrm b/hello.q\n#MAKE#: unlink: b/hello.q: $ERR_unreadable_file\n");
+
+chmod(0754, 'b');
+unlink('b/hello.q');
+rmdir('b');
+
+run_make_test(q!
+all: hello.x
+%.x: b/%.q; $(info $@ from $<)
+b/%.q:; @mkdir b; touch $@; chmod -w b
+!, '-s', "hello.x from b/hello.q\n#MAKE#: unlink: b/hello.q: $ERR_unreadable_file\n");
+
+chmod(0754, 'b');
+unlink('b/hello.q');
+rmdir('b');
+
# This tells the test driver that the perl test script executed properly.
1;