Re: Texinfo-7.2.91 with mingw.org's MinGW: testing

Gavin Smith <[email protected]>
Newsgroups gmane.comp.tex.texinfo.bugs
Message-ID <aYh5-OHHs-HLPTE9@orangestar>
On Sun, Feb 08, 2026 at 12:45:26PM +0200, Eli Zaretskii wrote:
> > From: Gavin Smith <[email protected]>
> > Date: Fri, 6 Feb 2026 17:32:16 +0000
> > Cc: [email protected]
> > 
> > The next pretest distribution for the next Texinfo release (7.3) has been
> > uploaded to
> > 
> > https://alpha.gnu.org/gnu/texinfo/texinfo-7.2.91.tar.xz
> 
> Testing the MinGW build mostly succeeds, but there are some failures:
> 
>      FAIL: test_scripts/formatting_documentlanguage_cmdline.sh
>      FAIL: test_scripts/formatting_cpp_lines.sh
> 
>      FAIL: test_scripts/layout_formatting_fr.sh
>      FAIL: test_scripts/layout_formatting_fr_icons.sh
> 
>      FAIL: different_languages_gen_master_menu.sh
> 

All of these tests use @documentlanguage, and you did not report them
to fail for texinfo-7.2.90.  Hence, it is likely that the failure is
due to a change to @documentlanguage that took place since that pretest.

I remember that Patrice made changes to process accented characters in
the argument to @documentlanguage (this was an attempt to fix a bug
report, although as I remember, the actual bug was something else.)

So commit 4df3c1805 (2026-01-26) is suspect.  It is a rather large
commit, with 48 altered files.

2026-01-26 Patrice Dumas  <[email protected]>

	* tta/C/main/utils.c (encode_with_iconv, encode_string): replace the
	silent integer argument by a status argument, such that, if set, the
	function is silent and the information that there was an error in
	encoding is returned.

	* tta/C/convert/get_converter_perl_info.c
	(copy_sv_options_for_convert_text), tta/C/main/build_perl_info.c
	(build_convert_text_options), tta/C/main/convert_to_text.c
	(destroy_text_options, copy_options_for_convert_text),
	tta/C/main/convert_to_text.h (TEXT_OPTIONS),
	tta/perl/Texinfo/Convert/Text.pm (copy_options_for_convert_text): add
	COMMAND_LINE_ENCODING to text options.

	* tta/perl/Texinfo/Convert/Text.pm (_convert),
	tta/perl/Texinfo/Convert/Utils.pm (switch_lang_translations)
	(definition_category_tree), tta/perl/Texinfo/Transformations.pm
	(complete_tree_nodes_menus_in_document, regenerate_master_menu),
	tta/perl/Texinfo/Translations.pm (new_lang_translation): add
	new_lang_translation in Perl too, and use it to initialize lang
	translations arrays.  In addition to hiding to some extent the
	implementation details, it allows to mark in the code where the
	lang translations are initialized.

	* tta/C/convert/build_html_perl_state.c
	(switch_perl_lang_translations, build_html_translated_names),
	tta/C/main/convert_utils.c (definition_category_tree),
	tta/C/main/translations.c (new_lang_translation, get_lang_translation),
	tta/C/main/tree_types.h (LANG_TRANSLATION), tta/C/parsetexi/indices.c
	(complete_indices), tta/C/tree_elements/get_perl_tree_elements.c
	(get_lang_translations_sv), tta/perl/Texinfo/Convert/Utils.pm
	(switch_lang_translations, definition_category_tree),
	tta/perl/Texinfo/Translations.pm (translate_string)
	(cache_translate_string, complete_indices): pass COMMAND_LINE_ENCODING
	trought to new_lang_translation.  In new_lang_translation encode lang
	and pass it in lang translations objects.  Use the encoded lang in
	translate_string to set environment varibles, as should be.

	* tta/tests/Makefile.onetst, tta/tests/other/Makefile.am (EXTRA_DIST),
	tta/tests/other/list-of-tests
	(accented_lang_index_collation_documentlanguage_collation),
	tta/tests/other/accented_lang_index_collation.texi: new test of
	DOCUMENTLANGUAGE_COLLATION set with @documentlanguage with non-ascii
	non-latin1 characters.


I have looked through the patch although have a limited understanding of
what it does.  The following chunk looks suspect:

--- a/tta/C/convert/build_html_perl_state.c
+++ b/tta/C/convert/build_html_perl_state.c
@@ -158,7 +165,30 @@ build_html_translated_names (HV *converter_hv, CONVERTER *converter)
                 strlen ("documentlanguage"), documentlanguage_sv, 0);
     }
 
-  switch_perl_lang_translations (converter_hv, documentlanguage);
+  if (documentlanguage)
+    {
+      if (command_line_encoding)
+        {
+          int status;
+          int iconv_status = 0;
+
+          /* cast to drop const */
+          encoded_lang = encode_string ((char *)documentlanguage,
+                                        command_line_encoding,
+                                        &status, 0, &iconv_status);
+          if (!iconv_status)
+            {
+              free (encoded_lang);
+              encoded_lang = strdup (documentlanguage);
+            }
+        }
+      else
+        encoded_lang = strdup (documentlanguage);
+    }
+  switch_perl_lang_translations (converter_hv, documentlanguage,
+                                 encoded_lang);
+
+  free (encoded_lang);
 


'encode_string' is in C/main/utils.c, which does not include the Perl
headers.  Hence its return value should be allocated with the default
libc allocator.  However, it is passed to 'free' in build_html_perl_state.c,
which is a file which does include the Perl headers, and hence this
will likely be a version of 'free' that uses the Perl allocator.

So the first change I would try making would be the following:

diff --git a/tta/C/convert/build_html_perl_state.c b/tta/C/convert/build_html_perl_state.c
index ccc7663c50..b61df218a9 100644
--- a/tta/C/convert/build_html_perl_state.c
+++ b/tta/C/convert/build_html_perl_state.c
@@ -184,7 +184,7 @@ build_html_translated_names (HV *converter_hv, CONVERTER *converter)
                                         &status, 0, &iconv_status);
           if (!iconv_status)
             {
-              free (encoded_lang);
+              non_perl_free (encoded_lang);
               encoded_lang = strdup (documentlanguage);
             }
         }
@@ -194,7 +194,7 @@ build_html_translated_names (HV *converter_hv, CONVERTER *converter)
   switch_perl_lang_translations (converter_hv, documentlanguage,
                                  encoded_lang);
 
-  free (encoded_lang);
+  non_perl_free (encoded_lang);
 
   /* pass all the information for each context for translated commands */
   if (converter->no_arg_formatted_cmd_translated.number)

If that doesn't work, hopefully Patrice will have a better idea.



> All of them seem to be caused by the same problem with memory
> allocation, the log/output files all have an error message like this:
> 
>   Free to wrong pool 132cd60 not 8d019700 at ./..//perl/texi2any.pl line 2154.
> 
> This means memory allocated via Perl is freed by a direct call to
> 'free', or the other way around: memory allocated by a direct call to
> malloc is freed via Perl.
> 
> All of the error messages point to the same line 2154 in texi2any.pl.
> 
> Let me know if I can provide more information to help debug this.
> 
> All the other tests in all the other directories all succeed.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.