bug-texinfo
[Top][All Lists]
Advanced

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

texi2any aborts with empty @image argument


From: Gavin Smith
Subject: texi2any aborts with empty @image argument
Date: Tue, 8 Nov 2022 16:58:39 +0000

On Tue, Nov 08, 2022 at 11:30:30AM +0000, Werner LEMBERG wrote:
> 
> * Unpack the attached tarball and execute
> 
>   ```
>   LANG=C makeinfo changes.texi
>   ```
> 
>   It aborts with
> 
>   ```
>   Can't use an undefined value as an ARRAY reference at 
>   /usr/local/share/texinfo/Texinfo/Convert/Info.pm line 545.
>   ```
> 
>   returning error code 84.  This is a severe regression: My system
>   comes with `texi2any` version 6.5, which processes the input file
>   just fine.

It breaks with just the input

\input texinfo

@node Test Node
@chapter Test

foo

@image{lilypond/04/lily-2c932558,,,[image of music],}


@bye


The code that breaks is the following:

    if (defined($element->{'args'}->[4])
        and @{$element->{'args'}->[4]->{'contents'}}) {

The parse tree has for the @image command:

           {
              'cmdname' => 'image',
              'parent' => {},
              'source_info' => {
                'line_nr' => 8,
                'macro' => '',
                'file_name' => 'test.texi'
              },
              'args' => [
                {
                  'type' => 'brace_command_arg',
                  'contents' => [
                    {
                      'parent' => {},
                      'text' => 'lilypond/04/lily-2c932558'
                    }
                  ],
                  'parent' => {}
                },
                {
                  'type' => 'brace_command_arg',
                  'parent' => {}
                },
                {
                  'type' => 'brace_command_arg',
                  'parent' => {}
                },
                {
                  'type' => 'brace_command_arg',
                  'parent' => {},
                  'contents' => [
                    {
                      'parent' => {},
                      'text' => '[image of music]'
                    }
                  ]
                },
                {
                  'parent' => {},
                  'type' => 'brace_command_arg'
                }
              ],
              'extra' => {
                'input_perl_encoding' => 'utf-8'
              }
            },


I suspect this is related to the following change:

2022-09-17  Patrice Dumas  <pertusus@free.fr>

        ...

        * tp/Texinfo/XS/parsetexi/api.c (element_to_perl_hash): do not
        set 'contents' if empty.

I suspect at one time the contents should have been set to an empty
array, so that the code would have worked.  It would be easy
to add an extra check for the contents being defined, but I wonder
how much other code there is like this that could break.

Patrice, would you be able to look at this?




reply via email to

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