bug-texinfo
[Top][All Lists]
Advanced

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

Re: texi2dvi 1.10 (4.3) segfault


From: Karl Berry
Subject: Re: texi2dvi 1.10 (4.3) segfault
Date: Tue, 18 Feb 2003 09:57:36 -0500

Thanks for the report.  Here's a patch to texi2dvi that I think will
stop it from thinking gforth.ds is an index file, and a patch to
texindex to make it not segfault if it does happen to be called on it.

Let me know if troubles persist ...

k


*** texi2dvi.~1.14.~    Tue Feb  4 16:42:33 2003
--- texi2dvi    Tue Feb 18 06:26:30 2003
***************
*** 273,282 ****
    # If file is empty, skip it.
    test -s "$this_file" || continue
    # If the file is not suitable to be an index or xref file, don't
!   # process it.  The file can't be if its first character is not a
!   # backslash or single quote.
    first_character=`sed -n '1s/^\(.\).*$/\1/p;q' $this_file`
!   if test "x$first_character" = "x\\" \
       || test "x$first_character" = "x'"; then
      xref_files="$xref_files ./$this_file"
    fi
--- 273,284 ----
    # If file is empty, skip it.
    test -s "$this_file" || continue
    # If the file is not suitable to be an index or xref file, don't
!   # process it.  It's suitable if the first character is a
!   # backslash or right quote, as long as the first line isn't
!   # \input texinfo.
    first_character=`sed -n '1s/^\(.\).*$/\1/p;q' $this_file`
!   if (test "x$first_character" = "x\\" \
!       && sed 1q $this_file | grep -v '^\\input *texinfo' >/dev/null) \
       || test "x$first_character" = "x'"; then
      xref_files="$xref_files ./$this_file"
    fi
*** texindex.c.~1.7.~   Sun Jan 19 10:47:15 2003
--- texindex.c  Tue Feb 18 06:44:33 2003
***************
*** 218,226 ****
  
        outfile = outfiles[i];
        if (!outfile)
!         {
!           outfile = concat (infiles[i], "s", "");
!         }
  
        need_initials = 0;
        first_initial = '\0';
--- 218,224 ----
  
        outfile = outfiles[i];
        if (!outfile)
!         outfile = concat (infiles[i], "s");
  
        need_initials = 0;
        first_initial = '\0';
***************
*** 322,328 ****
    if (tempdir == NULL)
      tempdir = DEFAULT_TMPDIR;
    else
!     tempdir = concat (tempdir, "/", "");
  
    keep_tempfiles = 0;
  
--- 320,326 ----
    if (tempdir == NULL)
      tempdir = DEFAULT_TMPDIR;
    else
!     tempdir = concat (tempdir, "/");
  
    keep_tempfiles = 0;
  
***************
*** 401,410 ****
    if (!tempbase)
      {
        int fd;
!       char *tmpdir = getenv ("TEMPDIR");
!       if (!tmpdir)
!         tmpdir = "/tmp";
!       tempbase = concat (tmpdir, "/txidxXXXXXX");
  
        fd = mkstemp (tempbase);
        if (fd == -1) 
--- 399,405 ----
    if (!tempbase)
      {
        int fd;
!       tempbase = concat (tempdir, "txidxXXXXXX");
  
        fd = mkstemp (tempbase);
        if (fd == -1) 
***************
*** 412,418 ****
      }
  
    sprintf (tempsuffix, ".%d", count);
!   return concat (tempdir, tempbase, tempsuffix);
  }
  
  
--- 407,413 ----
      }
  
    sprintf (tempsuffix, ".%d", count);
!   return concat (tempbase, tempsuffix);
  }
  
  
***************
*** 1653,1691 ****
  perror_with_name (name)
       char *name;
  {
!   char *s;
! 
!   s = strerror (errno);
!   printf ("%s: ", program_name);
!   printf ("%s; for file `%s'.\n", s, name);
  }
  
  void
  pfatal_with_name (name)
       char *name;
  {
!   char *s;
! 
!   s = strerror (errno);
!   printf ("%s: ", program_name);
!   printf (_("%s; for file `%s'.\n"), s, name);
    xexit (1);
  }
  
! /* Return a newly-allocated string whose contents concatenate those of
!    S1, S2, S3.  */
  
  char *
! concat (s1, s2, s3)
!      char *s1, *s2, *s3;
  {
!   int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
!   char *result = (char *) xmalloc (len1 + len2 + len3 + 1);
  
    strcpy (result, s1);
    strcpy (result + len1, s2);
!   strcpy (result + len1 + len2, s3);
!   *(result + len1 + len2 + len3) = 0;
  
    return result;
  }
--- 1648,1678 ----
  perror_with_name (name)
       char *name;
  {
!   fprintf (stderr, "%s: ", program_name);
!   perror (name);
  }
  
  void
  pfatal_with_name (name)
       char *name;
  {
!   perror_with_name (name);
    xexit (1);
  }
  
! 
! /* Return a newly-allocated string concatenating S1 and S2.  */
  
  char *
! concat (s1, s2)
!      char *s1, *s2;
  {
!   int len1 = strlen (s1), len2 = strlen (s2);
!   char *result = (char *) xmalloc (len1 + len2 + 1);
  
    strcpy (result, s1);
    strcpy (result + len1, s2);
!   *(result + len1 + len2) = 0;
  
    return result;
  }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]