Skip Menu |

This queue is for tickets about the Clone CPAN distribution.

Report information
The Basics
Id: 86217
Status: resolved
Priority: 0/
Queue: Clone

People
Owner: garu [...] cpan.org
Requestors: SLAFFAN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: segfault when cloning after parse()
Perl segfaults when cloning a Text::CSV_XS object after running parse(). Code to reproduce on my system is below. System: Strawberry Perl x64 5.16.3 and x32 5.16.1 Text::CSV_XS versions 0.98, 0.99, 1.01 (did not test with 1.00) Clone version 0.34 It also occurs with YAML::Syck::Dump, but I have not included that in the code below. It does not occur with Text::CSV_XS 0.91 if I remember correctly. Regards, Shawn. #!/usr/bin/perl -w use 5.010; use strict; use warnings; use Text::CSV_XS; use Clone; $| = 1; say 'Using Text::CSV_XS version ' . Text::CSV_XS->version; say 'Using Clone version ' . $Clone::VERSION; my $csv = Text::CSV_XS->new ({sep_char => ','}); say 'Cloning...'; my $clone1 = eval { Clone::clone $csv }; say 'Cloned before parsing'; $csv->parse ('a,b'); say 'Ran $csv->parse.'; say 'Cloning...'; my $clone2 = eval { Clone::clone $csv }; say 'Cloned after parsing';
This is just an update on platforms. I can reproduce this on perlbrew 5.16.3 (x86_64-linux, under Ubuntu). Script output is: Using Text::CSV_XS version 1.01 Using Clone version 0.34 Cloning... Cloned before parsing Ran $csv->parse. Cloning... Segmentation fault (core dumped) Regards, Shawn. On Mon Jun 17 21:03:27 2013, SLAFFAN wrote: Show quoted text
> Perl segfaults when cloning a Text::CSV_XS object after running > parse(). Code to reproduce on my system is below. > > System: > Strawberry Perl x64 5.16.3 and x32 5.16.1 > Text::CSV_XS versions 0.98, 0.99, 1.01 (did not test with 1.00) > Clone version 0.34 > > It also occurs with YAML::Syck::Dump, but I have not included that in > the code below. > > It does not occur with Text::CSV_XS 0.91 if I remember correctly. > > Regards, > Shawn. > > > > #!/usr/bin/perl -w > use 5.010; > use strict; > use warnings; > > use Text::CSV_XS; > use Clone; > > $| = 1; > > say 'Using Text::CSV_XS version ' . Text::CSV_XS->version; > say 'Using Clone version ' . $Clone::VERSION; > > my $csv = Text::CSV_XS->new ({sep_char => ','}); > > say 'Cloning...'; > my $clone1 = eval { Clone::clone $csv }; > say 'Cloned before parsing'; > > $csv->parse ('a,b'); > say 'Ran $csv->parse.'; > > say 'Cloning...'; > my $clone2 = eval { Clone::clone $csv }; > say 'Cloned after parsing'; >
Subject: Re: [rt.cpan.org #86217] segfault when cloning after parse()
Date: Tue, 18 Jun 2013 09:16:11 +0200
To: bug-Text-CSV_XS [...] rt.cpan.org
From: "H.Merijn Brand" <h.m.brand [...] xs4all.nl>
On Mon, 17 Jun 2013 21:12:29 -0400, "Shawn Laffan via RT" <bug-Text-CSV_XS@rt.cpan.org> wrote: Show quoted text
> I can reproduce this on perlbrew 5.16.3 (x86_64-linux, under Ubuntu).
perl-5.18.0-i686-linux-64int-ld $ perl sandbox/rt86217.pl Using Text::CSV_XS version 1.00 Using Clone version 0.34 Cloning... Cloned before parsing Ran Text::CSV_XS=HASH(0x842aaf8)->parse. Cloning... Segmentation fault but I think you should blame Clone. The stacktrace shows a segv in Clone, not in Text::CSV_XS, so my suggestion is to take this ticket to the Clone queue. Program received signal SIGSEGV, Segmentation fault. 0xb7c19e6c in sv_clone () from /pro/lib/perl5/site_perl/5.18.0/i686-linux-64int-ld/auto/Clone/Clone.so (gdb) where #0 0xb7c19e6c in sv_clone () from /pro/lib/perl5/site_perl/5.18.0/i686-linux-64int-ld/auto/Clone/Clone.so #1 0xb7c1a0a6 in sv_clone () from /pro/lib/perl5/site_perl/5.18.0/i686-linux-64int-ld/auto/Clone/Clone.so #2 0xb7c1a01e in sv_clone () from /pro/lib/perl5/site_perl/5.18.0/i686-linux-64int-ld/auto/Clone/Clone.so #3 0xb7c1a2e2 in XS_Clone_clone () from /pro/lib/perl5/site_perl/5.18.0/i686-linux-64int-ld/auto/Clone/Clone.so #4 0x080fb86a in Perl_pp_entersub () #5 0x080f421b in Perl_runops_standard () #6 0x080869bb in perl_run () #7 0x080649cd in main () I'm closing this for now as not-a-bug -- H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/ using perl5.00307 .. 5.19 porting perl5 on HP-UX, AIX, and openSUSE http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/
Fix suggested in https://github.com/Tux/Clone/commit/6d75a706f0963ec0a28b622f0deccf22d76e2133 RAFL identified the problem to be a NULL entry in a SV slot, which is legal but - from a perl point-of-view - not recommendable. The upcomming version of Text::CSV_XS will not use the NULL anymore, but PL_sv_undef, which is set less (in frequence) to preserve speed. The fact that NULL is not common, does not make it illegal!
Thanks for following this up Merijn. Regards, Shawn. On Sun Jun 30 12:25:31 2013, HMBRAND wrote: Show quoted text
> Fix suggested in > https://github.com/Tux/Clone/commit/6d75a706f0963ec0a28b622f0deccf22d76e2133 > > RAFL identified the problem to be a NULL entry in a SV slot, which > is legal but - from a perl point-of-view - not recommendable. The > upcomming version of Text::CSV_XS will not use the NULL anymore, > but PL_sv_undef, which is set less (in frequence) to preserve speed. > > The fact that NULL is not common, does not make it illegal!
RT-Send-CC: h.m.brand [...] xs4all.nl
Thanks for reporting the issue, Shawn! Thanks for providing the patch, Tux! Sorry it took me so long to merge :/ Clone 0.35 was just shipped to CPAN and should fix the issue. Please let me know if it doesn't so we can reopen the ticket and take another look. Cheers! garu