bug-texinfo
[Top][All Lists]
Advanced

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

Re: Duplicate variable use in Texinfo/ManipulateTree.pm


From: Gavin Smith
Subject: Re: Duplicate variable use in Texinfo/ManipulateTree.pm
Date: Thu, 5 Jun 2025 17:03:38 +0100

On Thu, Jun 05, 2025 at 01:07:51AM +0200, Patrice Dumas wrote:
> On Wed, Jun 04, 2025 at 09:37:20PM +0100, Gavin Smith wrote:
> > When I run the texi2any test suite with TEXINFO_XS=omit, there is
> > a warning printed:
> > 
> > "my" variable $current_nr masks earlier declaration in same scope at 
> > t//../../perl/Texinfo/ManipulateTree.pm line 839.
> > 
> > This is presumably a bug.  Here is the relevant part of the code:
> > 
> > 
> > sub print_element_details($$$$;$$)
> > {
> >   my $element = shift;
> >   my $level = shift;
> >   my $prepended = shift;
> >   my $current_nr = shift;
> >   my $fname_encoding = shift;
> >   my $use_filename = shift;
> > 
> >   my ($current_nr, $result)
> >       = print_element_base($element, $level, $prepended,
> >                            $fname_encoding, $use_filename);
> 
> This should be fixed as well as another bug for the tests that I missed
> completly.

The tests pass with TEXINFO_XS=omit but not with TEXINFO_XS_STRUCTURE=0.

FAIL: t/22xtable.t 158 - item_index_transformation tree
FAIL: t/22xtable.t 167 - item_index_transformation texi
FAIL: t/22xtable.t 168 - item_index_transformation text
FAIL: t/22xtable.t 169 - item_index_transformation converted plaintext
FAIL: t/22xtable.t 171 - item_index_transformation converted html_text
FAIL: t/22xtable.t 173 - item_index_transformation converted xml
FAIL: t/22xtable.t 175 - item_index_transformation converted docbook
FAIL: t/converters_tests.t 1527 - 
indices_in_begin_tables_lists_entries_after_item tree
FAIL: t/converters_tests.t 1536 - 
indices_in_begin_tables_lists_entries_after_item texi
FAIL: t/converters_tests.t 1537 - 
indices_in_begin_tables_lists_entries_after_item text
FAIL: t/converters_tests.t 1538 - 
indices_in_begin_tables_lists_entries_after_item converted file_html
FAIL: t/converters_tests.t 1540 - 
indices_in_begin_tables_lists_entries_after_item converted file_info
FAIL: t/converters_tests.t 1542 - 
indices_in_begin_tables_lists_entries_after_item converted file_xml
FAIL: t/converters_tests.t 1544 - 
indices_in_begin_tables_lists_entries_after_item converted file_docbook
FAIL: t/converters_tests.t 1546 - 
indices_in_begin_tables_lists_entries_after_item converted file_latex
FAIL: t/z_misc/index_before_item.t 2 - entries before items
FAIL: t/z_misc/index_before_item.t 3 - in example
FAIL: t/z_misc/index_before_item.t 4 - empty_items
FAIL: t/z_misc/index_before_item.t 5 - only comments and index entries in items
FAIL: t/z_misc/index_before_item.t 7 - subentry

Here is an example of one of the test differences:

$ TEXINFO_XS_STRUCTURE=0 perl -w t/22xtable.t item_index_transformation -g
$ git diff t | head -n 40

diff --git a/tta/perl/t/results/xtable/item_index_transformation.pl 
b/tta/perl/t/results/xtable/item_index_transformation.pl
index c4d1196bd8..a8f275de28 100644
--- a/tta/perl/t/results/xtable/item_index_transformation.pl
+++ b/tta/perl/t/results/xtable/item_index_transformation.pl
@@ -116,9 +116,75 @@ $result_tree_text{'item_index_transformation'} = 
'*document_root C3
       |spaces_after_argument:
        |{spaces_after_argument:\\n}
        {oney}
-    *table_definition C1
-     *paragraph C1
-      {AAA\\n}
+    *table_term C6
+     *index_entry_command@cindex C1 l9
+     |INFO
+     |command_name:{cindex}
+     |spaces_before_argument:
+      |{spaces_before_argument: }
+     |EXTRA
+     |element_node:{chap}
+     |index_entry:I{cp,2}
+      *line_arg C1
+      |INFO
+      |spaces_after_argument:
+       |{spaces_after_argument:\\n}
+       {After1}
+     *index_entry_command@cindex C1 l10
+     |INFO
+     |command_name:{cindex}
+     |spaces_before_argument:
+      |{spaces_before_argument: }
+     |EXTRA
+     |element_node:{chap}
+     |index_entry:I{cp,3}
+      *line_arg C1
+      |INFO
+      |spaces_after_argument:
+       |{spaces_after_argument:\\n}
+       {After2}
+     *index_entry_command@cindex C1 l5
+     |INFO

Later in the diff is:

@@ -427,7 +590,12 @@ $result_texis{'item_index_transformation'} = '@node chap
 @item one
 @itemx onex
 @itemx oney
-AAA
+@cindex After1
+@cindex After2
+@cindex Before1
+@item one
+@itemx onex
+@itemx oney
 @item two
 BBB
 @end table

I think this is clearly wrong output.



reply via email to

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