This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

fixinc missing fixes on alphaev56-dec-osf4.0d


The latest snapshot of GCC was unable to build libg++'s regex library
because the fixes osf_namespace_[ab], that fixed some conflicts
regarding regex_t, hadn't been applied.

However, re-running fixincl manually, telling it to fix the files that
needed fixing, caused the files to be properly fixed.  But feeding
fixincl the same list of headers fixincl.sh feeds it would *sometimes*
cause it to skip some fixes.  Running fixincl within a debugger would
sometimes apply the appropriate fixes, but sometimes gdb would
intercept a SIGPIPE at the fflush() in run_shell().  But, for some
reason, this SIGPIPE wouldn't trigger the SIGPIPE signal handler.  In
any case, the shell was actually dead (I couldn't find out why), but
fixincl wouldn't notice it, and would keep feeding it commands, with
load_data() finding no output from the shell and returning empty
strings.

The solution was to arrange that, if load_data() doesn't get the end
marker, it returns NULL, and, if run_shell() gets a NULL from
load_data(), it retries the failing command *once*, in a new shell.

With the following patch, fixincl runs reliably on DU4.0d.  Ok to
install?

Index: gcc/ChangeLog
from  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
	
	* fixinc/server.c (load_data): Return NULL if the marker line is
	not found.
	(run_shell): If load_data returns NULL, retry the command once, in
	a new shell.
	
Index: gcc/fixinc/server.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/fixinc/server.c,v
retrieving revision 1.11
diff -u -r1.11 server.c
--- gcc/fixinc/server.c	1999/10/12 16:02:39	1.11
+++ gcc/fixinc/server.c	2000/02/09 08:14:28
@@ -114,6 +114,7 @@
   size_t text_size;
   char *pz_scan;
   char z_line[1024];
+  t_bool got_done = BOOL_FALSE;
 
   text_size = sizeof (z_line) * 2;
   pz_scan = pz_text = malloc (text_size);
@@ -131,7 +132,10 @@
         break;
 
       if (strncmp (z_line, z_done, sizeof (z_done) - 1) == 0)
-        break;
+	{
+	  got_done = BOOL_TRUE;
+	  break;
+	}
 
       strcpy (pz_scan, z_line);
       pz_scan += strlen (z_line);
@@ -157,7 +161,7 @@
     }
 
   alarm (0);
-  if (read_pipe_timeout)
+  if (read_pipe_timeout || ! got_done)
     {
       free ((void *) pz_text);
       return (char *) NULL;
@@ -255,6 +259,9 @@
 run_shell (pz_cmd)
      const char *pz_cmd;
 {
+  t_bool retry = BOOL_TRUE;
+
+ do_retry:
   /*  IF the shell server process is not running yet,
       THEN try to start it.  */
   if (server_id == NULLPROCESS)
@@ -299,9 +306,16 @@
     
     if (pz == (char *) NULL)
       {
+	close_server ();
+
+	if (retry)
+	  {
+	    retry = BOOL_FALSE;
+	    goto do_retry;
+	  }
+
         fprintf (stderr, "CLOSING SHELL SERVER - command failure:\n\t%s\n",
                  pz_cmd);
-        close_server ();
         pz = (char *) malloc (1);
         if (pz != (char *) NULL)
           *pz = '\0';

-- 
Alexandre Oliva http://www.ic.unicamp.br/~oliva/ IC-Unicamp, Bra[sz]il
aoliva@{{redhat, cygnus}.com, {acm, computer}.org}      Cygnus/Red Hat
oliva@{lsd.ic.unicamp.br, {gnu, kaffe, samba}.org, guarana.{org, com}}
** I may forward mail about projects to mailing lists; please use them

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]