You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use Storable:from<Perl5> <store retrieve>;
my$a= { a =>1, b =>2, c =>3 } ;
store($a, 'foo.store');
say retrieve('foo.store').raku
The retrieve causes a segfault.
It seems this is in the p5_unwrap_p6_hash :
Thread 1 "rakudo-m" received signal SIGSEGV, Segmentation fault.
p5_unwrap_p6_hash (my_perl=<optimized out>, obj=<optimized out>) at /home/jonathan/.zef/tmp/Inline%3A%3APerl5%3Aver%3C0.60%3E%3Aauth%3Ccpan%3ANINE%3E.tar.gz/Inline-Perl5-0.60/p5helper.c:298
298 return ((_perl6_hash_magic*)(mg->mg_ptr))->index;
(gdb) bt
#0 p5_unwrap_p6_hash (my_perl=<optimized out>, obj=<optimized out>)
at /home/jonathan/.zef/tmp/Inline%3A%3APerl5%3Aver%3C0.60%3E%3Aauth%3Ccpan%3ANINE%3E.tar.gz/Inline-Perl5-0.60/p5helper.c:298
#1 0x00007ffff7965de2 in dcCall_x64_sysv () from //usr/local/lib/libmoar.so
#2 0x0000026144030080 in ?? ()
#3 0x00007fffffffce00 in ?? ()
#4 0x00007ffff7965c1c in dc_callvm_call_x64 () from //usr/local/lib/libmoar.so
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb) print mg
$1 = (MAGIC * const) 0x0
Which seems to be that the
MAGIC * const mg = mg_find(SvRV(p6hashobj), '~');
Can set mg to 0 without a check.
This may or may not be related to the Perl program:
use Storable qw(retrieve);
use Data::Dump qw(pp);
my$f = retrieve('foo.store');
print pp($f);
(using the Storable file generated above,) blowing up with:
Cannot restore overloading on SCALAR(0x561bc28b4518) (package Perl6::Object) (even after a "require Perl6::Object;") at /usr/lib64/perl5/vendor_perl/Storable.pm line 421, at p5-retrieve-hash line 7.
(which seems to indicate that the storable is storing something whacky in the file, but I 'm not sure whether Storable should even be expected to deal with this properly, so that's a different story.)
FWIW doing the reverse with a hash created in Perl:
use Storable:from<Perl5> <retrieve>;
say retrieve('foo.store').raku
Works fine.
It's only the segfault that is the problem, the rest might be expected given that Storable is being asked to do something it wasn't made for.
BTW, if anyone is interested, this roundtrip can be made to work if one de-references the Hash from raku in Perl space (thus losing the thing that Storable doesn't like about the reference,) before storing it:
use Inline::Perl5;
use Storable:from<Perl5> <store retrieve>;
my$p5= Inline::Perl5.new;
my$a= { a =>1, b =>2, c =>3 } ;
$p5.run(q:to/P5/);
use Storable qw(store); sub my_store { my ( $ref, $f ) = @_; my %a = %$ref; store(\%a, $f); }P5$p5.call('my_store', $a, 'foo.store');
say retrieve('foo.store').raku
The text was updated successfully, but these errors were encountered:
By way of experiment I tried:
The
retrieve
causes a segfault.It seems this is in the
p5_unwrap_p6_hash
:Which seems to be that the
Can set
mg
to 0 without a check.This may or may not be related to the Perl program:
(using the Storable file generated above,) blowing up with:
(which seems to indicate that the storable is storing something whacky in the file, but I 'm not sure whether Storable should even be expected to deal with this properly, so that's a different story.)
FWIW doing the reverse with a hash created in Perl:
and loading in Raku:
Works fine.
It's only the segfault that is the problem, the rest might be expected given that Storable is being asked to do something it wasn't made for.
BTW, if anyone is interested, this roundtrip can be made to work if one de-references the Hash from raku in Perl space (thus losing the thing that Storable doesn't like about the reference,) before storing it:
The text was updated successfully, but these errors were encountered: