On Fri, Nov 22, 2024 at 07:14:41PM +0000, Gavin Smith wrote:
> I also patch texi2any to add a line:
> 
>   Texinfo::Transformations::protect_first_parenthesis_in_targets($tree);
> 
> When I run
> 
> export top_srcdir=../../ top_builddir=.. TEXINFO_DEV_SOURCE=1
> ./texi2any -c TREE_TRANSFORMATIONS=protect_first_parenthesis test.texi
> 
> I get the same error:
> 
> texi2any: warning: unknown tree transformation protect_first_parenthesis
> Abort trap (core dumped) 
> 
> I'm now going to try to complile with debugging information to see
> if I can get any more information out of the core dump.

I can get the error with gdb.

$ gdb perl
...
(gdb) r ./texi2any test.texi
Starting program: /usr/bin/perl ./texi2any test.texi
(no debugging symbols found)
(no debugging symbols found)

Program received signal SIGABRT, Aborted.
thrkill () at /tmp/-:4
4       /tmp/-: No such file or directory.
        in /tmp/-
Current language:  auto; currently asm
(gdb) bt
#0  thrkill () at /tmp/-:4
#1  0x0000003e06613668 in _libc_raise (s=Unhandled dwarf expression opcode 0xa3
) at /usr/src/lib/libc/gen/raise.c:37
#2  0x0000003e06590000 in _libc_abort () at /usr/src/lib/libc/stdlib/abort.c:51
#3  0x0000003e0654c4c4 in memcpy (dst0=Variable "dst0" is not available.
)
    at /usr/src/lib/libc/string/memcpy.c:74
#4  0x0000003e7ce679cc in text_append_n (t=0x3dfb94b160, 
    s=0x3dfb9976e1 "some text) aa,,", len=15)
    at ../../../../tp/Texinfo/XS/main/text.c:72
#5  0x0000003e7ce678d0 in text_append (t=0x3dfb94b160, 
    s=0x3dfb9976e1 "some text) aa,,")
    at ../../../../tp/Texinfo/XS/main/text.c:81
#6  0x0000003e7ceee060 in protect_first_parenthesis (element=0x3dd4f05200)
    at ../../../../tp/Texinfo/XS/structuring_transfo/transformations.c:132
#7  0x0000003e7cef3410 in protect_first_parenthesis_in_targets_internal (
    type=0x3e7ce1f5f6 "content", current=0x3dd4f07690, argument=0x0)
    at ../../../../tp/Texinfo/XS/structuring_transfo/transformations.c:1519
#8  0x0000003e7ce7d7d4 in modify_tree (tree=0x3dd4f27600, 
    operation=0x3e7cef3338 <protect_first_parenthesis_in_targets_internal>, 
    argument=0x0) at ../../../../tp/Texinfo/XS/main/manipulate_tree.c:868
#9  0x0000003e7ce7d8b0 in modify_tree (tree=0x3dd4feed00, 
    operation=0x3e7cef3338 <protect_first_parenthesis_in_targets_internal>, 
    argument=0x0) at ../../../../tp/Texinfo/XS/main/manipulate_tree.c:880
#10 0x0000003e7cef34f0 in protect_first_parenthesis_in_targets (
    tree=0x3dd4feed00)
    at ../../../../tp/Texinfo/XS/structuring_transfo/transformations.c:1526
#11 0x0000003e820e9e0c in 
XS_Texinfo__StructTransfXS_protect_first_parenthesis_in_targets 
(cv=0x3e82399090) at StructuringTransfoXS.xs:377
#12 0x0000003dd5d125ec in Perl_pp_entersub () from /usr/lib/libperl.so.23.0
#13 0x0000003dd5d02b0c in Perl_runops_standard () from /usr/lib/libperl.so.23.0
#14 0x0000003dd5c20344 in perl_run () from /usr/lib/libperl.so.23.0
#15 0x0000000000000003 in ?? ()
warning: GDB can't find the start of the function at 0x3.

It could well be due to use of overlapping memory regions in the
call to memcpy(*), which is wrong: memmove should be used for this instead.
The call in 'protect_first_parenthesis' is as follows:

              text_append (content->e.text, p+1);

Earlier, p is initialised to point within the text buffer:

      p = content->e.text->text;

I am going to change the memcpy call to memmove and hopefully that will
be enough.

(*) I found the following page: 
https://github.com/radareorg/radare2/issues/8574#issuecomment-330820328



Reply via email to