]> git.ipfire.org Git - thirdparty/make.git/commitdiff
* job.c (exec_command): [SV 47365] Show error on exec failure.
authorPaul Smith <psmith@gnu.org>
Wed, 9 Mar 2016 05:18:57 +0000 (00:18 -0500)
committerPaul Smith <psmith@gnu.org>
Wed, 9 Mar 2016 05:18:57 +0000 (00:18 -0500)
job.c
tests/scripts/features/output-sync

diff --git a/job.c b/job.c
index be539c7dcf8fc551926c1799fa6254385a9d0b62..96f30ae048074c4acb7fe773c2ef114750f30f90 100644 (file)
--- a/job.c
+++ b/job.c
@@ -2322,7 +2322,13 @@ exec_command (char **argv, char **envp)
   switch (errno)
     {
     case ENOENT:
-      OS (error, NILF, _("%s: Command not found"), argv[0]);
+      /* We are in the child: don't use the output buffer.
+         It's not right to run fprintf() here!  */
+      if (makelevel == 0)
+        fprintf (stderr, _("%s: %s: Command not found\n"), program, argv[0]);
+      else
+        fprintf (stderr, _("%s[%u]: %s: Command not found\n"),
+                 program, makelevel, argv[0]);
       break;
     case ENOEXEC:
       {
index a7534cb7aaf03881fe7016b62c76cf01a766378c..ff3aff1d8eacaf51a276e306b419654f14e75383 100644 (file)
@@ -337,5 +337,13 @@ foo: $(OBJS) ; echo $(or $(filter %.o,$^),$(error fail))
 !,
               '-O', "#MAKEFILE#:2: *** fail.  Stop.\n", 512);
 
+# SV 47365: Make sure exec failure error messages are shown
+# Is "127" not always the same everywhere?  We may have to detect it?
+
+run_make_test(q!
+all:: ; @./foo bar baz
+!,
+              '-O', "#MAKE#: ./foo: Command not found\n#MAKEFILE#:2: recipe for target 'all' failed\n#MAKE#: *** [all] Error 127\n", 512);
+
 # This tells the test driver that the perl test script executed properly.
 1;