Skip Menu |

This queue is for tickets about the Clone CPAN distribution.

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

People
Owner: Nobody in particular
Requestors: rabbit [...] rabbit.us
Cc:
AdminCc:

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



Subject: Clone segfault (isolated example)
Date: Mon, 2 Oct 2006 18:31:32 -0400
To: bug-Clone [...] rt.cpan.org
From: rabbit [...] rabbit.us (Peter Rabbitson)
I stumbled upon a segfault in Clone. It took me a while to strip down my code (a 30k lines monster) to the attached example. However I had to use a Storable snapshot from the big application - if I just create a variable within the simple script with the same contents 1:1 - the segfault does not happen. On the other hand the data in offender.storable is real and valid. Also if I do not execute the sprintf - the segfault does not occur either. It has to be some very peculiar combination of wrong stuff at the wrong place. Unfortunately my C knowledge is beyond minimal so I can just submit the bug report. As a side note - the same segfault happens in the big application by obtaining the data from XML::Twig, so I wouldn't blame Storable. Regards Peter Complete sample with code and data: http://rabbit.us/pool/clone_problem.tar.gz Code part: #!/usr/bin/perl use warnings; use strict; use Clone qw/clone/; use Storable qw/retrieve/; my $order = retrieve ('offender.storable'); foreach my $item (@{$order->{items}}) { $item->{sku} = sprintf ('<<bg_color=%s>>%s<</bg_color>>%s', '#EA0', substr ($item->{sku}, 0, 4), substr ($item->{sku}, 4), ); } my $cloned = clone ($order); 1;
Subject: [rt.cpan.org #21859] Version info
Date: Mon, 2 Oct 2006 18:37:09 -0400
To: Bugs in Clone via RT <bug-Clone [...] rt.cpan.org>
From: rabbit [...] rabbit.us (Peter Rabbitson)
I forgot to mention that I was able to reproduce this on 3 separate machines. Two had Clone version 0.20 and one Clone version 0.18. Perl is 5.8.8. Regards Peter
I just uploaded a new version (0.22) that fixes this problem. The segfault was caused by perl trying to clone a null sv value. I was able to isolate the sample that was causing the segfault to the following: my $string = "HDDR-WD-250JS"; utf8::upgrade($string); $string = sprintf ('<<bg_color=%s>>%s<</bg_color>>%s', '#EA0', substr ($string, 0, 4), substr ($string, 4), ); print $string, "\n"; my $z = clone($string); Somehow manipulating the string after it's upgrade to utf8 convert it to a magical object.