Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data::Dumper::Dump() breaks cyclic data #15925

Open
p5pRT opened this issue Mar 19, 2017 · 5 comments
Open

Data::Dumper::Dump() breaks cyclic data #15925

p5pRT opened this issue Mar 19, 2017 · 5 comments

Comments

@p5pRT
Copy link

@p5pRT p5pRT commented Mar 19, 2017

Migrated from rt.perl.org#131020 (status was 'open')

Searchable as RT131020$

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Mar 19, 2017

From @choroba

Created by @choroba

Data​::Dumper​::Dump seems not to represent cyclic structures correctly.
The attached test fails even in 5.25.11. For details, see
http​://www.perlmonks.org/?node_id=1163744

Perl Info

Flags:
     category=library
     severity=low
     module=Data::Dumper

This perlbug was built using Perl 5.18.2 - Thu Sep  8 10:08:46 UTC 2016
It is being executed now by  Perl 5.18.2 - Thu Sep  8 10:06:42 UTC 2016.

Site configuration information for perl 5.18.2:

Configured by abuild at Thu Sep  8 10:06:42 UTC 2016.

Summary of my perl5 (revision 5 version 18 subversion 2) configuration:

   Platform:
     osname=linux, osvers=4.1.27-27-default, archname=x86_64-linux-thread-multi
     uname='linux lamb14 4.1.27-27-default #1 smp preempt fri jul 15 12:46:41 utc 2016 (84ae57e) x86_64 x86_64 x86_64 gnulinux '
     config_args='-ds -e -Dprefix=/usr -Dvendorprefix=/usr -Dinstallusrbinperl -Dusethreads -Di_db -Di_dbm -Di_ndbm -Di_gdbm -Dd_dbm_open -Duseshrplib=true -Doptimize=-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -Wall -pipe -Accflags=-DPERL_USE_SAFE_PUTENV -Dotherlibdirs=/usr/lib/perl5/site_perl -Dinc_version_list=5.18.0/x86_64-linux-thread-multi 5.18.0 5.18.1/x86_64-linux-thread-multi 5.18.1'
     hint=recommended, useposix=true, d_sigaction=define
     useithreads=define, usemultiplicity=define
     useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
     use64bitint=define, use64bitall=define, uselongdouble=undef
     usemymalloc=n, bincompat5005=undef
   Compiler:
     cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -fstack-protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
     optimize='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -Wall -pipe',
     cppflags='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -fstack-protector'
     ccversion='', gccversion='4.8.5', gccosandvers=''
     intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
     ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
     alignbytes=8, prototype=define
   Linker and Libraries:
     ld='cc', ldflags =' -L/usr/local/lib64 -fstack-protector'
     libpth=/lib64 /usr/lib64 /usr/local/lib64
     libs=-lm -ldl -lcrypt -lpthread
     perllibs=-lm -ldl -lcrypt -lpthread
     libc=/lib64/libc-2.19.so, so=so, useshrplib=true, libperl=libperl.so
     gnulibc_version='2.19'
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.18.2/x86_64-linux-thread-multi/CORE'
     cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib64 -fstack-protector'

Locally applied patches:



@INC for perl 5.18.2:
     /home/choroba/perl5/lib/perl5/x86_64-linux-thread-multi
     /home/choroba/perl5/lib/perl5/x86_64-linux-thread-multi
     /home/choroba/perl5/lib/perl5
     /usr/lib/perl5/site_perl/5.18.2/x86_64-linux-thread-multi
     /usr/lib/perl5/site_perl/5.18.2
     /usr/lib/perl5/vendor_perl/5.18.2/x86_64-linux-thread-multi
     /usr/lib/perl5/vendor_perl/5.18.2
     /usr/lib/perl5/5.18.2/x86_64-linux-thread-multi
     /usr/lib/perl5/5.18.2
     /usr/lib/perl5/vendor_perl/5.18.1/x86_64-linux-thread-multi
     /usr/lib/perl5/vendor_perl/5.18.1
     /usr/lib/perl5/site_perl


Environment for perl 5.18.2:
     HOME=/home/choroba
     LANG=en_US.UTF-8
     LANGUAGE=en_US.utf8
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)
     PATH=/home/choroba/perl5/bin:/home/choroba/bin:/bin:/sbin:/usr/bin:/usr/local/bin:/usr/games:/usr/X11R6/bin:/opt/gnome/bin:.
     PERL5LIB=/home/choroba/perl5/lib/perl5/x86_64-linux-thread-multi:/home/choroba/perl5/lib/perl5
     PERL_BADLANG (unset)
     PERL_LOCAL_LIB_ROOT=/home/choroba/perl5
     PERL_MB_OPT=--install_base /home/choroba/perl5
     PERL_MM_OPT=INSTALL_BASE=/home/choroba/perl5
     SHELL=/bin/bash
@p5pRT
Copy link
Author

@p5pRT p5pRT commented Mar 19, 2017

From @choroba

1.pl

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Mar 20, 2017

From @jkeenan

On Sun, 19 Mar 2017 23​:28​:00 GMT, choroba@​cpan.org wrote​:

This is a bug report for perl from choroba@​cpan.org,
generated with the help of perlbug 1.39 running under perl 5.18.2.

-----------------------------------------------------------------
[Please describe your issue here]

Data​::Dumper​::Dump seems not to represent cyclic structures correctly.
The attached test fails even in 5.25.11. For details, see
http​://www.perlmonks.org/?node_id=1163744

Confirmed. This problem seems similar to that reported in https://rt-archive.perl.org/perl5/Ticket/Display.html?id=7233 -- nearly 16 years ago!

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Mar 20, 2017

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

@p5pRT p5pRT commented Mar 20, 2017

From @demerphq

On 20 March 2017 at 01​:53, James E Keenan via RT
<perlbug-followup@​perl.org> wrote​:

On Sun, 19 Mar 2017 23​:28​:00 GMT, choroba@​cpan.org wrote​:

This is a bug report for perl from choroba@​cpan.org,
generated with the help of perlbug 1.39 running under perl 5.18.2.

-----------------------------------------------------------------
[Please describe your issue here]

Data​::Dumper​::Dump seems not to represent cyclic structures correctly.
The attached test fails even in 5.25.11. For details, see
http​://www.perlmonks.org/?node_id=1163744

Confirmed. This problem seems similar to that reported in https://rt-archive.perl.org/perl5/Ticket/Display.html?id=7233 -- nearly 16 years ago!

Thank you very much.

I dont think it will get fixed either. DD is not intended for
round-trip safe serialization. If you want that use Storable, or use
something with well-defined round-trip semantics like JSON or Sereal,
or whatever.

Having said that, the test case from this ticket has been part of the
Data​::Dump​::Streamer for about half the lifetime of this ticket. :-)

In other words, if you want to have something like this dumped
correctly (and DD has more errors related to Aliasing and Scalar
refs), you should use DDS, which does multiple passes over the data
structure so it can output something like this correctly. It is also
much slower. Especially as its 95% pure perl.

cheers
Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant