On Sat, May 25, 2019 at 09:53:26PM +0200, Otto Moerbeek wrote:

> On Sat, May 25, 2019 at 10:45:48AM -0500, athom...@athompso.net wrote:
> 
> > >Synopsis:  makeinfo dumps core on amdref.info when outputting docbook
> > >Category:  user
> > >Environment:
> >     ***also tested on 6.5-STABLE, same problem occurs there***
> >     System      : OpenBSD 6.4
> >     Details     : OpenBSD 6.4 (GENERIC) #6: Sat Jan 26 19:51:53 CET 2019
> >                      
> > r...@syspatch-64-amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC
> > 
> >     Architecture: OpenBSD.amd64
> >     Machine     : amd64
> > >Description:
> >     When using makeinfo(1) to convert a Texinfo file to Docbook, instead of
> >     performing the conversion, makeinfo dumps core instead.
> >     Error shown here with debugger attached:
> > 
> >     (gdb) run
> >     Starting program: /usr/bin/makeinfo -v --force --docbook amdref.texinfo
> >     (no debugging symbols found)
> >     makeinfo (GNU texinfo) 4.8
> >     Making XML file `/home/athompso/amdref.xml' from `amdref.texinfo'.
> > 
> >     Program received signal SIGSEGV, Segmentation fault.
> >     0x000010db1bc010eb in cm_no_op () from /usr/bin/makeinfo
> >     Current language:  auto; currently minimal
> > 
> > >How-To-Repeat:
> >     Run "makeinfo --docbook" on amdref.texinfo from 
> > /usr/src/usr.sbin/amd/doc/amdref.texinfo.
> >     Crashes every time, pretty much instantly, leaving amdref.xml as a 
> > 0-byte file.
> > >Fix:
> >     No known fix.
> > 
> > 
[dmesg snip]
> 
> Try this.
> 
>       -Otto

This works indeed. I'd rather ditch techinfo from base, but i guess
that is not feasible yet.

So ok?

        -Otto

> 
> Index: makeinfo/cmds.c
> ===================================================================
> RCS file: /cvs/src/gnu/usr.bin/texinfo/makeinfo/cmds.c,v
> retrieving revision 1.3
> diff -u -p -r1.3 cmds.c
> --- makeinfo/cmds.c   17 Jul 2006 16:12:36 -0000      1.3
> +++ makeinfo/cmds.c   25 May 2019 19:52:47 -0000
> @@ -624,6 +624,7 @@ cm_comment (void)
>            /* Use insert for HTML, and XML when indentation is enabled.
>               For Docbook, use add_char.  */
>            if (xml && xml_indentation_increment > 0
> +              && output_paragraph_offset > 0
>                && output_paragraph[output_paragraph_offset-1] != '\n')
>              insert ('\n');
>  
> Index: makeinfo/xml.c
> ===================================================================
> RCS file: /cvs/src/gnu/usr.bin/texinfo/makeinfo/xml.c,v
> retrieving revision 1.2
> diff -u -p -r1.2 xml.c
> --- makeinfo/xml.c    8 Oct 2008 07:09:37 -0000       1.2
> +++ makeinfo/xml.c    25 May 2019 19:52:47 -0000
> @@ -1845,7 +1845,8 @@ xml_begin_index (void)
>        if (xml_index_titles)
>          {
>            /* Remove the final > */
> -          output_paragraph_offset--;
> +          if (output_paragraph_offset)
> +         output_paragraph_offset--;
>            /* and put  ID="node-name"><TITLE>Title</TITLE> */
>            insert_string (xml_index_titles->title);
>            free (xml_index_titles->title);
> 

Reply via email to