Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Serious Bug in latest Data::Dumper under 5.6.1

by demerphq (Chancellor)
on Oct 23, 2003 at 16:39 UTC ( #301633=perlmeditation: print w/replies, xml ) Need Help??

Hi, this is just a heads up about a bug report I just filed to p5p and the maintainer of Data::Dumper. If you set $Data::Dumper::Sortkeys=1 and do not set $Data::Dumper::Useperl=1 under 5.6.1 (win32 at least) you will end up with either erroneous data or a segfault. If you set both at the same time this problem doesnt arise.

Note that this bug does not appear to affect 5.8.0 at all.

use Data::Dumper; use strict; use warnings; $|++; printf "D::D version %s\n",Data::Dumper->VERSION; for my $sk (0,1) { print "\$Data::Dumper::Sortkeys=$sk\n"; $Data::Dumper::Sortkeys=$sk; for my $up (1,0) { print "\$Data::Dumper::Useperl=$up\n"; $Data::Dumper::Useperl=$up; my %rev; my %name; print "Dumper:\n",Dumper(\%rev,\%name),"\n"; } } print "Done\n"; __END__ D::D version 2.121 $Data::Dumper::Sortkeys=0 $Data::Dumper::Useperl=1 Dumper: $VAR1 = {}; $VAR2 = {}; $Data::Dumper::Useperl=0 Dumper: $VAR1 = {}; $VAR2 = {}; $Data::Dumper::Sortkeys=1 $Data::Dumper::Useperl=1 Dumper: $VAR1 = {}; $VAR2 = {}; $Data::Dumper::Useperl=0 Use of uninitialized value in print at c:\temp\ line 15. Dumper: $VAR2 = {};

I post this only as a public service, as I know many people here depend on DD in many ways, and this is a serious bug that is not picked up by the test suite.



    First they ignore you, then they laugh at you, then they fight you, then you win.
    -- Gandhi

Replies are listed 'Best First'.
Re: Serious Bug in latest Data::Dumper under 5.6.1
by simonflk (Pilgrim) on Oct 24, 2003 at 17:19 UTC

    I get the segfault with perl 5.6.1 on solaris. But strangely, if I change the line:

    print "Dumper:\n",Dumper(\%rev,\%name),"\n";


    my $dumped = Dumper(\%rev,\%name); print "Dumper:\n",$dumped,"\n";

    It works fine. I can't see why that should make any difference.

    -- simonflk


    simonf$ perl -MData::Dumper -le 'print Data::Dumper->VERSION' 2.12_01

    Update: Tested on Win32, with ActiveState's D::D 2.121 PPM. Same behaviour - using Dumper() in scalar context avoids segfault.

Re: Serious Bug in latest Data::Dumper under 5.6.1
by IlyaM (Parson) on Oct 27, 2003 at 12:40 UTC
    Similar problem can be reproduced on perl 5.8.0 too. Minimal test case:
    use Data::Dumper; $Data::Dumper::Sortkeys = sub { [ sort keys %{$_[0]} ] }; print Dumper({}, {});

    Ilya Martynov,
    CTO IPonWEB (UK) Ltd
    Quality Perl Programming and Unix Support UK managed @ offshore prices -
    Personal website -

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://301633]
Approved by broquaint
Front-paged by BrowserUk
[Discipulus]: finally a relaxing workday! good morning mnks!
[Lady_Aleena]: I hope you have a wonderful day Discipulus. 8)
[Corion]: A good morning to you too ;)
[choroba]: Good morning, Monks!
[Corion]: And a good daypart to you as well, Lady_Aleena !
[robby_dobby]: Hey monkeys, do you ever get the realization that you're all waking up to chaos? I suppose not :P
[Lady_Aleena]: Good morning Corion, I hope you have a wonderful day as well. 8)
[Corion]: Yesterday I encountered an interesting data structure problem. I have a remote program that emits events, and my client listens for these events with one-shot callbacks, that is, I register the callback and if the event gets generated that callback ...
[Lady_Aleena]: robby_dobby, every day. Chaos is my life with few controls.
[Corion]: ... gets called once. The data structure for that is just a hash of arrays, mapping the event type to a queue of registered one-shots, and the first one-shot from the queue gets removed and called.

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2017-05-29 07:50 GMT
Find Nodes?
    Voting Booth?