pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/35292: devel/gtexinfo fails to build on Irix with MIPSPro



>Number:         35292
>Category:       pkg
>Synopsis:       devel/gtexinfo fails to build on Irix with MIPSPro
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 20 10:00:01 +0000 2006
>Originator:     Francois Brunel
>Release:        pkgsrc-2006Q3
>Organization:
>Environment:
IP30
Irix 6.5.30
MIPSPro 7.4.1m
ABI=32
>Description:
Compiler error on pointer assignment, which seems to be a real bug in
util/texindex.c: when reallocating a buffer the buffer size is
incorrectly updated.

>How-To-Repeat:

>Fix:
-----------------
patches/patch-al
-----------------

--- util/texindex.c.orig        2004-04-11 19:56:47.000000000 +0200
+++ util/texindex.c
@@ -387,14 +387,15 @@ For more information about these matters
 /* Return a name for temporary file COUNT. */
 
 static char *
-maketempname (int count)
+maketempname (int count, int can_exist)
 {
   static char *tempbase = NULL;
+  char *tempname;
   char tempsuffix[10];
+  int fd;
 
   if (!tempbase)
     {
-      int fd;
       tempbase = concat (tempdir, "txidxXXXXXX");
 
       fd = mkstemp (tempbase);
@@ -403,7 +404,14 @@ maketempname (int count)
     }
 
   sprintf (tempsuffix, ".%d", count);
-  return concat (tempbase, tempsuffix);
+  tempname = concat (tempbase, tempsuffix);
+  if (!can_exist) {
+    fd = open (tempname, O_CREAT|O_EXCL|O_WRONLY, 0600);
+    if (fd == -1)
+      pfatal_with_name (tempname);
+    close (fd);
+  }
+  return tempname;
 }
 
 
@@ -415,7 +423,7 @@ flush_tempfiles (int to_count)
   if (keep_tempfiles)
     return;
   while (last_deleted_tempcount < to_count)
-    unlink (maketempname (++last_deleted_tempcount));
+    unlink (maketempname (++last_deleted_tempcount, 1));
 }
 
 
@@ -837,7 +845,7 @@ readline (struct linebuffer *linebuffer,
         {
           buffer = (char *) xrealloc (buffer, linebuffer->size *= 2);
           p += buffer - linebuffer->buffer;
-          end += buffer - linebuffer->buffer;
+          end = buffer + linebuffer->size;
           linebuffer->buffer = buffer;
         }
       if (c < 0 || c == '\n')
@@ -882,7 +890,7 @@ sort_offline (char *infile, off_t total,
 
   for (i = 0; i < ntemps; i++)
     {
-      char *outname = maketempname (++tempcount);
+      char *outname = maketempname (++tempcount, 0);
       FILE *ostream = fopen (outname, "w");
       long tempsize = 0;
 
@@ -930,7 +938,7 @@ fail:
 
   for (i = 0; i < ntemps; i++)
     {
-      char *newtemp = maketempname (++tempcount);
+      char *newtemp = maketempname (++tempcount, 0);
       sort_in_core (tempfiles[i], MAX_IN_CORE_SORT, newtemp);
       if (!keep_tempfiles)
         unlink (tempfiles[i]);
@@ -1400,7 +1408,7 @@ merge_files (char **infiles, int nfiles,
       int nf = MAX_DIRECT_MERGE;
       if (i + 1 == ntemps)
         nf = nfiles - i * MAX_DIRECT_MERGE;
-      tempfiles[i] = maketempname (++tempcount);
+      tempfiles[i] = maketempname (++tempcount, 0);
       value |= merge_direct (&infiles[i * MAX_DIRECT_MERGE], nf, tempfiles[i]);
     }
 




Home | Main Index | Thread Index | Old Index