rpms/make/devel make-3.80-err-reporting.patch, NONE, 1.1 make.spec, 1.19, 1.20

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Mon Aug 22 09:58:51 UTC 2005


Author: jakub

Update of /cvs/dist/rpms/make/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv26173

Modified Files:
	make.spec 
Added Files:
	make-3.80-err-reporting.patch 
Log Message:
3.80-8


make-3.80-err-reporting.patch:
 job.c  |   19 ++++++++++++-------
 main.c |   12 ++++++------
 make.h |    2 ++
 misc.c |   22 ++++++++++++++++++++--
 4 files changed, 40 insertions(+), 15 deletions(-)

--- NEW FILE make-3.80-err-reporting.patch ---
--- make-3.80/misc.c.jj	2002-09-12 18:15:58.000000000 -0400
+++ make-3.80/misc.c	2005-08-22 05:46:05.000000000 -0400
@@ -336,19 +336,37 @@ strerror (errnum)
 /* Print an error message from errno.  */
 
 void
+perror_with_name_err (str, name, errnum)
+     const char *str, *name;
+     int errnum;
+{
+  error (NILF, _("%s%s: %s"), str, name, strerror (errnum));
+}
+
+void
 perror_with_name (str, name)
      const char *str, *name;
 {
-  error (NILF, _("%s%s: %s"), str, name, strerror (errno));
+  perror_with_name_err (str, name, errno);
 }
 
 /* Print an error message from errno and exit.  */
 
 void
+pfatal_with_name_err (name)
+     const char *name;
+     int errnum;
+{
+  fatal (NILF, _("%s: %s"), name, strerror (errnum));
+
+  /* NOTREACHED */
+}
+
+void
 pfatal_with_name (name)
      const char *name;
 {
-  fatal (NILF, _("%s: %s"), name, strerror (errno));
+  pfatal_with_name_err (name, errno);
 
   /* NOTREACHED */
 }
--- make-3.80/make.h.jj	2002-09-11 12:55:44.000000000 -0400
+++ make-3.80/make.h	2005-08-22 05:46:51.000000000 -0400
@@ -408,6 +408,8 @@ extern void die PARAMS ((int)) __attribu
 extern void log_working_directory PARAMS ((int));
 extern void pfatal_with_name PARAMS ((const char *)) __attribute__ ((noreturn));
 extern void perror_with_name PARAMS ((const char *, const char *));
+extern void pfatal_with_name_err PARAMS ((const char *, int errnum)) __attribute__ ((noreturn));
+extern void perror_with_name_err PARAMS ((const char *, const char *, int errnum));
 extern char *savestring PARAMS ((const char *, unsigned int));
 extern char *concat PARAMS ((const char *, const char *, const char *));
 extern char *xmalloc PARAMS ((unsigned int));
--- make-3.80/main.c.jj	2004-12-13 12:48:25.000000000 -0500
+++ make-3.80/main.c	2005-08-22 05:48:52.000000000 -0400
@@ -1358,13 +1358,13 @@ int main (int argc, char ** argv)
 	    strcat (template, DEFAULT_TMPFILE);
 	    outfile = open_tmpfile (&stdin_nm, template);
 	    if (outfile == 0)
-	      pfatal_with_name (_("fopen (temporary file)"));
+	      pfatal_with_name_err (_("fopen (temporary file)"), errno);
 	    while (!feof (stdin))
 	      {
 		char buf[2048];
 		unsigned int n = fread (buf, 1, sizeof (buf), stdin);
 		if (n > 0 && fwrite (buf, 1, n, outfile) != n)
-		  pfatal_with_name (_("fwrite (temporary file)"));
+		  pfatal_with_name_err (_("fwrite (temporary file)"), errno);
 	      }
 	    (void) fclose (outfile);
 
@@ -1531,7 +1531,7 @@ int main (int argc, char ** argv)
     else if ((job_rfd = dup (job_fds[0])) < 0)
       {
         if (errno != EBADF)
-          pfatal_with_name (_("dup jobserver"));
+          pfatal_with_name_err (_("dup jobserver"), errno);
 
         error (NILF,
                _("warning: jobserver unavailable: using -j1.  Add `+' to parent make rule."));
@@ -1571,7 +1571,7 @@ int main (int argc, char ** argv)
       char c = '+';
 
       if (pipe (job_fds) < 0 || (job_rfd = dup (job_fds[0])) < 0)
-	pfatal_with_name (_("creating jobs pipe"));
+	pfatal_with_name_err (_("creating jobs pipe"), errno);
 
       /* Every make assumes that it always has one job it can run.  For the
          submakes it's the token they were given by their parent.  For the
@@ -1580,7 +1580,7 @@ int main (int argc, char ** argv)
 
       while (--job_slots)
         if (write (job_fds[1], &c, 1) != 1)
-	  pfatal_with_name (_("init jobserver pipe"));
+	  pfatal_with_name_err (_("init jobserver pipe"), errno);
 
       /* Fill in the jobserver_fds struct for our children.  */
 
@@ -1925,7 +1925,7 @@ int main (int argc, char ** argv)
   /* If there is a temp file from reading a makefile from stdin, get rid of
      it now.  */
   if (stdin_nm && unlink (stdin_nm) < 0 && errno != ENOENT)
-    perror_with_name (_("unlink (temporary file): "), stdin_nm);
+    perror_with_name_err (_("unlink (temporary file): "), stdin_nm, errno);
 
   {
     int status;
--- make-3.80/job.c.jj	2002-08-09 21:27:17.000000000 -0400
+++ make-3.80/job.c	2005-08-22 05:54:48.000000000 -0400
@@ -785,7 +785,7 @@ free_child (child)
       /* Write a job token back to the pipe.  */
 
       if (write (job_fds[1], &token, 1) != 1)
-	pfatal_with_name (_("write jobserver"));
+	pfatal_with_name_err (_("write jobserver"), errno);
 
       DB (DB_JOBS, (_("Released token for child 0x%08lx (%s).\n"),
                     (unsigned long int) child, child->file->name));
@@ -1548,6 +1548,7 @@ new_job (file)
 
         /* Set interruptible system calls, and read() for a job token.  */
 	set_child_handler_action_flags (0);
+	errno = 0;
 	got_token = read (job_rfd, &token, 1);
 	saved_errno = errno;
 	set_child_handler_action_flags (SA_RESTART);
@@ -1562,10 +1563,14 @@ new_job (file)
 
         /* If the error _wasn't_ expected (EINTR or EBADF), punt.  Otherwise,
            go back and reap_children(), and try again.  */
-	errno = saved_errno;
-        if (errno != EINTR && errno != EBADF)
-          pfatal_with_name (_("read jobs pipe"));
-        if (errno == EBADF)
+        if (saved_errno != EINTR && saved_errno != EBADF)
+	  {
+	    if (got_token == 0)
+	      fatal (NILF, _("read jobs pipe EOF"));
+	    else
+	      pfatal_with_name_err (_("read jobs pipe"), saved_errno);
+	  }
+        if (saved_errno == EBADF)
           DB (DB_JOBS, ("Read returned EBADF.\n"));
       }
 #endif
@@ -1629,7 +1634,7 @@ load_too_high ()
 	    error (NILF,
                    _("cannot enforce load limits on this operating system"));
 	  else
-	    perror_with_name (_("cannot enforce load limit: "), "getloadavg");
+	    perror_with_name_err (_("cannot enforce load limit: "), "getloadavg", errno);
 	}
       lossage = errno;
       load = 0;
@@ -2028,7 +2033,7 @@ child_execute_job (argv, child)
 
       outfile = open_tmpfile (&comname, "sys$scratch:CMDXXXXXX.COM");
       if (outfile == 0)
-	pfatal_with_name (_("fopen (temporary file)"));
+	pfatal_with_name_err (_("fopen (temporary file)"), errno);
 
       if (ifile[0])
 	{


Index: make.spec
===================================================================
RCS file: /cvs/dist/rpms/make/devel/make.spec,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- make.spec	7 Mar 2005 14:45:47 -0000	1.19
+++ make.spec	22 Aug 2005 09:58:48 -0000	1.20
@@ -2,7 +2,7 @@
 Name: make
 Epoch: 1
 Version: 3.80
-Release: 7
+Release: 8
 License: GPL
 Group: Development/Tools
 URL: http://www.gnu.org/software/make/
@@ -12,6 +12,7 @@
 Patch3: make-3.80-cvs.patch
 Patch4: make-3.80-j8k.patch
 Patch5: make-3.80-getcwd.patch
+Patch6: make-3.80-err-reporting.patch
 Prereq: /sbin/install-info
 Prefix: %{_prefix}
 Buildroot: %{_tmppath}/%{name}-root
@@ -34,6 +35,7 @@
 %patch3 -p0
 %patch4 -p1
 %patch5 -p1
+%patch6 -p1
 
 %build
 #autoreconf -f --install
@@ -75,6 +77,10 @@
 %{_infodir}/*.info*
 
 %changelog
+* Mon Aug 22 2005 Jakub Jelinek <jakub at redhat.com> 3.80-8
+- make sure errno for error reporting is not lost accross _() calls
+- report EOF on read pipe differently from read returning < 0 reporting
+
 * Mon Mar  7 2005 Jakub Jelinek <jakub at redhat.com> 3.80-7
 - rebuilt with GCC 4
 




More information about the fedora-cvs-commits mailing list