Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 220415 - segfault in install-info (sys-apps/texinfo)
Summary: segfault in install-info (sys-apps/texinfo)
Status: RESOLVED DUPLICATE of bug 220695
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-05 17:15 UTC by Sebastian Glita
Modified: 2008-09-15 07:09 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Glita 2008-05-05 17:15:30 UTC
gives this often:

 * Regenerating GNU info directory index...
 * Processed 268 info files; 1 errors.
sh: line 1: 12545 Segmentation fault      LANG=C LANGUAGE=C /usr/bin/install-info --dir-file=/usr/share/info/dir /usr/share/info/x-symbol.info.bz2

line 1 of what :[ ?
Comment 1 Zac Medico gentoo-dev 2008-05-05 22:03:22 UTC
You can check the output of dmesg to see which program is generating the 'Segmentation fault'. Maybe you can just rebuild that program.
Comment 2 Sebastian Glita 2008-05-06 12:37:53 UTC
(In reply to comment #1)
> You can check the output of dmesg to see which program is generating the
> 'Segmentation fault'. Maybe you can just rebuild that program.

OK, right: it is /usr/bin/install-info with arguments "--dir-file=/usr/share/info/dir /usr/share/info/x-symbol.info.bz2"

This the log:
May  6 11:35:39 localhost install-info[17920]: segfault at 0 ip b7ffe14b sp bf8f2170 error 4 in libc-2.7.so[b7f92000+128000]

Apparently, there is a string in "x-symbol" which does not contain the '.' (dot) character.

install-info.c:1545 calls `split_entry';
install-info.c:1453 calls `strchr' for '.' and does not find it; ptr == 0;
still `entry' is "* X-Symbol::      Semi WYSIWYG for LaTeX, HTML and other \"token languages\"\n", so its length is not zero; "install-info.c" gets pass the 1459 line number. So that `strdup' gets a NULL pointer to duplicate.

Here is what gdb looks like (for those arguments above):

(gdb) p entry->text
$4 = 0x806be28 "* X-Symbol::      Semi WYSIWYG for LaTeX, HTML and other \"token languages\"\n"
(gdb) p name
$5 = 0x0
(gdb) do
#1  0x0804b3fd in split_entry (
    entry=0x806be28 "* X-Symbol::      Semi WYSIWYG for LaTeX, HTML and other \"token languages\"\n", 
    name=0xbff096d4, name_len=0xbff096cc, description=0xbff096d0, description_len=0xbff096c8)
    at install-info.c:1460
1460          *name = strdup (ptr);
(gdb) p entry
$6 = 0x806be28 "* X-Symbol::      Semi WYSIWYG for LaTeX, HTML and other \"token languages\"\n"
(gdb) p entry
$7 = 0x806be28 "* X-Symbol::      Semi WYSIWYG for LaTeX, HTML and other \"token languages\"\n"
(gdb) p ptr
$8 = 0x0
(gdb) do
#9  0xb7f1514b in strdup () from /lib/libc.so.6
(gdb) do
Bottom (innermost) frame selected; you cannot go down.

There are two places in x-symbol.texi where that string occurs:

one is

@direntry
* X-Symbol::      Semi WYSIWYG for LaTeX, HTML and other "token languages"
@end direntry

and

@smallexample
* X-Symbol::     Semi WYSIWYG for LaTeX, HTML and other "token languages"
@end smallexample

what is texinfo's behaviour on these?
Comment 3 Sebastian Glita 2008-05-06 16:58:48 UTC
Bug https://bugs.gentoo.org/show_bug.cgi?id=199220 causing it fixed.
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2008-05-06 18:58:21 UTC
OK, so summarising, texinfo has a problem with a file that some package outside the official tree, namely app-emacs/x-symbol of bug #199220, is causing. Then some new ebuild attachment to said bug apparently fixes the problem.

*** This bug has been marked as a duplicate of bug 199220 ***
Comment 5 SpanKY gentoo-dev 2008-05-10 09:16:52 UTC
texinfo should not segfault regardless of the crappy input handed to it

i'm not an info or emacs guy, so can someone please post a file and an example of how to crash texinfo with it
Comment 6 Sebastian Glita 2008-05-10 15:05:25 UTC
(In reply to comment #5)
> can someone please post a file and an example
> of how to crash texinfo with it

This is an excerpt from x-symbol-4.51-src/man/x-symbol.texi:
<<<
@dircategory Editors
@direntry
* X-Symbol::      Semi WYSIWYG for LaTeX, HTML and other "token languages"
@end direntry
>>>
You can see it is tolerant with ending dot; more or less about it: http://www.gnu.org/software/texinfo/manual/texinfo/html_node/Installing-Dir-Entries.html#Installing-Dir-Entries

And here is the buggy code from texinfo-4.12/install-info/install-info.c#1444:
<<<
/* Extract the NAME and DESCRIPTION from ENTRY.  NAME and DESCRIPTION must be
   free'd.
 */
static void
split_entry (char *entry, char **name, size_t *name_len, char **description, size_t *description_len)
{
  char *endptr;

  /* on the first line, the description starts after the first period. */
  char *ptr = strchr (entry, '.');
  /* Maybe there's no period, and no description */
  if (!ptr)
    {
      size_t length = strlen (entry);
      if (length == 0)
        return;
      *name = strdup (ptr);
      *name_len = length + 1;
      return;
    }
>>>

My guess the line 1460 should be:
>>>
      *name = strdup (entry);
<<<

since passing over to lines #1465-#1469:
>>>
  /* The name is everything up to and including the period. */
  *name_len = (size_t) (ptr - entry + 1);
  *name = xmalloc (*name_len + 1);
  (*name)[0] = '\0';
  strncat (*name, entry, *name_len);
<<<
especially in line #1469, `name' is copied from `entry' also.
Comment 7 Ulrich Müller gentoo-dev 2008-09-15 07:09:16 UTC
Not the same symptoms, but this is a duplicate of bug 220695.

(In reply to comment #6)
> My guess the line 1460 should be:
> >>>
>       *name = strdup (entry);
> <<<

This is fixed in CVS upstream:
<http://cvs.savannah.gnu.org/viewvc/texinfo/texinfo/install-info/install-info.c?r1=1.10&r2=1.11>


*** This bug has been marked as a duplicate of bug 220695 ***