Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.91k stars 542 forks source link

Data::Dumper 2.143 tests failures on 5.10.1 #12818

Closed p5pRT closed 11 years ago

p5pRT commented 11 years ago

Migrated from rt.perl.org#116961 (status was 'resolved')

Searchable as RT116961$

p5pRT commented 11 years ago

From @dolmen

Created by dolmen@cpan.org

Multiple test failures when installing Data​::Dumper 2.143 from CPAN on our perl 5.10.1.

----8\<------8\<------8\<------8\<------8\<------8\<------8\<------8---- $ make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils​::Command​::MM" "-e" "test_harness(0\, 'blib/lib'\, 'blib/arch')" t/*.t t/bless.t ..................... 1/11 Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like you planned 11 tests but ran 1. # Looks like your test exited with 255 just after 1. t/bless.t ..................... Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 10/11 subtests t/bless_var_method.t .......... Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like your test exited with 255 before it could output anything. t/bless_var_method.t .......... Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 8/8 subtests t/bugs.t ...................... 1/15 substr outside of string at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 518. Use of uninitialized value $name in pattern match (m//) at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 519. Use of uninitialized value $name in string eq at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 524. Malformed UTF-8 character (fatal) at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 560. # Looks like you planned 15 tests but ran 6. # Looks like your test exited with 255 just after 6. t/bugs.t ...................... Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 9/15 subtests t/deparse.t ................... ok t/dumper.t .................... Failed 2/201 subtests t/dumpperl.t .................. 1/22 Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like you planned 22 tests but ran 18. # Looks like your test exited with 2 just after 18. t/dumpperl.t .................. Dubious\, test returned 2 (wstat 512\, 0x200) Failed 4/22 subtests t/freezer.t ................... 1/15 Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like you planned 15 tests but ran 11. # Looks like your test exited with 2 just after 11. t/freezer.t ................... Dubious\, test returned 2 (wstat 512\, 0x200) Failed 4/15 subtests t/indent.t .................... 1/10 # Failed test 'Indent(3) annotates array elements with their indices' # at t/indent.t line 96. # '$VAR1 = [ # #0 # 'foo'\, # #1 # 42 # ]; # ' # doesn't match '(?s-xim​:\#0.+'foo'.+\#1.+'42')' # Looks like you failed 1 test of 10. t/indent.t .................... Dubious\, test returned 1 (wstat 256\, 0x100) Failed 1/10 subtests t/misc.t ...................... ok t/names.t ..................... ok t/overload.t .................. ok t/pair.t ...................... ok t/perl-74170.t ................ Can't locate object method "Dumpxs" via package "Data​::Dumper" at t/perl-74170.t line 28. # Looks like your test exited with 255 before it could output anything. t/perl-74170.t ................ Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 1/1 subtests t/purity_deepcopy_maxdepth.t .. ok t/qr.t ........................ ok t/quotekeys.t ................. Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like your test exited with 255 before it could output anything. t/quotekeys.t ................. Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 10/10 subtests t/seen.t ...................... ok t/sortkeys.t .................. Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like your test exited with 255 before it could output anything. t/sortkeys.t .................. Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 23/23 subtests t/sparseseen.t ................ Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like your test exited with 255 before it could output anything. t/sparseseen.t ................ Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 8/8 subtests t/terse.t ..................... ok t/toaster.t ................... Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like your test exited with 255 before it could output anything. t/toaster.t ................... Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 8/8 subtests t/values.t .................... ok

Test Summary Report ------------------- t/bless.t (Wstat​: 65280 Tests​: 1 Failed​: 0) Non-zero exit status​: 255 Parse errors​: Bad plan. You planned 11 tests but ran 1. t/bless_var_method.t (Wstat​: 65280 Tests​: 0 Failed​: 0) Non-zero exit status​: 255 Parse errors​: Bad plan. You planned 8 tests but ran 0. t/bugs.t (Wstat​: 65280 Tests​: 6 Failed​: 0) Non-zero exit status​: 255 Parse errors​: Bad plan. You planned 15 tests but ran 6. t/dumper.t (Wstat​: 0 Tests​: 201 Failed​: 2) Failed tests​: 196\, 198 t/dumpperl.t (Wstat​: 512 Tests​: 18 Failed​: 0) Non-zero exit status​: 2 Parse errors​: Bad plan. You planned 22 tests but ran 18. t/freezer.t (Wstat​: 512 Tests​: 11 Failed​: 0) Non-zero exit status​: 2 Parse errors​: Bad plan. You planned 15 tests but ran 11. t/indent.t (Wstat​: 256 Tests​: 10 Failed​: 1) Failed test​: 9 Non-zero exit status​: 1 t/perl-74170.t (Wstat​: 65280 Tests​: 0 Failed​: 0) Non-zero exit status​: 255 Parse errors​: Bad plan. You planned 1 tests but ran 0. t/quotekeys.t (Wstat​: 65280 Tests​: 0 Failed​: 0) Non-zero exit status​: 255 Parse errors​: Bad plan. You planned 10 tests but ran 0. t/sortkeys.t (Wstat​: 65280 Tests​: 0 Failed​: 0) Non-zero exit status​: 255 Parse errors​: Bad plan. You planned 23 tests but ran 0. t/sparseseen.t (Wstat​: 65280 Tests​: 0 Failed​: 0) Non-zero exit status​: 255 Parse errors​: Bad plan. You planned 8 tests but ran 0. t/toaster.t (Wstat​: 65280 Tests​: 0 Failed​: 0) Non-zero exit status​: 255 Parse errors​: Bad plan. You planned 8 tests but ran 0. Files=22\, Tests=349\, 1 wallclock secs ( 0.08 usr 0.05 sys + 0.74 cusr 0.15 csys = 1.02 CPU) Result​: FAIL Failed 12/22 test programs. 3/349 subtests failed. make​: *** [test_dynamic] Error 255

----8\<------8\<------8\<------8\<------8\<------8\<------8\<------8----

Perl Info ``` Flags: category=library severity=medium module=Data::Dumper Site configuration information for perl 5.10.1: Configured by jenkins at Thu Nov 15 09:18:15 CET 2012. Summary of my perl5 (revision 5 version 10 subversion 1) configuration: Platform: osname=linux, osvers=3.0.0-26-server, archname=x86_64-linux uname='linux jenkins 3.0.0-26-server #43-ubuntu smp tue sep 25 17:37:40 utc 2012 x86_64 x86_64 x86_64 gnulinux ' config_args='-Accflags=-DNO_MATHOMS -Accflags=-DPERL_DISABLE_PMC -Dprefix=/var/lib/jenkins/perl/perl-5.10.1 -des -A append:libs=-lm -ldl -lcrypt -lrt -A append:libpth= /usr/lib/x86_64-linux-gnu' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-DNO_MATHOMS -DPERL_DISABLE_PMC -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-DNO_MATHOMS -DPERL_DISABLE_PMC -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion='', gccversion='4.6.1', 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 =' -fstack-protector' libpth=/usr/lib/x86_64-linux-gnu libs=-lm -ldl -lcrypt -lrt perllibs=-lm -ldl -lcrypt -lrt libc=, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.13' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -O2 -fstack-protector' Locally applied patches: @INC for perl 5.10.1: /var/lib/jenkins/perl/perl-5.10.1/lib/5.10.1/x86_64-linux /var/lib/jenkins/perl/perl-5.10.1/lib/5.10.1 /var/lib/jenkins/perl/perl-5.10.1/lib/site_perl/5.10.1/x86_64-linux /var/lib/jenkins/perl/perl-5.10.1/lib/site_perl/5.10.1 . Environment for perl 5.10.1: HOME=/home/jenkins LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_MESSAGES=fr_FR.UTF-8 LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games PERL5LIB= PERL5OPT= PERL5_CPANPLUS_IS_RUNNING=23007 PERL5_CPAN_IS_RUNNING=23007 PERL_BADLANG (unset) SHELL=/bin/bash ```
p5pRT commented 11 years ago

From @dolmen

Look like I did run the test with the system perl (5.12.4) instead of our custom-built 5.10.1. Anyway\, the bug still applies.

Here is the result of the build with 5.10.1 (corresponding to the perl with which perlbug ran).

----8\<----------8\<--------8\<--------8\<--------8\<--------8\<--------8\<---- $ /var/lib/jenkins/perl/perl-5.10.1/bin/perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for Data​::Dumper Writing MYMETA.yml and MYMETA.json jenkins@​jenkins​:\~/.cpan/build/Data-Dumper-2.143-5tgcqI$ make test cp Dumper.pm blib/lib/Data/Dumper.pm /var/lib/jenkins/perl/perl-5.10.1/bin/perl /var/lib/jenkins/perl/perl-5.10.1/lib/5.10.1/ExtUtils/xsubpp -typemap /var/lib/jenkins/perl/perl-5.10.1/lib/5.10.1/ExtUtils/typemap Dumper.xs

Dumper.xsc && mv Dumper.xsc Dumper.c cc -c -DNO_MATHOMS -DPERL_DISABLE_PMC -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"2.143\" -DXS_VERSION=\"2.143\" -fPIC "-I/var/lib/jenkins/perl/perl-5.10.1/lib/5.10.1/x86_64-linux/CORE" -DUSE_PPPORT_H Dumper.c Running Mkbootstrap for Data​::Dumper () chmod 644 Dumper.bs rm -f blib/arch/auto/Data/Dumper/Dumper.so cc -shared -O2 -fstack-protector Dumper.o -o blib/arch/auto/Data/Dumper/Dumper.so \   \  
chmod 755 blib/arch/auto/Data/Dumper/Dumper.so cp Dumper.bs blib/arch/auto/Data/Dumper/Dumper.bs chmod 644 blib/arch/auto/Data/Dumper/Dumper.bs PERL_DL_NONLAZY=1 /var/lib/jenkins/perl/perl-5.10.1/bin/perl "-MExtUtils​::Command​::MM" "-e" "test_harness(0\, 'blib/lib'\, 'blib/arch')" t/*.t t/bless.t ..................... 1/11 Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like you planned 11 tests but ran 1. # Looks like your test exited with 255 just after 1. t/bless.t ..................... Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 10/11 subtests t/bless_var_method.t .......... Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like your test exited with 255 before it could output anything. t/bless_var_method.t .......... Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 8/8 subtests t/bugs.t ...................... 1/15 Malformed UTF-8 character (fatal) at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 560. # Looks like you planned 15 tests but ran 6. # Looks like your test exited with 9 just after 6. t/bugs.t ...................... Dubious\, test returned 9 (wstat 2304\, 0x900) Failed 9/15 subtests   (less 1 skipped subtest​: 5 okay) t/deparse.t ................... ok
t/dumper.t .................... Failed 2/201 subtests t/dumpperl.t .................. 1/22 Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like you planned 22 tests but ran 18. # Looks like your test exited with 9 just after 18. t/dumpperl.t .................. Dubious\, test returned 9 (wstat 2304\, 0x900) Failed 4/22 subtests t/freezer.t ................... 1/15 Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like you planned 15 tests but ran 11. # Looks like your test exited with 9 just after 11. t/freezer.t ................... Dubious\, test returned 9 (wstat 2304\, 0x900) Failed 4/15 subtests t/indent.t .................... Use of implicit split to @​_ is deprecated at t/indent.t line 100. Use of implicit split to @​_ is deprecated at t/indent.t line 101. t/indent.t .................... 1/10 # Failed test 'Indent(3) annotates array elements with their indices' # at t/indent.t line 96. # '$VAR1 = [ # #0 # 'foo'\, # #1 # 42 # ]; # ' # doesn't match '(?s-xim​:\#0.+'foo'.+\#1.+'42')' # Looks like you failed 1 test of 10. t/indent.t .................... Dubious\, test returned 1 (wstat 256\, 0x100) Failed 1/10 subtests t/misc.t ...................... ok
t/names.t ..................... ok
t/overload.t .................. ok
t/pair.t ...................... ok
t/perl-74170.t ................ Can't locate object method "Dumpxs" via package "Data​::Dumper" at t/perl-74170.t line 28. # Looks like your test exited with 255 before it could output anything. t/perl-74170.t ................ Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 1/1 subtests t/purity_deepcopy_maxdepth.t .. ok
t/qr.t ........................ ok
t/quotekeys.t ................. Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like your test exited with 255 before it could output anything. t/quotekeys.t ................. Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 10/10 subtests t/seen.t ...................... ok
t/sortkeys.t .................. Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like your test exited with 255 before it could output anything. t/sortkeys.t .................. Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 23/23 subtests t/sparseseen.t ................ Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like your test exited with 255 before it could output anything. t/sparseseen.t ................ Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 8/8 subtests t/terse.t ..................... ok
t/toaster.t ................... Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like your test exited with 255 before it could output anything. t/toaster.t ................... Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 8/8 subtests t/values.t .................... ok

Test Summary Report


t/bless.t (Wstat​: 65280 Tests​: 1 Failed​: 0)   Non-zero exit status​: 255   Parse errors​: Bad plan. You planned 11 tests but ran 1. t/bless_var_method.t (Wstat​: 65280 Tests​: 0 Failed​: 0)   Non-zero exit status​: 255   Parse errors​: Bad plan. You planned 8 tests but ran 0. t/bugs.t (Wstat​: 2304 Tests​: 6 Failed​: 0)   Non-zero exit status​: 9   Parse errors​: Bad plan. You planned 15 tests but ran 6. t/dumper.t (Wstat​: 0 Tests​: 201 Failed​: 2)   Failed tests​: 196\, 198 t/dumpperl.t (Wstat​: 2304 Tests​: 18 Failed​: 0)   Non-zero exit status​: 9   Parse errors​: Bad plan. You planned 22 tests but ran 18. t/freezer.t (Wstat​: 2304 Tests​: 11 Failed​: 0)   Non-zero exit status​: 9   Parse errors​: Bad plan. You planned 15 tests but ran 11. t/indent.t (Wstat​: 256 Tests​: 10 Failed​: 1)   Failed test​: 9   Non-zero exit status​: 1 t/perl-74170.t (Wstat​: 65280 Tests​: 0 Failed​: 0)   Non-zero exit status​: 255   Parse errors​: Bad plan. You planned 1 tests but ran 0. t/quotekeys.t (Wstat​: 65280 Tests​: 0 Failed​: 0)   Non-zero exit status​: 255   Parse errors​: Bad plan. You planned 10 tests but ran 0. t/sortkeys.t (Wstat​: 65280 Tests​: 0 Failed​: 0)   Non-zero exit status​: 255   Parse errors​: Bad plan. You planned 23 tests but ran 0. t/sparseseen.t (Wstat​: 65280 Tests​: 0 Failed​: 0)   Non-zero exit status​: 255   Parse errors​: Bad plan. You planned 8 tests but ran 0. t/toaster.t (Wstat​: 65280 Tests​: 0 Failed​: 0)   Non-zero exit status​: 255   Parse errors​: Bad plan. You planned 8 tests but ran 0. Files=22\, Tests=349\, 1 wallclock secs ( 0.08 usr 0.04 sys + 0.72 cusr 0.11 csys = 0.95 CPU) Result​: FAIL Failed 12/22 test programs. 3/349 subtests failed. make​: *** [test_dynamic] Error 255 ----8\<----------8\<--------8\<--------8\<--------8\<--------8\<--------8\<----

p5pRT commented 11 years ago

From [Unknown Contact. See original ticket]

Look like I did run the test with the system perl (5.12.4) instead of our custom-built 5.10.1. Anyway\, the bug still applies.

Here is the result of the build with 5.10.1 (corresponding to the perl with which perlbug ran).

----8\<----------8\<--------8\<--------8\<--------8\<--------8\<--------8\<---- $ /var/lib/jenkins/perl/perl-5.10.1/bin/perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for Data​::Dumper Writing MYMETA.yml and MYMETA.json jenkins@​jenkins​:\~/.cpan/build/Data-Dumper-2.143-5tgcqI$ make test cp Dumper.pm blib/lib/Data/Dumper.pm /var/lib/jenkins/perl/perl-5.10.1/bin/perl /var/lib/jenkins/perl/perl-5.10.1/lib/5.10.1/ExtUtils/xsubpp -typemap /var/lib/jenkins/perl/perl-5.10.1/lib/5.10.1/ExtUtils/typemap Dumper.xs

Dumper.xsc && mv Dumper.xsc Dumper.c cc -c -DNO_MATHOMS -DPERL_DISABLE_PMC -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"2.143\" -DXS_VERSION=\"2.143\" -fPIC "-I/var/lib/jenkins/perl/perl-5.10.1/lib/5.10.1/x86_64-linux/CORE" -DUSE_PPPORT_H Dumper.c Running Mkbootstrap for Data​::Dumper () chmod 644 Dumper.bs rm -f blib/arch/auto/Data/Dumper/Dumper.so cc -shared -O2 -fstack-protector Dumper.o -o blib/arch/auto/Data/Dumper/Dumper.so \   \  
chmod 755 blib/arch/auto/Data/Dumper/Dumper.so cp Dumper.bs blib/arch/auto/Data/Dumper/Dumper.bs chmod 644 blib/arch/auto/Data/Dumper/Dumper.bs PERL_DL_NONLAZY=1 /var/lib/jenkins/perl/perl-5.10.1/bin/perl "-MExtUtils​::Command​::MM" "-e" "test_harness(0\, 'blib/lib'\, 'blib/arch')" t/*.t t/bless.t ..................... 1/11 Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like you planned 11 tests but ran 1. # Looks like your test exited with 255 just after 1. t/bless.t ..................... Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 10/11 subtests t/bless_var_method.t .......... Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like your test exited with 255 before it could output anything. t/bless_var_method.t .......... Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 8/8 subtests t/bugs.t ...................... 1/15 Malformed UTF-8 character (fatal) at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 560. # Looks like you planned 15 tests but ran 6. # Looks like your test exited with 9 just after 6. t/bugs.t ...................... Dubious\, test returned 9 (wstat 2304\, 0x900) Failed 9/15 subtests   (less 1 skipped subtest​: 5 okay) t/deparse.t ................... ok
t/dumper.t .................... Failed 2/201 subtests t/dumpperl.t .................. 1/22 Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like you planned 22 tests but ran 18. # Looks like your test exited with 9 just after 18. t/dumpperl.t .................. Dubious\, test returned 9 (wstat 2304\, 0x900) Failed 4/22 subtests t/freezer.t ................... 1/15 Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like you planned 15 tests but ran 11. # Looks like your test exited with 9 just after 11. t/freezer.t ................... Dubious\, test returned 9 (wstat 2304\, 0x900) Failed 4/15 subtests t/indent.t .................... Use of implicit split to @​_ is deprecated at t/indent.t line 100. Use of implicit split to @​_ is deprecated at t/indent.t line 101. t/indent.t .................... 1/10 # Failed test 'Indent(3) annotates array elements with their indices' # at t/indent.t line 96. # '$VAR1 = [ # #0 # 'foo'\, # #1 # 42 # ]; # ' # doesn't match '(?s-xim​:\#0.+'foo'.+\#1.+'42')' # Looks like you failed 1 test of 10. t/indent.t .................... Dubious\, test returned 1 (wstat 256\, 0x100) Failed 1/10 subtests t/misc.t ...................... ok
t/names.t ..................... ok
t/overload.t .................. ok
t/pair.t ...................... ok
t/perl-74170.t ................ Can't locate object method "Dumpxs" via package "Data​::Dumper" at t/perl-74170.t line 28. # Looks like your test exited with 255 before it could output anything. t/perl-74170.t ................ Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 1/1 subtests t/purity_deepcopy_maxdepth.t .. ok
t/qr.t ........................ ok
t/quotekeys.t ................. Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like your test exited with 255 before it could output anything. t/quotekeys.t ................. Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 10/10 subtests t/seen.t ...................... ok
t/sortkeys.t .................. Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like your test exited with 255 before it could output anything. t/sortkeys.t .................. Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 23/23 subtests t/sparseseen.t ................ Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like your test exited with 255 before it could output anything. t/sparseseen.t ................ Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 8/8 subtests t/terse.t ..................... ok
t/toaster.t ................... Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like your test exited with 255 before it could output anything. t/toaster.t ................... Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 8/8 subtests t/values.t .................... ok

Test Summary Report


t/bless.t (Wstat​: 65280 Tests​: 1 Failed​: 0)   Non-zero exit status​: 255   Parse errors​: Bad plan. You planned 11 tests but ran 1. t/bless_var_method.t (Wstat​: 65280 Tests​: 0 Failed​: 0)   Non-zero exit status​: 255   Parse errors​: Bad plan. You planned 8 tests but ran 0. t/bugs.t (Wstat​: 2304 Tests​: 6 Failed​: 0)   Non-zero exit status​: 9   Parse errors​: Bad plan. You planned 15 tests but ran 6. t/dumper.t (Wstat​: 0 Tests​: 201 Failed​: 2)   Failed tests​: 196\, 198 t/dumpperl.t (Wstat​: 2304 Tests​: 18 Failed​: 0)   Non-zero exit status​: 9   Parse errors​: Bad plan. You planned 22 tests but ran 18. t/freezer.t (Wstat​: 2304 Tests​: 11 Failed​: 0)   Non-zero exit status​: 9   Parse errors​: Bad plan. You planned 15 tests but ran 11. t/indent.t (Wstat​: 256 Tests​: 10 Failed​: 1)   Failed test​: 9   Non-zero exit status​: 1 t/perl-74170.t (Wstat​: 65280 Tests​: 0 Failed​: 0)   Non-zero exit status​: 255   Parse errors​: Bad plan. You planned 1 tests but ran 0. t/quotekeys.t (Wstat​: 65280 Tests​: 0 Failed​: 0)   Non-zero exit status​: 255   Parse errors​: Bad plan. You planned 10 tests but ran 0. t/sortkeys.t (Wstat​: 65280 Tests​: 0 Failed​: 0)   Non-zero exit status​: 255   Parse errors​: Bad plan. You planned 23 tests but ran 0. t/sparseseen.t (Wstat​: 65280 Tests​: 0 Failed​: 0)   Non-zero exit status​: 255   Parse errors​: Bad plan. You planned 8 tests but ran 0. t/toaster.t (Wstat​: 65280 Tests​: 0 Failed​: 0)   Non-zero exit status​: 255   Parse errors​: Bad plan. You planned 8 tests but ran 0. Files=22\, Tests=349\, 1 wallclock secs ( 0.08 usr 0.04 sys + 0.72 cusr 0.11 csys = 0.95 CPU) Result​: FAIL Failed 12/22 test programs. 3/349 subtests failed. make​: *** [test_dynamic] Error 255 ----8\<----------8\<--------8\<--------8\<--------8\<--------8\<--------8\<----

p5pRT commented 11 years ago

From @jkeenan

On Wed Feb 27 02​:03​:54 2013\, dolmen wrote​:

Look like I did run the test with the system perl (5.12.4) instead of our custom-built 5.10.1. Anyway\, the bug still applies.

Here is the result of the build with 5.10.1 (corresponding to the perl with which perlbug ran).

I confirmed this comparing 5.14.0 and 5.16.0. Here is the output on each version of two representative tests​:

$ /usr/local/bin/perl5.14.0 -Iblib/lib t/bless.t 1..11 ok 1 - use Data​::Dumper; Undefined subroutine &Data​::Dumper​::Dumpxs called at blib/lib/Data/Dumper.pm line 222. # Looks like you planned 11 tests but ran 1. # Looks like your test exited with 255 just after 1.

$ /usr/local/bin/perl5.14.0 -Iblib/lib t/indent.t 1..10 ok 1 - absence of Indent is same as Indent() ok 2 - absence of Indent is same as Indent(undef) ok 3 - absence of Indent is different from Indent(0) ok 4 - Indent(0) is different from Indent(1) ok 5 - Indent(0) is more compact than Indent(1) ok 6 - absence of Indent is same as Indent(2)\, i.e.\, 2 is default ok 7 - Indent(1) is more compact than Indent(2) ok 8 - On arrays\, Indent(2) is different from Indent(3) not ok 9 - Indent(3) annotates array elements with their indices # Failed test 'Indent(3) annotates array elements with their indices' # at t/indent.t line 96. # '$VAR1 = [ # #0 # 'foo'\, # #1 # 42 # ]; # ' # doesn't match '(?^s​:\#0.+'foo'.+\#1.+'42')' ok 10 - Indent(3) runs 2 lines longer than Indent(2) # Looks like you failed 1 test of 10.

# 5.16.0 is my default perl

$ /usr/local/bin/perl5.16.0 -Iblib/lib t/bless.t 1..11 ok 1 - use Data​::Dumper; ok 2 - package name in bless is escaped if needed ok 3 - eval reverts dump ok 4 - package name in bless is escaped if needed ok 5 - eval reverts dump ok 6 - We can dump blessed qr//'s properly ok 7 - package name in bless is escaped if needed ok 8 - eval reverts dump ok 9 - package name in bless is escaped if needed ok 10 - eval reverts dump ok 11 - We can dump blessed qr//'s properly

$ /usr/local/bin/perl5.16.0 -Iblib/lib t/indent.t 1..10 ok 1 - absence of Indent is same as Indent() ok 2 - absence of Indent is same as Indent(undef) ok 3 - absence of Indent is different from Indent(0) ok 4 - Indent(0) is different from Indent(1) ok 5 - Indent(0) is more compact than Indent(1) ok 6 - absence of Indent is same as Indent(2)\, i.e.\, 2 is default ok 7 - Indent(1) is more compact than Indent(2) ok 8 - On arrays\, Indent(2) is different from Indent(3) ok 9 - Indent(3) annotates array elements with their indices ok 10 - Indent(3) runs 2 lines longer than Indent(2)

I don't yet have a diagnosis.

p5pRT commented 11 years ago

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

p5pRT commented 11 years ago

From @jkeenan

On Wed Feb 27 02​:03​:54 2013\, dolmen wrote​:

Look like I did run the test with the system perl (5.12.4) instead of our custom-built 5.10.1. Anyway\, the bug still applies.

Here is the result of the build with 5.10.1 (corresponding to the perl with which perlbug ran).

----8\<----------8\<--------8\<--------8\<--------8\<--------8\<--------8\<---- $ /var/lib/jenkins/perl/perl-5.10.1/bin/perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for Data​::Dumper Writing MYMETA.yml and MYMETA.json jenkins@​jenkins​:\~/.cpan/build/Data-Dumper-2.143-5tgcqI$ make test cp Dumper.pm blib/lib/Data/Dumper.pm /var/lib/jenkins/perl/perl-5.10.1/bin/perl /var/lib/jenkins/perl/perl-5.10.1/lib/5.10.1/ExtUtils/xsubpp -typemap /var/lib/jenkins/perl/perl-5.10.1/lib/5.10.1/ExtUtils/typemap Dumper.xs

Dumper.xsc && mv Dumper.xsc Dumper.c cc -c -DNO_MATHOMS -DPERL_DISABLE_PMC -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"2.143\" -DXS_VERSION=\"2.143\" -fPIC "-I/var/lib/jenkins/perl/perl-5.10.1/lib/5.10.1/x86_64-linux/CORE" -DUSE_PPPORT_H Dumper.c Running Mkbootstrap for Data​::Dumper () chmod 644 Dumper.bs rm -f blib/arch/auto/Data/Dumper/Dumper.so cc -shared -O2 -fstack-protector Dumper.o -o blib/arch/auto/Data/Dumper/Dumper.so \ \

chmod 755 blib/arch/auto/Data/Dumper/Dumper.so cp Dumper.bs blib/arch/auto/Data/Dumper/Dumper.bs chmod 644 blib/arch/auto/Data/Dumper/Dumper.bs PERL_DL_NONLAZY=1 /var/lib/jenkins/perl/perl-5.10.1/bin/perl "-MExtUtils​::Command​::MM" "-e" "test_harness(0\, 'blib/lib'\, 'blib/arch')" t/*.t t/bless.t ..................... 1/11 Undefined subroutine &Data​::Dumper​::Dumpxs called at /home/jenkins/.cpan/build/Data-Dumper-2.143-5tgcqI/blib/lib/Data/Dumper.pm line 222. # Looks like you planned 11 tests but ran 1. # Looks like your test exited with 255 just after 1. t/bless.t ..................... Dubious\, test returned 255 (wstat 65280\, 0xff00) Failed 10/11 subtests ...

t/indent.t .................... Use of implicit split to @​_ is deprecated at t/indent.t line 100. Use of implicit split to @​_ is deprecated at t/indent.t line 101. t/indent.t .................... 1/10 # Failed test 'Indent(3) annotates array elements with their indices' # at t/indent.t line 96. # '$VAR1 = [ # #0 # 'foo'\, # #1 # 42 # ]; # ' # doesn't match '(?s-xim​:\#0.+'foo'.+\#1.+'42')' # Looks like you failed 1 test of 10. t/indent.t .................... Dubious\, test returned 1 (wstat 256\, 0x100) Failed 1/10 subtests

Unless my eyes deceive me (it has happened!)\, the only difference I see between the got and the expected is the absence of quoting around '42' in the got.

This sounds like the same problem being discussed in RT #72794.

Thank you very much. Jim Keenan

p5pRT commented 11 years ago

From @dolmen

According to cpantesters reports\, tests of Data​::Dumper 2.143 fail on everything below 5.14.

p5pRT commented 11 years ago

From [Unknown Contact. See original ticket]

According to cpantesters reports\, tests of Data​::Dumper 2.143 fail on everything below 5.14.

p5pRT commented 11 years ago

From @jkeenan

On Thu Feb 28 08​:45​:23 2013\, dolmen wrote​:

According to cpantesters reports\, tests of Data​::Dumper 2.143 fail on everything below 5.14.

It's worse. On each of two different machines\, I used the 'cpan' shell to 'test Data​::Dumper'. I then inserted a debugging line calling out the D​::D version number into Dumper.pm in each location. I then used my everyday\, recent versions of 'prove' and 'perl' to run one file from the test suite. I got different results on the two different machines.

See attached. The 5.16.0 on Linux was built from source; the 5.16.2 on Darwin was installed using 'perlbrew'. On Darwin\, with 5.16.2\, running the test with 'perl' gave the same error we're seeing on all those pre-5.14.0 cpantesters.

While many tests were added to the distro between D​::D 2.139 and 2.143\, the code changes to the key files\, Dumper.pm and Dumper.xs\, were relatively small. So I'm at a loss as to how to explain this.

Help!

Thank you very much. Jim Keenan

p5pRT commented 11 years ago

From @jkeenan

Results on Linux/i386​: This is perl 5\, version 16\, subversion 0 (v5.16.0) built for i686-linux

[li11-226​:Data-Dumper-2.143-7fodS5] 515 $ prove -vb t/bless.t t/bless.t .. 1..11 $Data​::Dumper​::VERSION​: 2.143 ok 1 - use Data​::Dumper; ok 2 - package name in bless is escaped if needed ok 3 - eval reverts dump ok 4 - package name in bless is escaped if needed ok 5 - eval reverts dump ok 6 - We can dump blessed qr//'s properly ok 7 - package name in bless is escaped if needed ok 8 - eval reverts dump ok 9 - package name in bless is escaped if needed ok 10 - eval reverts dump ok 11 - We can dump blessed qr//'s properly ok All tests successful. Files=1\, Tests=11\, 0 wallclock secs ( 0.03 usr 0.00 sys + 0.05 cusr 0.00 csys = 0.08 CPU) Result​: PASS [li11-226​:Data-Dumper-2.143-7fodS5] 516 $ /usr/local/bin/perl -Iblib/lib t/bless.t 1..11 $Data​::Dumper​::VERSION​: 2.143 ok 1 - use Data​::Dumper; ok 2 - package name in bless is escaped if needed ok 3 - eval reverts dump ok 4 - package name in bless is escaped if needed ok 5 - eval reverts dump ok 6 - We can dump blessed qr//'s properly ok 7 - package name in bless is escaped if needed ok 8 - eval reverts dump ok 9 - package name in bless is escaped if needed ok 10 - eval reverts dump ok 11 - We can dump blessed qr//'s properly

Results on Darwin x86_64​: This is perl 5\, version 16\, subversion 2 (v5.16.2) built for darwin-2level

$ prove -vb t/bless.t t/bless.t .. 1..11 $Data​::Dumper​::VERSION​: 2.143 ok 1 - use Data​::Dumper; ok 2 - package name in bless is escaped if needed ok 3 - eval reverts dump ok 4 - package name in bless is escaped if needed ok 5 - eval reverts dump ok 6 - We can dump blessed qr//'s properly ok 7 - package name in bless is escaped if needed ok 8 - eval reverts dump ok 9 - package name in bless is escaped if needed ok 10 - eval reverts dump ok 11 - We can dump blessed qr//'s properly ok All tests successful. Files=1\, Tests=11\, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.04 cusr 0.00 csys = 0.08 CPU) Result​: PASS

$ perl -Iblib/lib t/bless.t 1..11 $Data​::Dumper​::VERSION​: 2.143 ok 1 - use Data​::Dumper; Undefined subroutine &Data​::Dumper​::Dumpxs called at blib/lib/Data/Dumper.pm line 223. # Looks like you planned 11 tests but ran 1. # Looks like your test exited with 255 just after 1.

p5pRT commented 11 years ago

From @xdg

On Thu\, Feb 28\, 2013 at 7​:08 PM\, James E Keenan via RT \perlbug\-followup@&#8203;perl\.org wrote​:

Undefined subroutine &Data​::Dumper​::Dumpxs called at blib/lib/Data/Dumper.pm line 223.

I've tried commenting on perlbug and it's eating my replies\, so I'll reply here. Apologies if it shows up multiple times.

Problem is that tests are overriding $Data​::Dumper​::Useperl when they shouldn't (trying to test XS when XS doesn't work).

On older Perl's\, XS doesn't load because of a missing symbol​:

  Symbol not found​: _isWORDCHAR

David

-- David Golden \xdg@&#8203;xdg\.me Take back your inbox! → http​://www.bunchmail.com/ Twitter/IRC​: @​xdg

p5pRT commented 11 years ago

From @jkeenan

On Sat Mar 02 19​:58​:34 2013\, xdg@​xdg.me wrote​:

On Thu\, Feb 28\, 2013 at 7​:08 PM\, James E Keenan via RT \perlbug\-followup@&#8203;perl\.org wrote​:

Undefined subroutine &Data​::Dumper​::Dumpxs called at blib/lib/Data/Dumper.pm line 223.

I've tried commenting on perlbug and it's eating my replies\, so I'll reply here. Apologies if it shows up multiple times.

Problem is that tests are overriding $Data​::Dumper​::Useperl when they shouldn't (trying to test XS when XS doesn't work).

On older Perl's\, XS doesn't load because of a missing symbol​:

Symbol not found&#8203;: \_isWORDCHAR

David

David\, I don't understand your response. It doesn't seem to take into account the problem I reported in my most recent (Feb 28) post\, namely\, that I can reproduce the problem on a current (5.16.0) Perl on at least one operating system (Darwin). (And I've since reproduced it on a second Darwin machine\, this time Darwin/PPC.)

Moreover\, the test file that I used to demonstrate this in my last post\, t/bless.t\, is one file to which we made no changes whatsoever in going from D​::D 2.139 to 2.143. So even if the "tests are overriding $Data​::Dumper​::Useperl when they shouldn't"\, why is this problem only showing up with 2.143 and not earlier versions?

I'm attaching output from three different ways of testing one test file from D​::D 2.143 on the same (Darwin) machine​: (a) with the latest installed 'prove'; (b) with installed perl 5.16; (c) with blead as of today.

Thank you very much. Jim Keenan

p5pRT commented 11 years ago

From @jkeenan

[Data-Dumper-2.143-9VJyiY] $ prove -vb t/bless.t t/bless.t .. 1..11 ok 1 - use Data​::Dumper; ok 2 - package name in bless is escaped if needed ok 3 - eval reverts dump ok 4 - package name in bless is escaped if needed ok 5 - eval reverts dump ok 6 - We can dump blessed qr//'s properly ok 7 - package name in bless is escaped if needed ok 8 - eval reverts dump ok 9 - package name in bless is escaped if needed ok 10 - eval reverts dump ok 11 - We can dump blessed qr//'s properly ok All tests successful. Files=1\, Tests=11\, 1 wallclock secs ( 0.13 usr 0.04 sys + 0.22 cusr 0.05 csys = 0.44 CPU) Result​: PASS

[Data-Dumper-2.143-9VJyiY] $ perl -Iblib/lib t/bless.t 1..11 ok 1 - use Data​::Dumper; Undefined subroutine &Data​::Dumper​::Dumpxs called at blib/lib/Data/Dumper.pm line 222. # Looks like you planned 11 tests but ran 1. # Looks like your test exited with 255 just after 1.

[Data-Dumper-2.143-9VJyiY] $~/gitwork/perl/perl -Iblib/lib -I/Users/jimk/gitwork/perl/lib -I/Users/jimk/gitwork/perl/cpan/Test-Simple/lib t/bless.t 1..11 ok 1 - use Data​::Dumper; ok 2 - package name in bless is escaped if needed ok 3 - eval reverts dump ok 4 - package name in bless is escaped if needed ok 5 - eval reverts dump ok 6 - We can dump blessed qr//'s properly ok 7 - package name in bless is escaped if needed ok 8 - eval reverts dump ok 9 - package name in bless is escaped if needed ok 10 - eval reverts dump ok 11 - We can dump blessed qr//'s properly

p5pRT commented 11 years ago

From @xdg

On Sun\, Mar 3\, 2013 at 9​:03 PM\, James E Keenan via RT \perlbug\-followup@&#8203;perl\.org wrote​:

[Data-Dumper-2.143-9VJyiY] $ perl -Iblib/lib t/bless.t

Try 'perl -Mblib t/bless.t'

-Iblib/lib is not sufficient because it doesn't set up the architecture specific library correctly

Regardless\, if $Data​::Dumper​::Useperl is true after Data​::Dumper is loaded\, tests MUST NOT override it to false to test XS.

My opinion is that there should be one set of tests that doesn't touch Useperl. It will be XS or pure perl depending on whether the XS works.

Then have another set of tests that localizes $Useperl to 1. This tests the pure perl variation. Those tests can be skipped if $Useperl is already 1.

Once all that is fixed\, see if you still have problems wherever you see them now.

David

-- David Golden \xdg@&#8203;xdg\.me Take back your inbox! → http​://www.bunchmail.com/ Twitter/IRC​: @​xdg

p5pRT commented 11 years ago

From @jkeenan

On Sat Mar 02 19​:58​:34 2013\, xdg@​xdg.me wrote​:

On older Perl's\, XS doesn't load because of a missing symbol​:

Symbol not found&#8203;: \_isWORDCHAR

Does this mean that\, going forward from 2.143\, we should not support the XS version when compiled on Perls older than 5.14.0?

From a maintenance point-of-view\, I would endorse that.

Thank you very much. Jim Keenan

p5pRT commented 11 years ago

From @jkeenan

On Mon Mar 04 10​:40​:08 2013\, xdg@​xdg.me wrote​:

On Sun\, Mar 3\, 2013 at 9​:03 PM\, James E Keenan via RT \perlbug\-followup@&#8203;perl\.org wrote​:

[Data-Dumper-2.143-9VJyiY] $ perl -Iblib/lib t/bless.t

Try 'perl -Mblib t/bless.t'

-Iblib/lib is not sufficient because it doesn't set up the architecture specific library correctly

Ah\, that's what I was missing.

Regardless\, if $Data​::Dumper​::Useperl is true after Data​::Dumper is loaded\, tests MUST NOT override it to false to test XS.

My opinion is that there should be one set of tests that doesn't touch Useperl. It will be XS or pure perl depending on whether the XS works.

Then have another set of tests that localizes $Useperl to 1. This tests the pure perl variation. Those tests can be skipped if $Useperl is already 1.

I am working on this. Since there are quite a few test files to look at it\, it will take some time.

Thank you very much. Jim Keenan

p5pRT commented 11 years ago

From @tsee

On 03/07/2013 03​:55 AM\, James E Keenan via RT wrote​:

On Sat Mar 02 19​:58​:34 2013\, xdg@​xdg.me wrote​:

On older Perl's\, XS doesn't load because of a missing symbol​:

 Symbol not found&#8203;: \_isWORDCHAR

Does this mean that\, going forward from 2.143\, we should not support the XS version when compiled on Perls older than 5.14.0?

From a maintenance point-of-view\, I would endorse that.

That would cripple the module.

--Steffen

p5pRT commented 11 years ago

From @bulk88

On Wed Mar 06 21​:36​:36 2013\, smueller@​cpan.org wrote​:

On 03/07/2013 03​:55 AM\, James E Keenan via RT wrote​:

On Sat Mar 02 19​:58​:34 2013\, xdg@​xdg.me wrote​:

On older Perl's\, XS doesn't load because of a missing symbol​:

 Symbol not found&#8203;: \_isWORDCHAR

Does this mean that\, going forward from 2.143\, we should not support the XS version when compiled on Perls older than 5.14.0?

From a maintenance point-of-view\, I would endorse that.

That would cripple the module.

--Steffen

would ppport.h help?

-- bulk88 ~ bulk88 at hotmail.com

p5pRT commented 11 years ago

From @demerphq

On 4 March 2013 19​:38\, David Golden \xdg@&#8203;xdg\.me wrote​:

On Sun\, Mar 3\, 2013 at 9​:03 PM\, James E Keenan via RT \perlbug\-followup@&#8203;perl\.org wrote​:

[Data-Dumper-2.143-9VJyiY] $ perl -Iblib/lib t/bless.t

Try 'perl -Mblib t/bless.t'

-Iblib/lib is not sufficient because it doesn't set up the architecture specific library correctly

Regardless\, if $Data​::Dumper​::Useperl is true after Data​::Dumper is loaded\, tests MUST NOT override it to false to test XS.

My opinion is that there should be one set of tests that doesn't touch Useperl. It will be XS or pure perl depending on whether the XS works.

Then have another set of tests that localizes $Useperl to 1. This tests the pure perl variation. Those tests can be skipped if $Useperl is already 1.

Unless DD has changed more than I think it is not just $Useperl that overrides XS\, it is also $Useqq.

Yves

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

p5pRT commented 11 years ago

From @jkeenan

On Thu Mar 07 02​:26​:54 2013\, demerphq wrote​:

Unless DD has changed more than I think it is not just $Useperl that overrides XS\, it is also $Useqq.

And probably $Deparse as well\, as suggested by the following code from Dumper.pm​:

######### 223 unless $Data​::Dumper​::Useperl || (ref($_[0]) && $_[0]->{useperl}) || 224 $Data​::Dumper​::Useqq || (ref($_[0]) && $_[0]->{useqq}) || 225 $Data​::Dumper​::Deparse || (ref($_[0]) && $_[0]->{deparse}); 226 return &Dumpperl; #########

However\, the immediate problem is that much of the test suite has been developed on the basis of "Let's make sure we test both the XS and pure-perl versions."

p5pRT commented 11 years ago

From @jkeenan

On Wed Mar 06 21​:36​:36 2013\, smueller@​cpan.org wrote​:

On 03/07/2013 03​:55 AM\, James E Keenan via RT wrote​:

On Sat Mar 02 19​:58​:34 2013\, xdg@​xdg.me wrote​:

On older Perl's\, XS doesn't load because of a missing symbol​:

 Symbol not found&#8203;: \_isWORDCHAR

Does this mean that\, going forward from 2.143\, we should not support the XS version when compiled on Perls older than 5.14.0?

From a maintenance point-of-view\, I would endorse that.

That would cripple the module.

Well\, do you have a way around the problem David describes above?

I am in the process of restructuring the test suite so as not to mix tests of the XS and pure perl versions inappropriately. That will resolve most of the test failures\, but not all of them.

p5pRT commented 11 years ago

From @ribasushi

On Thu\, Mar 07\, 2013 at 03​:23​:18AM -0800\, James E Keenan via RT wrote​:

On Wed Mar 06 21​:36​:36 2013\, smueller@​cpan.org wrote​:

On 03/07/2013 03​:55 AM\, James E Keenan via RT wrote​:

On Sat Mar 02 19​:58​:34 2013\, xdg@​xdg.me wrote​:

On older Perl's\, XS doesn't load because of a missing symbol​:

 Symbol not found&#8203;: \_isWORDCHAR

Does this mean that\, going forward from 2.143\, we should not support the XS version when compiled on Perls older than 5.14.0?

From a maintenance point-of-view\, I would endorse that.

That would cripple the module.

Well\, do you have a way around the problem David describes above?

I am in the process of restructuring the test suite so as not to mix tests of the XS and pure perl versions inappropriately. That will resolve most of the test failures\, but not all of them.

Please do not do this. For one you could inadevertently insert mistakes into the tests \, and moreover this is the wrong thing to do overall. Here is my train of thought​:

This is not an ivory-tower nice-to-have - after all there is code in the wild (and probably even on CPAN) which uses D​::D as a poor man's Sereal or some-such. Telling them "you need to upgrade this module\, oh and btw your serialization code is now 100x slower" is... I can't find the right expletive ;)

Also it is frustrating because of the actual barrier to entry for a profficient C programmer - it does look like a much more trivial fix in C-land\, an ifdef or somesuch (but again - my C is laughable). So while I or anyone else could spend time "fixing" the tests\, it is ultimately wasted effort. Mainly because it will take someone with sufficient knowledge of the machinery (ideally the person who broke it in the first place) about 30 seconds to decide where the ifdef needs to live.

Please reconsider this paper-over\, this is not progress by any stretch of imagination.

p5pRT commented 11 years ago

From @xdg

On Thu\, Mar 7\, 2013 at 6​:43 AM\, Peter Rabbitson \rabbit\-p5p@&#8203;rabbit\.us wrote​:

This is not an ivory-tower nice-to-have - after all there is code in the wild (and probably even on CPAN) which uses D​::D as a poor man's Sereal or some-such. Telling them "you need to upgrade this module\, oh and btw your serialization code is now 100x slower" is... I can't find the right expletive ;)

Should we reconsider having a pure perl version at all?

Then someone who tries to upgrade without a compiler just gets "BOOM" instead of something that works but is 100x slower.

David

-- David Golden \xdg@&#8203;xdg\.me Take back your inbox! → http​://www.bunchmail.com/ Twitter/IRC​: @​xdg

p5pRT commented 11 years ago

From @ribasushi

On Thu\, Mar 07\, 2013 at 06​:48​:19AM -0500\, David Golden wrote​:

On Thu\, Mar 7\, 2013 at 6​:43 AM\, Peter Rabbitson \rabbit\-p5p@&#8203;rabbit\.us wrote​:

This is not an ivory-tower nice-to-have - after all there is code in the wild (and probably even on CPAN) which uses D​::D as a poor man's Sereal or some-such. Telling them "you need to upgrade this module\, oh and btw your serialization code is now 100x slower" is... I can't find the right expletive ;)

Should we reconsider having a pure perl version at all?

Then someone who tries to upgrade without a compiler just gets "BOOM" instead of something that works but is 100x slower.

This is in interesting thought\, with parallels to the Scalar​::Util fiasco. And in fact currently this *is* the case - D​::D will not build its XS portion and will fail tests. So in a sense it does go BOOM just not early enough.

The problem is however that (unlike S​::U) the PP version is the complete implementation\, and the XS is an incomplete (no deparse and other stuff) but vastly more efficient implementation.

But still - +1 on not building without the XS portion (i.e. a make-time failure\, not a make test-time failure)

p5pRT commented 11 years ago

From @tsee

On 03/07/2013 10​:21 AM\, bulk88 via RT wrote​:

On Wed Mar 06 21​:36​:36 2013\, smueller@​cpan.org wrote​:

On 03/07/2013 03​:55 AM\, James E Keenan via RT wrote​:

On Sat Mar 02 19​:58​:34 2013\, xdg@​xdg.me wrote​:

On older Perl's\, XS doesn't load because of a missing symbol​:

  Symbol not found&#8203;: \_isWORDCHAR

Does this mean that\, going forward from 2.143\, we should not support the XS version when compiled on Perls older than 5.14.0?

From a maintenance point-of-view\, I would endorse that.

That would cripple the module.

would ppport.h help?

I'd be surprised if it doesn't ship with ppport.h - so no.

--Steffen

p5pRT commented 11 years ago

From @xdg

On Thu\, Mar 7\, 2013 at 6​:52 AM\, Peter Rabbitson \rabbit\-p5p@&#8203;rabbit\.us wrote​:

But still - +1 on not building without the XS portion (i.e. a make-time failure\, not a make test-time failure)

Or\, make the Makefile.PL check for a compiler and fail at configure time.

David

-- David Golden \xdg@&#8203;xdg\.me Take back your inbox! → http​://www.bunchmail.com/ Twitter/IRC​: @​xdg

p5pRT commented 11 years ago

From @jkeenan

On Thu Mar 07 03​:23​:17 2013\, jkeenan wrote​:

On Wed Mar 06 21​:36​:36 2013\, smueller@​cpan.org wrote​:

On 03/07/2013 03​:55 AM\, James E Keenan via RT wrote​:

On Sat Mar 02 19​:58​:34 2013\, xdg@​xdg.me wrote​:

On older Perl's\, XS doesn't load because of a missing symbol​:

 Symbol not found&#8203;: \_isWORDCHAR

Does this mean that\, going forward from 2.143\, we should not support the XS version when compiled on Perls older than 5.14.0?

From a maintenance point-of-view\, I would endorse that.

That would cripple the module.

Well\, do you have a way around the problem David describes above?

I am in the process of restructuring the test suite so as not to mix tests of the XS and pure perl versions inappropriately. That will resolve most of the test failures\, but not all of them.

Thanks to a conversation on #p5p tonight including rjbs\, xdg\, khw\, perigrin\, mauke and myself\, we have a diagnosis and a proposed fix.

I have reworked the test suite along lines suggested by xdg to separate out tests of the XS and pure-perl versions.

And if we revert a change introduced in Data-Dumper 2.140 (a version which appeared in blead but was not pushed to CPAN)\, we get the tests passing at least back to 5.12.0.

I am attaching a patch which\, I stress\, began from Data-Dumper v2.143 *on CPAN* rather than from blead. So this patch includes files that we would not have to include in blead. It should\, however\, suffice for the purpose of code review. See also https://github.com/jkeenan/Data-Dumper.

p5pRT commented 11 years ago

From @jkeenan

116961_corrections_to_2_143.diff

p5pRT commented 11 years ago

From @khwilliamson

On 03/07/2013 08​:05 PM\, James E Keenan via RT wrote​:

On Thu Mar 07 03​:23​:17 2013\, jkeenan wrote​:

On Wed Mar 06 21​:36​:36 2013\, smueller@​cpan.org wrote​:

On 03/07/2013 03​:55 AM\, James E Keenan via RT wrote​:

On Sat Mar 02 19​:58​:34 2013\, xdg@​xdg.me wrote​:

On older Perl's\, XS doesn't load because of a missing symbol​:

  Symbol not found&#8203;: \_isWORDCHAR

Does this mean that\, going forward from 2.143\, we should not support the XS version when compiled on Perls older than 5.14.0?

From a maintenance point-of-view\, I would endorse that.

That would cripple the module.

Well\, do you have a way around the problem David describes above?

I am in the process of restructuring the test suite so as not to mix tests of the XS and pure perl versions inappropriately. That will resolve most of the test failures\, but not all of them.

Thanks to a conversation on #p5p tonight including rjbs\, xdg\, khw\, perigrin\, mauke and myself\, we have a diagnosis and a proposed fix.

I have reworked the test suite along lines suggested by xdg to separate out tests of the XS and pure-perl versions.

And if we revert a change introduced in Data-Dumper 2.140 (a version which appeared in blead but was not pushed to CPAN)\, we get the tests passing at least back to 5.12.0.

I am attaching a patch which\, I stress\, began from Data-Dumper v2.143 *on CPAN* rather than from blead. So this patch includes files that we would not have to include in blead. It should\, however\, suffice for the purpose of code review. See also https://github.com/jkeenan/Data-Dumper.

--- via perlbug​: queue​: perl5 status​: open https://rt-archive.perl.org/perl5/Ticket/Display.html?id=116961

I think it would be slightly preferable to not revert the isWORDCHAR patch\, but to define it in older Perls to be isALNUM.

p5pRT commented 11 years ago

From @jkeenan

On Thu Mar 07 21​:57​:05 2013\, public@​khwilliamson.com wrote​:

I think it would be slightly preferable to not revert the isWORDCHAR patch\, but to define it in older Perls to be isALNUM.

I myself would not know how to do that. Could you supply a patch?

Thank you very much. Jim Keenan

p5pRT commented 11 years ago

From @khwilliamson

On 03/08/2013 05​:55 AM\, James E Keenan via RT wrote​:

On Thu Mar 07 21​:57​:05 2013\, public@​khwilliamson.com wrote​:

I think it would be slightly preferable to not revert the isWORDCHAR patch\, but to define it in older Perls to be isALNUM.

I myself would not know how to do that. Could you supply a patch?

Thank you very much. Jim Keenan

--- via perlbug​: queue​: perl5 status​: open https://rt-archive.perl.org/perl5/Ticket/Display.html?id=116961

Attached

p5pRT commented 11 years ago

From @khwilliamson

0001-Allow-Data-Dumper-to-work-on-older-Perls.patch ```diff From cf0365fd76de95b0b39ec8872b094104973b860a Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Fri, 8 Mar 2013 10:01:45 -0700 Subject: [PATCH] Allow Data::Dumper to work on older Perls Commit 0eb30aebe20a48d634d4e484bc9e6005dffc1420 changed D:D to use the macro isWORDCHAR instead of isALNUM. The problem is that this macro is not defined in older Perls. This new commit defines isWORDCHAR to be isALNUM when it isn't already defined, thus avoiding the problem. --- dist/Data-Dumper/Dumper.xs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dist/Data-Dumper/Dumper.xs b/dist/Data-Dumper/Dumper.xs index d0f7145..b74650a 100644 --- a/dist/Data-Dumper/Dumper.xs +++ b/dist/Data-Dumper/Dumper.xs @@ -12,6 +12,10 @@ # define DD_USE_OLD_ID_FORMAT #endif +#ifndef isWORDCHAR +# define isWORDCHAR(c) isALNUM(c) +#endif + static I32 num_q (const char *s, STRLEN slen); static I32 esc_q (char *dest, const char *src, STRLEN slen); static I32 esc_q_utf8 (pTHX_ SV *sv, const char *src, STRLEN slen); -- 1.8.1.3 ```
p5pRT commented 11 years ago

From @ribasushi

On Fri\, Mar 08\, 2013 at 10​:08​:43AM -0700\, Karl Williamson wrote​:

--- a/dist/Data-Dumper/Dumper.xs +++ b/dist/Data-Dumper/Dumper.xs @​@​ -12\,6 +12\,10 @​@​ # define DD_USE_OLD_ID_FORMAT #endif

+#ifndef isWORDCHAR +# define isWORDCHAR(c) isALNUM(c) +#endif + static I32 num_q (const char *s\, STRLEN slen); static I32 esc_q (char *dest\, const char *src\, STRLEN slen); static I32 esc_q_utf8 (pTHX_ SV *sv\, const char *src\, STRLEN slen);

I find it ironic that what I said here [1] turned out to be 100% correct. So now we have a ton of time wasted by Jim Keenan and tests rewritten for no reason other than possibly introducing extra bugs to them. Way to go :(

[1] http​://www.nntp.perl.org/group/perl.perl5.porters/2013/03/msg199881.html

p5pRT commented 11 years ago

From chris@prather.org

On Friday\, March 8\, 2013\, Karl Williamson wrote​:

On 03/08/2013 05​:55 AM\, James E Keenan via RT wrote​:

On Thu Mar 07 21​:57​:05 2013\, public@​khwilliamson.com wrote​:

I think it would be slightly preferable to not revert the isWORDCHAR patch\, but to define it in older Perls to be isALNUM.

I myself would not know how to do that. Could you supply a patch?

Thank you very much. Jim Keenan

--- via perlbug​: queue​: perl5 status​: open https​://rt.perl.org​:443/rt3/**Ticket/Display.html?id=116961\https://rt-archive.perl.org/perl5/Ticket/Display.html?id=116961

Attached

I'm worse than riba at C and the bowls of the XS toolchain but it seems that something like this should probably end up in ppport.h so that others (not Data​::Dumper) can take advantage of this same aliasing. No?

Karl and Jim both stated last night on IRC they didn't know how to do that\, and I certainly don't but maybe someone playing along at home could point in the right direction and one of us can take care of it?

-Chris

p5pRT commented 11 years ago

From @Hugmeir

On Fri\, Mar 8\, 2013 at 2​:08 PM\, Karl Williamson \public@&#8203;khwilliamson\.com wrote​:

On 03/08/2013 05​:55 AM\, James E Keenan via RT wrote​:

On Thu Mar 07 21​:57​:05 2013\, public@​khwilliamson.com wrote​:

I think it would be slightly preferable to not revert the isWORDCHAR patch\, but to define it in older Perls to be isALNUM.

I myself would not know how to do that. Could you supply a patch?

Thank you very much. Jim Keenan

--- via perlbug​: queue​: perl5 status​: open https://rt-archive.perl.org/perl5/Ticket/Display.html?id=116961

Shouldn't isWORDCHAR(c)'s definition be (isALNUM(c) || *(c) == '_')?

p5pRT commented 11 years ago

From @jkeenan

On Fri Mar 08 09​:58​:59 2013\, Hugmeir wrote​:

Shouldn't isWORDCHAR(c)'s definition be (isALNUM(c) || *(c) == '_')?

I suspect the answer to that starts with​: "Do it in a branch and push to a smoke me."

p5pRT commented 11 years ago

From @khwilliamson

On 03/08/2013 11​:01 AM\, James E Keenan via RT wrote​:

On Fri Mar 08 09​:58​:59 2013\, Hugmeir wrote​:

Shouldn't isWORDCHAR(c)'s definition be (isALNUM(c) || *(c) == '_')?

I suspect the answer to that starts with​: "Do it in a branch and push to a smoke me."

--- via perlbug​: queue​: perl5 status​: open https://rt-archive.perl.org/perl5/Ticket/Display.html?id=116961

The answer to this is no\, and reinforces why I made the change in the first place. isALNUM is identical to isWORDCHAR\, but is misleadingly named\, and that name has led you guys astray.

There is an isALNUMC\, as well. I believe the extra C means that it is the C language's version of an alphanumeric. So this is correct​:

  isWORDCHAR === isALNUM === (isALNUMC(c) || *(c) == '_')

p5pRT commented 11 years ago

From @khwilliamson

On 03/08/2013 10​:17 AM\, Peter Rabbitson wrote​:

On Fri\, Mar 08\, 2013 at 10​:08​:43AM -0700\, Karl Williamson wrote​:

--- a/dist/Data-Dumper/Dumper.xs +++ b/dist/Data-Dumper/Dumper.xs @​@​ -12\,6 +12\,10 @​@​ # define DD_USE_OLD_ID_FORMAT #endif

+#ifndef isWORDCHAR +# define isWORDCHAR(c) isALNUM(c) +#endif + static I32 num_q (const char *s\, STRLEN slen); static I32 esc_q (char *dest\, const char *src\, STRLEN slen); static I32 esc_q_utf8 (pTHX_ SV *sv\, const char *src\, STRLEN slen);

I find it ironic that what I said here [1] turned out to be 100% correct. So now we have a ton of time wasted by Jim Keenan and tests rewritten for no reason other than possibly introducing extra bugs to them. Way to go :(

[1] http​://www.nntp.perl.org/group/perl.perl5.porters/2013/03/msg199881.html

I am the one who broke it in the first place\, and you were right that that person could simply add an #ifdef in the right place.

The reason I didn't notice that I was the culprit is because of the leading underscore in the error message. I knew I hadn't done that. Yesterday on #irc\, someone pointed out that that the underscore might be added by some C compilers; something I didn't know.

My point is that we all come here with varying skill sets and knowledge; and no one knows it all. Hopefully we learn from our and others' mistakes\, and we make fewer over time.

I made the change that broke D​:D for older Perls. I did not realize there was an issue in patching a core module in that it could be dual-lived. perlhack does not address the issue. Our documentation needs to be updated about this; I don't know what it should say. Suggestions welcome.

I haven't been following this thread\, because it is out of my area of expertise\, so I don't understand the issues\, and don't have an opinion on what is best. I do believe that your statement "Way to go" is demotivating of people who have worked on it\, and was unnecessary and anti-constructive.

One lesson that could be learned from this is to use Nicholas Clark's bisect tool early. That would have pinned me as the culprit\, and I would have gotten involved then. I suspect that you have enough expertise so that you could have done that yourself.

Karl Williamson

p5pRT commented 11 years ago

From @khwilliamson

On 03/08/2013 11​:27 AM\, Karl Williamson wrote​:

On 03/08/2013 11​:01 AM\, James E Keenan via RT wrote​:

On Fri Mar 08 09​:58​:59 2013\, Hugmeir wrote​:

Shouldn't isWORDCHAR(c)'s definition be (isALNUM(c) || *(c) == '_')?

I suspect the answer to that starts with​: "Do it in a branch and push to a smoke me."

--- via perlbug​: queue​: perl5 status​: open https://rt-archive.perl.org/perl5/Ticket/Display.html?id=116961

The answer to this is no\, and reinforces why I made the change in the first place. isALNUM is identical to isWORDCHAR\, but is misleadingly named\, and that name has led you guys astray.

There is an isALNUMC\, as well. I believe the extra C means that it is the C language's version of an alphanumeric. So this is correct​:

isWORDCHAR === isALNUM === (isALNUMC(c) || *(c) == '_')

I forgot to mention that I've added a new synonym in 5.17 for isALNUMC; and it is isALPHANUMERIC. I think that is much clearer; I couldn't think of a shorter name\, since isALNUM was already taken.

p5pRT commented 11 years ago

From @ribasushi

On Fri\, Mar 08\, 2013 at 11​:43​:38AM -0700\, Karl Williamson wrote​:

On 03/08/2013 10​:17 AM\, Peter Rabbitson wrote​:

On Fri\, Mar 08\, 2013 at 10​:08​:43AM -0700\, Karl Williamson wrote​:

--- a/dist/Data-Dumper/Dumper.xs +++ b/dist/Data-Dumper/Dumper.xs @​@​ -12\,6 +12\,10 @​@​ # define DD_USE_OLD_ID_FORMAT #endif

+#ifndef isWORDCHAR +# define isWORDCHAR(c) isALNUM(c) +#endif + static I32 num_q (const char *s\, STRLEN slen); static I32 esc_q (char *dest\, const char *src\, STRLEN slen); static I32 esc_q_utf8 (pTHX_ SV *sv\, const char *src\, STRLEN slen);

I find it ironic that what I said here [1] turned out to be 100% correct. So now we have a ton of time wasted by Jim Keenan and tests rewritten for no reason other than possibly introducing extra bugs to them. Way to go :(

[1] http​://www.nntp.perl.org/group/perl.perl5.porters/2013/03/msg199881.html

I am the one who broke it in the first place\, and you were right that that person could simply add an #ifdef in the right place.

The reason I didn't notice that I was the culprit is because of the leading underscore in the error message. I knew I hadn't done that. Yesterday on #irc\, someone pointed out that that the underscore might be added by some C compilers; something I didn't know.

My point is that we all come here with varying skill sets and knowledge; and no one knows it all. Hopefully we learn from our and others' mistakes\, and we make fewer over time.

I made the change that broke D​:D for older Perls. I did not realize there was an issue in patching a core module in that it could be dual-lived. perlhack does not address the issue. Our documentation needs to be updated about this; I don't know what it should say. Suggestions welcome.

I haven't been following this thread\, because it is out of my area of expertise\, so I don't understand the issues\, and don't have an opinion on what is best. I do believe that your statement "Way to go" is demotivating of people who have worked on it\, and was unnecessary and anti-constructive.

The "way to go" comment was only aimed at the fact that now we have a rewritten D​::D test suite\, which in my opinion is very anti-constructive (in fact outright dangerous). That despite me earlier chiming in wrt the test suite "problem" being a red herring. I still maintain that this (splitting of the tests) should not have happened.

One lesson that could be learned from this is to use Nicholas Clark's bisect tool early. That would have pinned me as the culprit\, and I would have gotten involved then. I suspect that you have enough expertise so that you could have done that yourself.

I (apparently wrongly) assumed that the underlying problem (failure to compile the .xs part) was apparent from the first message referencing this issue. As I noted earlier - I do not know much about the lifecycle of a C program (including compilation linking and all other vagaries). Hence I automatically assume to be at the bottom of that particular foodchain\, and if *I* see something\, then "obviously" everyone else sees the problem too.

So my point of view at the time was (and still kinda is)​: "Anyone with basic C chops knows what the underlying issue is\, but refuses to fix it for "unsupported perls" on principle\, and instead the remaining folks rather piss about with working around this in the tests".

Forgive me for being exasperated given the above. My comments may be harsh but I refuse to qualify them as being "unnecessary".

Cheers

p5pRT commented 11 years ago

From @xdg

On Fri\, Mar 8\, 2013 at 1​:43 PM\, Karl Williamson \public@&#8203;khwilliamson\.com wrote​:

I made the change that broke D​:D for older Perls. I did not realize there was an issue in patching a core module in that it could be dual-lived. perlhack does not address the issue. Our documentation needs to be updated about this; I don't know what it should say. Suggestions welcome.

I think perhaps we just need a short note to the effect that anything in cpan/ and dist/ are dual-life and should not be made incompatible with older Perls without good reason and approval of the Pumpking.

With respect to attitudes\, email is hard and we all know that.

But... I think it's a good practice to assume that people on p5p have the best of intentions\, even if the results don't turn out the way we all want.

Karl was trying to make things better. So was Jim.

Peter was trying to save people on older Perl's from upgrading Data​::Dumper and slowing down. That's trying to make things better\, too.

Let's focus on the technical issues and try to respect people's intentions and effort.

David

-- David Golden \xdg@&#8203;xdg\.me Take back your inbox! → http​://www.bunchmail.com/ Twitter/IRC​: @​xdg

p5pRT commented 11 years ago

From @xdg

On Fri\, Mar 8\, 2013 at 1​:55 PM\, Peter Rabbitson \rabbit\-p5p@&#8203;rabbit\.us wrote​:

So my point of view at the time was (and still kinda is)​: "Anyone with basic C chops knows what the underlying issue is\, but refuses to fix it for "unsupported perls" on principle\, and instead the remaining folks rather piss about with working around this in the tests".

I haven't had tuits to review how the tests were split out\, but despite the missing symbol issue\, they *were* broken and would fail for anyone who installed Data​::Dumper without a compiler available.

Jim's efforts to address that weren't useless.

We had *two* bugs that needed fixing.

David.

-- David Golden \xdg@&#8203;xdg\.me Take back your inbox! → http​://www.bunchmail.com/ Twitter/IRC​: @​xdg

p5pRT commented 11 years ago

From @jkeenan

On Fri Mar 08 11​:46​:24 2013\, xdg@​xdg.me wrote​:

On Fri\, Mar 8\, 2013 at 1​:55 PM\, Peter Rabbitson \rabbit\-p5p@&#8203;rabbit\.us wrote​:

So my point of view at the time was (and still kinda is)​: "Anyone with basic C chops knows what the underlying issue is\, but refuses to fix it for "unsupported perls" on principle\, and instead the remaining folks rather piss about with working around this in the tests".

I haven't had tuits to review how the tests were split out\, but despite the missing symbol issue\, they *were* broken and would fail for anyone who installed Data​::Dumper without a compiler available.

Jim's efforts to address that weren't useless.

We had *two* bugs that needed fixing.

David.

I am attaching a new patch which is essentially the same as the last one I provided\, only specific to blead rather than CPAN. This is what should be reviewed for application to blead; I can provide Steffen with another version more specific to CPAN.

Thank you very much. Jim Keenan

p5pRT commented 11 years ago

From @jkeenan

From a39efd2d8a7371a6d6dadebc80a28d01985a0bb6 Mon Sep 17 00​:00​:00 2001 From​: James E Keenan \jkeenan@&#8203;cpan\.org Date​: Sun\, 10 Mar 2013 11​:11​:39 -0400 Subject​: [PATCH] If isWORDCHAR is not defined\, revert to using isALNUM. While testing\, separate out pure perl and XS versions. Fixes RT #116961.


MANIFEST | 1 + Porting/Maintainers.pl | 2 +- dist/Data-Dumper/Changes | 5 + dist/Data-Dumper/Dumper.pm | 4 +- dist/Data-Dumper/Dumper.xs | 4 + dist/Data-Dumper/t/bless.t | 17 +- dist/Data-Dumper/t/bless_var_method.t | 59 +---- dist/Data-Dumper/t/dumpperl.t | 296 +++++++++--------------- dist/Data-Dumper/t/freezer.t | 72 +------ dist/Data-Dumper/t/freezer_useperl.t | 106 +++++++++ dist/Data-Dumper/t/indent.t | 8 + dist/Data-Dumper/t/perl-74170.t | 22 +- dist/Data-Dumper/t/quotekeys.t | 67 +----- dist/Data-Dumper/t/sortkeys.t | 409 +++++++++++++-------------------- dist/Data-Dumper/t/sparseseen.t | 62 +---- dist/Data-Dumper/t/toaster.t | 62 +---- 16 files changed\, 465 insertions(+)\, 731 deletions(-) create mode 100644 dist/Data-Dumper/t/freezer_useperl.t

Inline Patch ```diff diff --git a/MANIFEST b/MANIFEST index 8ec86be..47de694 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3138,6 +3138,7 @@ dist/Data-Dumper/t/deparse.t See if Data::Dumper::Deparse works dist/Data-Dumper/t/dumper.t See if Data::Dumper works dist/Data-Dumper/t/dumpperl.t See if Data::Dumper::Dumpperl works dist/Data-Dumper/t/freezer.t See if Data::Dumper::Freezer works +dist/Data-Dumper/t/freezer_useperl.t See if Data::Dumper::Freezer works dist/Data-Dumper/t/indent.t See if Data::Dumper::Indent works dist/Data-Dumper/t/lib/Testing.pm Functions used in testing Data-Dumper dist/Data-Dumper/t/misc.t Miscellaneous tests for Data-Dumper diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index d8a1dcc..01811d5 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -532,7 +532,7 @@ use File::Glob qw(:case); 'Data::Dumper' => { 'MAINTAINER' => 'p5p', # Not gsar. Not ilyam. Not really smueller - 'DISTRIBUTION' => 'SMUELLER/Data-Dumper-2.143.tar.gz', + 'DISTRIBUTION' => 'SMUELLER/Data-Dumper-2.144.tar.gz', 'FILES' => q[dist/Data-Dumper], 'UPSTREAM' => 'blead', }, diff --git a/dist/Data-Dumper/Changes b/dist/Data-Dumper/Changes index d2240d7..967b8c9 100644 --- a/dist/Data-Dumper/Changes +++ b/dist/Data-Dumper/Changes @@ -6,6 +6,11 @@ Changes - public release history for Data::Dumper =over 8 +=item 2.144 (Mar 10 2013) + +If isWORDCHAR is not defined, revert to using isALNUM. While testing, +separate out pure perl and XS versions. Fixes RT #116961. + =item 2.143 (Feb 26 2013) Address vstring related test failures on 5.8: Skip tests for diff --git a/dist/Data-Dumper/Dumper.pm b/dist/Data-Dumper/Dumper.pm index e081d61..359571f 100644 --- a/dist/Data-Dumper/Dumper.pm +++ b/dist/Data-Dumper/Dumper.pm @@ -10,7 +10,7 @@ package Data::Dumper; BEGIN { - $VERSION = '2.143'; # Don't forget to set version and release + $VERSION = '2.144'; # Don't forget to set version and release } # date in POD below! #$| = 1; @@ -1400,7 +1400,7 @@ modify it under the same terms as Perl itself. =head1 VERSION -Version 2.143 (February 26 2013) +Version 2.144 (March 10 2013)) =head1 SEE ALSO diff --git a/dist/Data-Dumper/Dumper.xs b/dist/Data-Dumper/Dumper.xs index d0f7145..b74650a 100644 --- a/dist/Data-Dumper/Dumper.xs +++ b/dist/Data-Dumper/Dumper.xs @@ -12,6 +12,10 @@ # define DD_USE_OLD_ID_FORMAT #endif +#ifndef isWORDCHAR +# define isWORDCHAR(c) isALNUM(c) +#endif + static I32 num_q (const char *s, STRLEN slen); static I32 esc_q (char *dest, const char *src, STRLEN slen); static I32 esc_q_utf8 (pTHX_ SV *sv, const char *src, STRLEN slen); diff --git a/dist/Data-Dumper/t/bless.t b/dist/Data-Dumper/t/bless.t index 086332c..9866ea7 100644 --- a/dist/Data-Dumper/t/bless.t +++ b/dist/Data-Dumper/t/bless.t @@ -5,16 +5,22 @@ use Test::More 0.60; # Test::More 0.60 required because: # - is_deeply(undef, $not_undef); now works. [rt.cpan.org 9441] -BEGIN { plan tests => 1+5*2; } +BEGIN { plan tests => 1+2*5; } BEGIN { use_ok('Data::Dumper') }; # RT 39420: Data::Dumper fails to escape bless class name -# test under XS and pure Perl version -foreach $Data::Dumper::Useperl (0, 1) { +run_tests_for_bless(); +SKIP: { + skip "XS version was unavailable, so we already ran with pure Perl", 5 + if $Data::Dumper::Useperl; + local $Data::Dumper::Useperl = 1; + run_tests_for_bless(); +} -#diag("\$Data::Dumper::Useperl = $Data::Dumper::Useperl"); +sub run_tests_for_bless { +note("\$Data::Dumper::Useperl = $Data::Dumper::Useperl"); { my $t = bless( {}, q{a'b} ); @@ -52,4 +58,5 @@ PERL_LEGACY is($dt, $o, "We can dump blessed qr//'s properly"); } -} + +} # END sub run_tests_for_bless() diff --git a/dist/Data-Dumper/t/bless_var_method.t b/dist/Data-Dumper/t/bless_var_method.t index 8f00f83..7af4cdb 100644 --- a/dist/Data-Dumper/t/bless_var_method.t +++ b/dist/Data-Dumper/t/bless_var_method.t @@ -26,59 +26,18 @@ my %d = ( alpha => 'a', ); -{ +run_tests_for_bless_var_method(); +SKIP: { + skip "XS version was unavailable, so we already ran with pure Perl", 4 + if $Data::Dumper::Useperl; + local $Data::Dumper::Useperl = 1; + run_tests_for_bless_var_method(); +} + +sub run_tests_for_bless_var_method { my ($obj, %dumps, $bless, $starting); note("\$Data::Dumper::Bless and Bless() set to true value"); - note("XS implementation"); - $Data::Dumper::Useperl = 0; - - $starting = $Data::Dumper::Bless; - $bless = 1; - local $Data::Dumper::Bless = $bless; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddblessone'} = _dumptostr($obj); - local $Data::Dumper::Bless = $starting; - - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Bless($bless); - $dumps{'objblessone'} = _dumptostr($obj); - - is($dumps{'ddblessone'}, $dumps{'objblessone'}, - "\$Data::Dumper::Bless = 1 and Bless(1) are equivalent"); - %dumps = (); - - $bless = 0; - local $Data::Dumper::Bless = $bless; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddblesszero'} = _dumptostr($obj); - local $Data::Dumper::Bless = $starting; - - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Bless($bless); - $dumps{'objblesszero'} = _dumptostr($obj); - - is($dumps{'ddblesszero'}, $dumps{'objblesszero'}, - "\$Data::Dumper::Bless = 0 and Bless(0) are equivalent"); - - $bless = undef; - local $Data::Dumper::Bless = $bless; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddblessundef'} = _dumptostr($obj); - local $Data::Dumper::Bless = $starting; - - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Bless($bless); - $dumps{'objblessundef'} = _dumptostr($obj); - - is($dumps{'ddblessundef'}, $dumps{'objblessundef'}, - "\$Data::Dumper::Bless = undef and Bless(undef) are equivalent"); - is($dumps{'ddblesszero'}, $dumps{'objblessundef'}, - "\$Data::Dumper::Bless = undef and = 0 are equivalent"); - %dumps = (); - - note("Perl implementation"); - $Data::Dumper::Useperl = 1; $starting = $Data::Dumper::Bless; $bless = 1; diff --git a/dist/Data-Dumper/t/dumpperl.t b/dist/Data-Dumper/t/dumpperl.t index 6c1d096..9220430 100644 --- a/dist/Data-Dumper/t/dumpperl.t +++ b/dist/Data-Dumper/t/dumpperl.t @@ -14,206 +14,127 @@ BEGIN { use strict; use Carp; use Data::Dumper; -$Data::Dumper::Indent=1; -use Test::More tests => 22; +use Test::More tests => 31; use lib qw( ./t/lib ); use Testing qw( _dumptostr ); -my ($a, $b, $obj); -my (@names); -my (@newnames, $objagain, %newnames); -my $dumpstr; -$a = 'alpha'; -$b = 'beta'; -my @c = ( qw| eta theta | ); -my %d = ( iota => 'kappa' ); -my $realtype; - -local $Data::Dumper::Useperl=1; - -note('Data::Dumper::Useperl; names not provided'); - -$obj = Data::Dumper->new([$a, $b]); -$dumpstr = _dumptostr($obj); -like($dumpstr, - qr/\$VAR1.+alpha.+\$VAR2.+beta/s, - "Dump: two strings" -); - -$obj = Data::Dumper->new([$a, \@c]); -$dumpstr = _dumptostr($obj); -like($dumpstr, - qr/\$VAR1.+alpha.+\$VAR2.+\[.+eta.+theta.+\]/s, - "Dump: one string, one array ref" -); - -$obj = Data::Dumper->new([$a, \%d]); -$dumpstr = _dumptostr($obj); -like($dumpstr, - qr/\$VAR1.+alpha.+\$VAR2.+\{.+iota.+kappa.+\}/s, - "Dump: one string, one hash ref" -); - -$obj = Data::Dumper->new([$a, undef]); -$dumpstr = _dumptostr($obj); -like($dumpstr, - qr/\$VAR1.+alpha.+\$VAR2.+undef/s, - "Dump: one string, one undef" -); - -note('Data::Dumper::Useperl; names provided'); - -$obj = Data::Dumper->new([$a, $b], [ qw( a b ) ]); -$dumpstr = _dumptostr($obj); -like($dumpstr, - qr/\$a.+alpha.+\$b.+beta/s, - "Dump: names: two strings" -); - -$obj = Data::Dumper->new([$a, \@c], [ qw( a *c ) ]); -$dumpstr = _dumptostr($obj); -like($dumpstr, - qr/\$a.+alpha.+\@c.+eta.+theta/s, - "Dump: names: one string, one array ref" -); - -$obj = Data::Dumper->new([$a, \%d], [ qw( a *d ) ]); -$dumpstr = _dumptostr($obj); -like($dumpstr, - qr/\$a.+alpha.+\%d.+iota.+kappa/s, - "Dump: names: one string, one hash ref" -); - -$obj = Data::Dumper->new([$a,undef], [qw(a *c)]); -$dumpstr = _dumptostr($obj); -like($dumpstr, - qr/\$a.+alpha.+\$c.+undef/s, - "Dump: names: one string, one undef" -); - -$obj = Data::Dumper->new([$a, $b], [ 'a', '']); -$dumpstr = _dumptostr($obj); -like($dumpstr, - qr/\$a.+alpha.+\$.+beta/s, - "Dump: names: two strings: one name empty" -); - -$obj = Data::Dumper->new([$a, $b], [ 'a', '$foo']); -$dumpstr = _dumptostr($obj); -no warnings 'uninitialized'; -like($dumpstr, - qr/\$a.+alpha.+\$foo.+beta/s, - "Dump: names: two strings: one name start with '\$'" -); -use warnings; - -local $Data::Dumper::Useperl=0; - -# Setting aside quoting, Useqq should produce same output as Useperl. -# Both will exercise Dumpperl(). -# So will run the same tests as above. -note('Data::Dumper::Useqq'); - -local $Data::Dumper::Useqq=1; - -$obj = Data::Dumper->new([$a, $b]); -$dumpstr = _dumptostr($obj); -like($dumpstr, - qr/\$VAR1.+alpha.+\$VAR2.+beta/s, - "Dump: two strings" -); - -$obj = Data::Dumper->new([$a, \@c]); -$dumpstr = _dumptostr($obj); -like($dumpstr, - qr/\$VAR1.+alpha.+\$VAR2.+\[.+eta.+theta.+\]/s, - "Dump: one string, one array ref" -); - -$obj = Data::Dumper->new([$a, \%d]); -$dumpstr = _dumptostr($obj); -like($dumpstr, - qr/\$VAR1.+alpha.+\$VAR2.+\{.+iota.+kappa.+\}/s, - "Dump: one string, one hash ref" -); - -$obj = Data::Dumper->new([$a, undef]); -$dumpstr = _dumptostr($obj); -like($dumpstr, - qr/\$VAR1.+alpha.+\$VAR2.+undef/s, - "Dump: one string, one undef" -); -local $Data::Dumper::Useqq=0; - -# Deparse should produce same output as Useperl. -# Both will exercise Dumpperl(). -# So will run the same tests as above. -note('Data::Dumper::Deparse'); - -local $Data::Dumper::Deparse=1; - -$obj = Data::Dumper->new([$a, $b]); -$dumpstr = _dumptostr($obj); -like($dumpstr, - qr/\$VAR1.+alpha.+\$VAR2.+beta/s, - "Dump: two strings" -); - -$obj = Data::Dumper->new([$a, \@c]); -$dumpstr = _dumptostr($obj); -like($dumpstr, - qr/\$VAR1.+alpha.+\$VAR2.+\[.+eta.+theta.+\]/s, - "Dump: one string, one array ref" -); - -$obj = Data::Dumper->new([$a, \%d]); -$dumpstr = _dumptostr($obj); -like($dumpstr, - qr/\$VAR1.+alpha.+\$VAR2.+\{.+iota.+kappa.+\}/s, - "Dump: one string, one hash ref" -); - -$obj = Data::Dumper->new([$a, undef]); -$dumpstr = _dumptostr($obj); -like($dumpstr, - qr/\$VAR1.+alpha.+\$VAR2.+undef/s, - "Dump: one string, one undef" -); - -local $Data::Dumper::Deparse=0; +$Data::Dumper::Indent=1; { - my (%dumps, $starting); - - $starting = $Data::Dumper::Useperl; - - local $Data::Dumper::Useperl = 0; - $obj = Data::Dumper->new([$a, $b]); - $dumps{'dduzero'} = _dumptostr($obj); + local $Data::Dumper::Useperl=1; + local $Data::Dumper::Useqq=0; + local $Data::Dumper::Deparse=0; + note('$Data::Dumper::Useperl => 1'); + run_tests_for_pure_perl_implementations(); +} - local $Data::Dumper::Useperl = undef; - $obj = Data::Dumper->new([$a, $b]); - $dumps{'dduundef'} = _dumptostr($obj); +{ + local $Data::Dumper::Useperl=0; + local $Data::Dumper::Useqq=1; + local $Data::Dumper::Deparse=0; + note('$Data::Dumper::Useqq => 1'); + run_tests_for_pure_perl_implementations(); +} + +{ + local $Data::Dumper::Useperl=0; + local $Data::Dumper::Useqq=0; + local $Data::Dumper::Deparse=1; + note('$Data::Dumper::Deparse => 1'); + run_tests_for_pure_perl_implementations(); +} + + - $Data::Dumper::Useperl= $starting; +sub run_tests_for_pure_perl_implementations { - $obj = Data::Dumper->new([$a, $b]); - $obj->Useperl(0); - $dumps{'useperlzero'} = _dumptostr($obj); + my ($a, $b, $obj); + my (@names); + my (@newnames, $objagain, %newnames); + my $dumpstr; + $a = 'alpha'; + $b = 'beta'; + my @c = ( qw| eta theta | ); + my %d = ( iota => 'kappa' ); + note('names not provided'); $obj = Data::Dumper->new([$a, $b]); - $obj->Useperl(undef); - $dumps{'useperlundef'} = _dumptostr($obj); - - is($dumps{'dduzero'}, $dumps{'dduundef'}, - "\$Data::Dumper::Useperl(0) and (undef) are equivalent"); - is($dumps{'useperlzero'}, $dumps{'useperlundef'}, - "Useperl(0) and (undef) are equivalent"); - is($dumps{'dduundef'}, $dumps{'useperlundef'}, - "\$Data::Dumper::Useperl(undef) and Useperl(undef) are equivalent"); + $dumpstr = _dumptostr($obj); + like($dumpstr, + qr/\$VAR1.+alpha.+\$VAR2.+beta/s, + "Dump: two strings" + ); + + $obj = Data::Dumper->new([$a, \@c]); + $dumpstr = _dumptostr($obj); + like($dumpstr, + qr/\$VAR1.+alpha.+\$VAR2.+\[.+eta.+theta.+\]/s, + "Dump: one string, one array ref" + ); + + $obj = Data::Dumper->new([$a, \%d]); + $dumpstr = _dumptostr($obj); + like($dumpstr, + qr/\$VAR1.+alpha.+\$VAR2.+\{.+iota.+kappa.+\}/s, + "Dump: one string, one hash ref" + ); + + $obj = Data::Dumper->new([$a, undef]); + $dumpstr = _dumptostr($obj); + like($dumpstr, + qr/\$VAR1.+alpha.+\$VAR2.+undef/s, + "Dump: one string, one undef" + ); + + note('names provided'); + + $obj = Data::Dumper->new([$a, $b], [ qw( a b ) ]); + $dumpstr = _dumptostr($obj); + like($dumpstr, + qr/\$a.+alpha.+\$b.+beta/s, + "Dump: names: two strings" + ); + + $obj = Data::Dumper->new([$a, \@c], [ qw( a *c ) ]); + $dumpstr = _dumptostr($obj); + like($dumpstr, + qr/\$a.+alpha.+\@c.+eta.+theta/s, + "Dump: names: one string, one array ref" + ); + + $obj = Data::Dumper->new([$a, \%d], [ qw( a *d ) ]); + $dumpstr = _dumptostr($obj); + like($dumpstr, + qr/\$a.+alpha.+\%d.+iota.+kappa/s, + "Dump: names: one string, one hash ref" + ); + + $obj = Data::Dumper->new([$a,undef], [qw(a *c)]); + $dumpstr = _dumptostr($obj); + like($dumpstr, + qr/\$a.+alpha.+\$c.+undef/s, + "Dump: names: one string, one undef" + ); + + $obj = Data::Dumper->new([$a, $b], [ 'a', '']); + $dumpstr = _dumptostr($obj); + like($dumpstr, + qr/\$a.+alpha.+\$.+beta/s, + "Dump: names: two strings: one name empty" + ); + + $obj = Data::Dumper->new([$a, $b], [ 'a', '$foo']); + $dumpstr = _dumptostr($obj); + no warnings 'uninitialized'; + like($dumpstr, + qr/\$a.+alpha.+\$foo.+beta/s, + "Dump: names: two strings: one name start with '\$'" + ); + use warnings; } { + my ($obj, $dumpstr, $realtype); $obj = Data::Dumper->new([ {IO => *{$::{STDERR}}{IO}} ]); $obj->Useperl(1); eval { $dumpstr = _dumptostr($obj); }; @@ -221,4 +142,3 @@ local $Data::Dumper::Deparse=0; like($@, qr/Can't handle '$realtype' type/, "Got expected error: pure-perl: Data-Dumper does not handle $realtype"); } - diff --git a/dist/Data-Dumper/t/freezer.t b/dist/Data-Dumper/t/freezer.t index 11b5c2b..7f3b7ac 100644 --- a/dist/Data-Dumper/t/freezer.t +++ b/dist/Data-Dumper/t/freezer.t @@ -7,13 +7,13 @@ BEGIN { require Config; import Config; no warnings 'once'; if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { - print "1..0 # Skip: Data::Dumper was not built\n"; - exit 0; + print "1..0 # Skip: Data::Dumper was not built\n"; + exit 0; } } use strict; -use Test::More tests => 15; +use Test::More tests => 8; use Data::Dumper; use lib qw( ./t/lib ); use Testing qw( _dumptostr ); @@ -33,18 +33,6 @@ use Testing qw( _dumptostr ); "Dumped list doesn't begin with Freezer's return value with useperl"); } - # run the same tests with useperl. this always worked - { - local $Data::Dumper::Useperl = 1; - my $foo = Test1->new("foo"); - my $dumped_foo = Dumper($foo); - ok($dumped_foo, - "Use of freezer sub which returns non-ref worked with useperl"); - like($dumped_foo, qr/frozed/, - "Dumped string has the key added by Freezer with useperl."); - like(join(" ", Dumper($foo)), qr/\A\$VAR1 = /, - "Dumped list doesn't begin with Freezer's return value with useperl"); - } # test for warning when an object does not have a freeze() { @@ -55,15 +43,6 @@ use Testing qw( _dumptostr ); is($warned, 0, "A missing freeze() shouldn't warn."); } - # run the same test with useperl, which always worked - { - local $Data::Dumper::Useperl = 1; - my $warned = 0; - local $SIG{__WARN__} = sub { $warned++ }; - my $bar = Test2->new("bar"); - my $dumped_bar = Dumper($bar); - is($warned, 0, "A missing freeze() shouldn't warn with useperl"); - } # a freeze() which die()s should still trigger the warning { @@ -74,15 +53,6 @@ use Testing qw( _dumptostr ); is($warned, 1, "A freeze() which die()s should warn."); } - # the same should work in useperl - { - local $Data::Dumper::Useperl = 1; - my $warned = 0; - local $SIG{__WARN__} = sub { $warned++; }; - my $bar = Test3->new("bar"); - my $dumped_bar = Dumper($bar); - is($warned, 1, "A freeze() which die()s should warn with useperl."); - } } { @@ -106,42 +76,6 @@ use Testing qw( _dumptostr ); my ($obj, %dumps); my $foo = Test1->new("foo"); - local $Data::Dumper::Freezer = 'freeze'; - - local $Data::Dumper::Useperl = 1; - $obj = Data::Dumper->new( [ $foo ] ); - $dumps{'ddftrueuseperl'} = _dumptostr($obj); - - local $Data::Dumper::Useperl = 0; - $obj = Data::Dumper->new( [ $foo ] ); - $dumps{'ddftruexs'} = _dumptostr($obj); - - is( $dumps{'ddftruexs'}, $dumps{'ddftrueuseperl'}, - "\$Data::Dumper::Freezer() gives same results under XS and Useperl"); -} - -{ - my ($obj, %dumps); - my $foo = Test1->new("foo"); - - local $Data::Dumper::Useperl = 1; - $obj = Data::Dumper->new( [ $foo ] ); - $obj->Freezer('freeze'); - $dumps{'objsetuseperl'} = _dumptostr($obj); - - local $Data::Dumper::Useperl = 0; - $obj = Data::Dumper->new( [ $foo ] ); - $obj->Freezer('freeze'); - $dumps{'objsetxs'} = _dumptostr($obj); - - is($dumps{'objsetxs'}, $dumps{'objsetuseperl'}, - "Freezer() gives same results under XS and Useperl"); -} - -{ - my ($obj, %dumps); - my $foo = Test1->new("foo"); - local $Data::Dumper::Freezer = ''; $obj = Data::Dumper->new( [ $foo ] ); $dumps{'ddfemptystr'} = _dumptostr($obj); diff --git a/dist/Data-Dumper/t/freezer_useperl.t b/dist/Data-Dumper/t/freezer_useperl.t new file mode 100644 index 0000000..b79c3c1 --- /dev/null +++ b/dist/Data-Dumper/t/freezer_useperl.t @@ -0,0 +1,106 @@ +#!./perl -w +# +# test a few problems with the Freezer option, not a complete Freezer +# test suite yet + +BEGIN { + require Config; import Config; + no warnings 'once'; + if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { + print "1..0 # Skip: Data::Dumper was not built\n"; + exit 0; + } +} + +use strict; +use Test::More tests => 7; +use Data::Dumper; +use lib qw( ./t/lib ); +use Testing qw( _dumptostr ); + +local $Data::Dumper::Useperl = 1; + +{ + local $Data::Dumper::Freezer = 'freeze'; + + # test for seg-fault bug when freeze() returns a non-ref + { + my $foo = Test1->new("foo"); + my $dumped_foo = Dumper($foo); + ok($dumped_foo, + "Use of freezer sub which returns non-ref worked."); + like($dumped_foo, qr/frozed/, + "Dumped string has the key added by Freezer with useperl."); + like(join(" ", Dumper($foo)), qr/\A\$VAR1 = /, + "Dumped list doesn't begin with Freezer's return value with useperl"); + } + + # test for warning when an object does not have a freeze() + { + my $warned = 0; + local $SIG{__WARN__} = sub { $warned++ }; + my $bar = Test2->new("bar"); + my $dumped_bar = Dumper($bar); + is($warned, 0, "A missing freeze() shouldn't warn."); + } + + # a freeze() which die()s should still trigger the warning + { + my $warned = 0; + local $SIG{__WARN__} = sub { $warned++; }; + my $bar = Test3->new("bar"); + my $dumped_bar = Dumper($bar); + is($warned, 1, "A freeze() which die()s should warn."); + } + +} + +{ + my ($obj, %dumps); + my $foo = Test1->new("foo"); + + local $Data::Dumper::Freezer = ''; + $obj = Data::Dumper->new( [ $foo ] ); + $dumps{'ddfemptystr'} = _dumptostr($obj); + + local $Data::Dumper::Freezer = undef; + $obj = Data::Dumper->new( [ $foo ] ); + $dumps{'ddfundef'} = _dumptostr($obj); + + is($dumps{'ddfundef'}, $dumps{'ddfemptystr'}, + "\$Data::Dumper::Freezer same with empty string or undef"); +} + +{ + my ($obj, %dumps); + my $foo = Test1->new("foo"); + + $obj = Data::Dumper->new( [ $foo ] ); + $obj->Freezer(''); + $dumps{'objemptystr'} = _dumptostr($obj); + + $obj = Data::Dumper->new( [ $foo ] ); + $obj->Freezer(undef); + $dumps{'objundef'} = _dumptostr($obj); + + is($dumps{'objundef'}, $dumps{'objemptystr'}, + "Freezer() same with empty string or undef"); +} + + +# a package with a freeze() which returns a non-ref +package Test1; +sub new { bless({name => $_[1]}, $_[0]) } +sub freeze { + my $self = shift; + $self->{frozed} = 1; +} + +# a package without a freeze() +package Test2; +sub new { bless({name => $_[1]}, $_[0]) } + +# a package with a freeze() which dies +package Test3; +sub new { bless({name => $_[1]}, $_[0]) } +sub freeze { die "freeze() is broken" } diff --git a/dist/Data-Dumper/t/indent.t b/dist/Data-Dumper/t/indent.t index 90a3be0..a91027d 100644 --- a/dist/Data-Dumper/t/indent.t +++ b/dist/Data-Dumper/t/indent.t @@ -100,3 +100,11 @@ like($dumpstr{ar_indent_3}, is(scalar(split("\n" => $dumpstr{ar_indent_2})) + 2, scalar(split("\n" => $dumpstr{ar_indent_3})), "Indent(3) runs 2 lines longer than Indent(2)"); + +__END__ +is($dumpstr{noindent}, $dumpstr{indent_0}, + "absence of Indent is same as Indent(0)"); +isnt($dumpstr{noindent}, $dumpstr{indent_1}, + "absence of Indent is different from Indent(1)"); +print STDERR $dumpstr{indent_0}; +print STDERR $dumpstr{ar_indent_3}; diff --git a/dist/Data-Dumper/t/perl-74170.t b/dist/Data-Dumper/t/perl-74170.t index 4f8025d..cca94ae 100644 --- a/dist/Data-Dumper/t/perl-74170.t +++ b/dist/Data-Dumper/t/perl-74170.t @@ -4,20 +4,20 @@ # Since it’s so large, it gets its own file. BEGIN { - require Config; import Config; - no warnings 'once'; - if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { - print "1..0 # Skip: Data::Dumper was not built\n"; - exit 0; + if ($ENV{PERL_CORE}){ + require Config; import Config; + no warnings 'once'; + if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { + print "1..0 # Skip: Data::Dumper was not built\n"; + exit 0; + } } } - use strict; use Test::More tests => 1; use Data::Dumper; -our %repos = (); -&real_life_setup(); +our %repos = real_life_setup(); $Data::Dumper::Indent = 1; # A custom sort sub is necessary for reproducing the bug, as this is where @@ -25,13 +25,14 @@ $Data::Dumper::Indent = 1; $Data::Dumper::Sortkeys = sub { return [ reverse sort keys %{$_[0]} ]; } unless exists $ENV{NO_SORT_SUB}; -ok +Data::Dumper->Dumpxs([\%repos], [qw(*repos)]); +ok(Data::Dumper->Dump([\%repos], [qw(*repos)]), "RT 74170 test"); sub real_life_setup { # set up the %repos hash in a manner that reflects a real run of - # gitolite's "compiler" script: + # the gitolite "compiler" script: # Yes, all this is necessary to get the stack in such a state that the # custom sort sub will trigger a reallocation. + my %repos; push @{ $repos{''}{'@all'} }, (); push @{ $repos{''}{'guser86'} }, (); push @{ $repos{''}{'guser87'} }, (); @@ -140,4 +141,5 @@ sub real_life_setup { $repos{''}{R}{'user8'} = 1; $repos{''}{W}{'user8'} = 1; push @{ $repos{''}{'user8'} }, (); + return %repos; } diff --git a/dist/Data-Dumper/t/quotekeys.t b/dist/Data-Dumper/t/quotekeys.t index 5b2f0ae..c633d56 100644 --- a/dist/Data-Dumper/t/quotekeys.t +++ b/dist/Data-Dumper/t/quotekeys.t @@ -26,12 +26,20 @@ my %d = ( alpha => 'a', ); -{ +run_tests_for_quotekeys(); +SKIP: { + skip "XS version was unavailable, so we already ran with pure Perl", 5 + if $Data::Dumper::Useperl; + local $Data::Dumper::Useperl = 1; + run_tests_for_quotekeys(); +} + +sub run_tests_for_quotekeys { + note("\$Data::Dumper::Useperl = $Data::Dumper::Useperl"); + my ($obj, %dumps, $quotekeys, $starting); note("\$Data::Dumper::Quotekeys and Quotekeys() set to true value"); - note("XS implementation"); - $Data::Dumper::Useperl = 0; $obj = Data::Dumper->new( [ \%d ] ); $dumps{'ddqkdefault'} = _dumptostr($obj); @@ -82,58 +90,5 @@ my %d = ( isnt($dumps{'ddqkzero'}, $dumps{'objqkundef'}, "\$Data::Dumper::Quotekeys = undef and = 0 are equivalent"); %dumps = (); - - note("Perl implementation"); - $Data::Dumper::Useperl = 1; - - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddqkdefault'} = _dumptostr($obj); - - $starting = $Data::Dumper::Quotekeys; - $quotekeys = 1; - local $Data::Dumper::Quotekeys = $quotekeys; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddqkone'} = _dumptostr($obj); - local $Data::Dumper::Quotekeys = $starting; - - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Quotekeys($quotekeys); - $dumps{'objqkone'} = _dumptostr($obj); - - is($dumps{'ddqkundef'}, $dumps{'objqkundef'}, - "\$Data::Dumper::Quotekeys = undef and Quotekeys(undef) are equivalent"); - is($dumps{'ddqkone'}, $dumps{'objqkone'}, - "\$Data::Dumper::Quotekeys = 1 and Quotekeys(1) are equivalent"); - %dumps = (); - - $quotekeys = 0; - local $Data::Dumper::Quotekeys = $quotekeys; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddqkzero'} = _dumptostr($obj); - local $Data::Dumper::Quotekeys = $starting; - - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Quotekeys($quotekeys); - $dumps{'objqkzero'} = _dumptostr($obj); - - is($dumps{'ddqkzero'}, $dumps{'objqkzero'}, - "\$Data::Dumper::Quotekeys = 0 and Quotekeys(0) are equivalent"); - - $quotekeys = undef; - local $Data::Dumper::Quotekeys = $quotekeys; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddqkundef'} = _dumptostr($obj); - local $Data::Dumper::Quotekeys = $starting; - - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Quotekeys($quotekeys); - $dumps{'objqkundef'} = _dumptostr($obj); - - note("Quotekeys(undef) will fall back to the default value\nfor \$Data::Dumper::Quotekeys, which is a true value."); - isnt($dumps{'ddqkundef'}, $dumps{'objqkundef'}, - "\$Data::Dumper::Quotekeys = undef and Quotekeys(undef) are equivalent"); - isnt($dumps{'ddqkzero'}, $dumps{'objqkundef'}, - "\$Data::Dumper::Quotekeys = undef and = 0 are equivalent"); - %dumps = (); } diff --git a/dist/Data-Dumper/t/sortkeys.t b/dist/Data-Dumper/t/sortkeys.t index f4bbcb6..fbd8197 100644 --- a/dist/Data-Dumper/t/sortkeys.t +++ b/dist/Data-Dumper/t/sortkeys.t @@ -15,263 +15,176 @@ BEGIN { use strict; use Data::Dumper; -use Test::More tests => 23; +use Test::More tests => 26; use lib qw( ./t/lib ); use Testing qw( _dumptostr ); -my %d = ( - delta => 'd', - beta => 'b', - gamma => 'c', - alpha => 'a', -); - -{ - my ($obj, %dumps, $sortkeys, $starting); - - note("\$Data::Dumper::Sortkeys and Sortkeys() set to true value"); - note("XS implementation"); - $Data::Dumper::Useperl = 0; - - $starting = $Data::Dumper::Sortkeys; - $sortkeys = 1; - local $Data::Dumper::Sortkeys = $sortkeys; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddskone'} = _dumptostr($obj); - local $Data::Dumper::Sortkeys = $starting; - - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Sortkeys($sortkeys); - $dumps{'objskone'} = _dumptostr($obj); - - is($dumps{'ddskone'}, $dumps{'objskone'}, - "\$Data::Dumper::Sortkeys = 1 and Sortkeys(1) are equivalent"); - like($dumps{'ddskone'}, - qr/alpha.*?beta.*?delta.*?gamma/s, - "Sortkeys returned hash keys in Perl's default sort order"); - %dumps = (); - - note("Perl implementation"); - $Data::Dumper::Useperl = 1; - - $starting = $Data::Dumper::Sortkeys; - $sortkeys = 1; - local $Data::Dumper::Sortkeys = $sortkeys; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddskone'} = _dumptostr($obj); - local $Data::Dumper::Sortkeys = $starting; - - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Sortkeys($sortkeys); - $dumps{'objskone'} = _dumptostr($obj); - - is($dumps{'ddskone'}, $dumps{'objskone'}, - "\$Data::Dumper::Sortkeys = 1 and Sortkeys(1) are equivalent"); - like($dumps{'ddskone'}, - qr/alpha.*?beta.*?delta.*?gamma/s, - "Sortkeys returned hash keys in Perl's default sort order"); +run_tests_for_sortkeys(); +SKIP: { + skip "XS version was unavailable, so we already ran with pure Perl", 13 + if $Data::Dumper::Useperl; + local $Data::Dumper::Useperl = 1; + run_tests_for_sortkeys(); } -{ - my ($obj, %dumps, $starting); - - note("\$Data::Dumper::Sortkeys and Sortkeys() set to coderef"); - sub reversekeys { return [ reverse sort keys %{+shift} ]; } - - note("XS implementation"); - $Data::Dumper::Useperl = 0; - - $starting = $Data::Dumper::Sortkeys; - local $Data::Dumper::Sortkeys = \&reversekeys; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddsksub'} = _dumptostr($obj); - local $Data::Dumper::Sortkeys = $starting; - - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Sortkeys(\&reversekeys); - $dumps{'objsksub'} = _dumptostr($obj); - - is($dumps{'ddsksub'}, $dumps{'objsksub'}, - "\$Data::Dumper::Sortkeys = CODEREF and Sortkeys(CODEREF) are equivalent"); - like($dumps{'ddsksub'}, - qr/gamma.*?delta.*?beta.*?alpha/s, - "Sortkeys returned hash keys per sorting subroutine"); - %dumps = (); - - note("Perl implementation"); - $Data::Dumper::Useperl = 1; - - $starting = $Data::Dumper::Sortkeys; - local $Data::Dumper::Sortkeys = \&reversekeys; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddsksub'} = _dumptostr($obj); - local $Data::Dumper::Sortkeys = $starting; - - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Sortkeys(\&reversekeys); - $dumps{'objsksub'} = _dumptostr($obj); - - is($dumps{'ddsksub'}, $dumps{'objsksub'}, - "\$Data::Dumper::Sortkeys = CODEREF and Sortkeys(CODEREF) are equivalent"); - like($dumps{'ddsksub'}, - qr/gamma.*?delta.*?beta.*?alpha/s, - "Sortkeys returned hash keys per sorting subroutine"); -} - -{ - my ($obj, %dumps, $starting); - - note("\$Data::Dumper::Sortkeys and Sortkeys() set to coderef with filter"); - sub reversekeystrim { - my $hr = shift; - my @keys = sort keys %{$hr}; - shift(@keys); - return [ reverse @keys ]; +sub run_tests_for_sortkeys { + note("\$Data::Dumper::Useperl = $Data::Dumper::Useperl"); + + my %d = ( + delta => 'd', + beta => 'b', + gamma => 'c', + alpha => 'a', + ); + + { + my ($obj, %dumps, $sortkeys, $starting); + + note("\$Data::Dumper::Sortkeys and Sortkeys() set to true value"); + + $starting = $Data::Dumper::Sortkeys; + $sortkeys = 1; + local $Data::Dumper::Sortkeys = $sortkeys; + $obj = Data::Dumper->new( [ \%d ] ); + $dumps{'ddskone'} = _dumptostr($obj); + local $Data::Dumper::Sortkeys = $starting; + + $obj = Data::Dumper->new( [ \%d ] ); + $obj->Sortkeys($sortkeys); + $dumps{'objskone'} = _dumptostr($obj); + + is($dumps{'ddskone'}, $dumps{'objskone'}, + "\$Data::Dumper::Sortkeys = 1 and Sortkeys(1) are equivalent"); + like($dumps{'ddskone'}, + qr/alpha.*?beta.*?delta.*?gamma/s, + "Sortkeys returned hash keys in Perl's default sort order"); + %dumps = (); + + } + + { + my ($obj, %dumps, $starting); + + note("\$Data::Dumper::Sortkeys and Sortkeys() set to coderef"); + + $starting = $Data::Dumper::Sortkeys; + local $Data::Dumper::Sortkeys = \&reversekeys; + $obj = Data::Dumper->new( [ \%d ] ); + $dumps{'ddsksub'} = _dumptostr($obj); + local $Data::Dumper::Sortkeys = $starting; + + $obj = Data::Dumper->new( [ \%d ] ); + $obj->Sortkeys(\&reversekeys); + $dumps{'objsksub'} = _dumptostr($obj); + + is($dumps{'ddsksub'}, $dumps{'objsksub'}, + "\$Data::Dumper::Sortkeys = CODEREF and Sortkeys(CODEREF) are equivalent"); + like($dumps{'ddsksub'}, + qr/gamma.*?delta.*?beta.*?alpha/s, + "Sortkeys returned hash keys per sorting subroutine"); + %dumps = (); + + } + + { + my ($obj, %dumps, $starting); + + note("\$Data::Dumper::Sortkeys and Sortkeys() set to coderef with filter"); + $starting = $Data::Dumper::Sortkeys; + local $Data::Dumper::Sortkeys = \&reversekeystrim; + $obj = Data::Dumper->new( [ \%d ] ); + $dumps{'ddsksub'} = _dumptostr($obj); + local $Data::Dumper::Sortkeys = $starting; + + $obj = Data::Dumper->new( [ \%d ] ); + $obj->Sortkeys(\&reversekeystrim); + $dumps{'objsksub'} = _dumptostr($obj); + + is($dumps{'ddsksub'}, $dumps{'objsksub'}, + "\$Data::Dumper::Sortkeys = CODEREF and Sortkeys(CODEREF) select same keys"); + like($dumps{'ddsksub'}, + qr/gamma.*?delta.*?beta/s, + "Sortkeys returned hash keys per sorting subroutine"); + unlike($dumps{'ddsksub'}, + qr/alpha/s, + "Sortkeys filtered out one key per request"); + %dumps = (); + + } + + { + my ($obj, %dumps, $sortkeys, $starting); + + note("\$Data::Dumper::Sortkeys(undef) and Sortkeys(undef)"); + + $starting = $Data::Dumper::Sortkeys; + $sortkeys = 0; + local $Data::Dumper::Sortkeys = $sortkeys; + $obj = Data::Dumper->new( [ \%d ] ); + $dumps{'ddskzero'} = _dumptostr($obj); + local $Data::Dumper::Sortkeys = $starting; + + $obj = Data::Dumper->new( [ \%d ] ); + $obj->Sortkeys($sortkeys); + $dumps{'objskzero'} = _dumptostr($obj); + + $sortkeys = undef; + local $Data::Dumper::Sortkeys = $sortkeys; + $obj = Data::Dumper->new( [ \%d ] ); + $dumps{'ddskundef'} = _dumptostr($obj); + local $Data::Dumper::Sortkeys = $starting; + + $obj = Data::Dumper->new( [ \%d ] ); + $obj->Sortkeys($sortkeys); + $dumps{'objskundef'} = _dumptostr($obj); + + is($dumps{'ddskzero'}, $dumps{'objskzero'}, + "\$Data::Dumper::Sortkeys = 0 and Sortkeys(0) are equivalent"); + is($dumps{'ddskzero'}, $dumps{'ddskundef'}, + "\$Data::Dumper::Sortkeys = 0 and = undef equivalent"); + is($dumps{'objkzero'}, $dumps{'objkundef'}, + "Sortkeys(0) and Sortkeys(undef) are equivalent"); + %dumps = (); + + } + + note("Internal subroutine _sortkeys"); + my %e = ( + nu => 'n', + lambda => 'l', + kappa => 'k', + mu => 'm', + omicron => 'o', + ); + my $rv = Data::Dumper::_sortkeys(\%e); + is(ref($rv), 'ARRAY', "Data::Dumper::_sortkeys returned an array ref"); + is_deeply($rv, [ qw( kappa lambda mu nu omicron ) ], + "Got keys in Perl default order"); + { + my $warning = ''; + local $SIG{__WARN__} = sub { $warning = $_[0] }; + + my ($obj, %dumps, $starting); + + note("\$Data::Dumper::Sortkeys and Sortkeys() set to coderef"); + + $starting = $Data::Dumper::Sortkeys; + local $Data::Dumper::Sortkeys = \&badreturnvalue; + $obj = Data::Dumper->new( [ \%d ] ); + $dumps{'ddsksub'} = _dumptostr($obj); + like($warning, qr/^Sortkeys subroutine did not return ARRAYREF/, + "Got expected warning: sorting routine did not return array ref"); } - note("XS implementation"); - $Data::Dumper::Useperl = 0; - - $starting = $Data::Dumper::Sortkeys; - local $Data::Dumper::Sortkeys = \&reversekeystrim; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddsksub'} = _dumptostr($obj); - local $Data::Dumper::Sortkeys = $starting; - - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Sortkeys(\&reversekeystrim); - $dumps{'objsksub'} = _dumptostr($obj); - - is($dumps{'ddsksub'}, $dumps{'objsksub'}, - "\$Data::Dumper::Sortkeys = CODEREF and Sortkeys(CODEREF) select same keys"); - like($dumps{'ddsksub'}, - qr/gamma.*?delta.*?beta/s, - "Sortkeys returned hash keys per sorting subroutine"); - unlike($dumps{'ddsksub'}, - qr/alpha/s, - "Sortkeys filtered out one key per request"); - %dumps = (); - - note("Perl implementation"); - $Data::Dumper::Useperl = 1; - - $starting = $Data::Dumper::Sortkeys; - local $Data::Dumper::Sortkeys = \&reversekeystrim; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddsksub'} = _dumptostr($obj); - local $Data::Dumper::Sortkeys = $starting; - - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Sortkeys(\&reversekeystrim); - $dumps{'objsksub'} = _dumptostr($obj); - - is($dumps{'ddsksub'}, $dumps{'objsksub'}, - "\$Data::Dumper::Sortkeys = CODEREF and Sortkeys(CODEREF) select same keys"); - like($dumps{'ddsksub'}, - qr/gamma.*?delta.*?beta/s, - "Sortkeys returned hash keys per sorting subroutine"); - unlike($dumps{'ddsksub'}, - qr/alpha/s, - "Sortkeys filtered out one key per request"); } -{ - my ($obj, %dumps, $sortkeys, $starting); - - note("\$Data::Dumper::Sortkeys(undef) and Sortkeys(undef)"); - note("XS implementation"); - $Data::Dumper::Useperl = 0; - - $starting = $Data::Dumper::Sortkeys; - $sortkeys = 0; - local $Data::Dumper::Sortkeys = $sortkeys; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddskzero'} = _dumptostr($obj); - local $Data::Dumper::Sortkeys = $starting; - - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Sortkeys($sortkeys); - $dumps{'objskzero'} = _dumptostr($obj); - - $sortkeys = undef; - local $Data::Dumper::Sortkeys = $sortkeys; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddskundef'} = _dumptostr($obj); - local $Data::Dumper::Sortkeys = $starting; - - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Sortkeys($sortkeys); - $dumps{'objskundef'} = _dumptostr($obj); +sub reversekeys { return [ reverse sort keys %{+shift} ]; } - is($dumps{'ddskzero'}, $dumps{'objskzero'}, - "\$Data::Dumper::Sortkeys = 0 and Sortkeys(0) are equivalent"); - is($dumps{'ddskzero'}, $dumps{'ddskundef'}, - "\$Data::Dumper::Sortkeys = 0 and = undef equivalent"); - is($dumps{'objkzero'}, $dumps{'objkundef'}, - "Sortkeys(0) and Sortkeys(undef) are equivalent"); - %dumps = (); - - note("Perl implementation"); - $Data::Dumper::Useperl = 1; - - $starting = $Data::Dumper::Sortkeys; - $sortkeys = 0; - local $Data::Dumper::Sortkeys = $sortkeys; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddskzero'} = _dumptostr($obj); - local $Data::Dumper::Sortkeys = $starting; - - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Sortkeys($sortkeys); - $dumps{'objskzero'} = _dumptostr($obj); - - $sortkeys = undef; - local $Data::Dumper::Sortkeys = $sortkeys; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddskundef'} = _dumptostr($obj); - local $Data::Dumper::Sortkeys = $starting; - - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Sortkeys($sortkeys); - $dumps{'objskundef'} = _dumptostr($obj); - - is($dumps{'ddskzero'}, $dumps{'objskzero'}, - "\$Data::Dumper::Sortkeys = 0 and Sortkeys(0) are equivalent"); - is($dumps{'ddskzero'}, $dumps{'ddskundef'}, - "\$Data::Dumper::Sortkeys = 0 and = undef equivalent"); - is($dumps{'objkzero'}, $dumps{'objkundef'}, - "Sortkeys(0) and Sortkeys(undef) are equivalent"); +sub reversekeystrim { + my $hr = shift; + my @keys = sort keys %{$hr}; + shift(@keys); + return [ reverse @keys ]; } -note("Internal subroutine _sortkeys"); -my %e = ( - nu => 'n', - lambda => 'l', - kappa => 'k', - mu => 'm', - omicron => 'o', -); -my $rv = Data::Dumper::_sortkeys(\%e); -is(ref($rv), 'ARRAY', "Data::Dumper::_sortkeys returned an array ref"); -is_deeply($rv, [ qw( kappa lambda mu nu omicron ) ], - "Got keys in Perl default order"); - -{ - my $warning = ''; - local $SIG{__WARN__} = sub { $warning = $_[0] }; - - my ($obj, %dumps, $starting); - - note("\$Data::Dumper::Sortkeys and Sortkeys() set to coderef"); - sub badreturnvalue { return { %{+shift} }; } - - note("Perl implementation"); - $Data::Dumper::Useperl = 1; - - $starting = $Data::Dumper::Sortkeys; - local $Data::Dumper::Sortkeys = \&badreturnvalue; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddsksub'} = _dumptostr($obj); - like($warning, qr/^Sortkeys subroutine did not return ARRAYREF/, - "Got expected warning: sorting routine did not return array ref"); -} +sub badreturnvalue { return { %{+shift} }; } diff --git a/dist/Data-Dumper/t/sparseseen.t b/dist/Data-Dumper/t/sparseseen.t index 3658b85..c78dec6 100644 --- a/dist/Data-Dumper/t/sparseseen.t +++ b/dist/Data-Dumper/t/sparseseen.t @@ -26,59 +26,20 @@ my %d = ( alpha => 'a', ); -{ - my ($obj, %dumps, $sparseseen, $starting); - - note("\$Data::Dumper::Sparseseen and Sparseseen() set to true value"); - note("XS implementation"); - $Data::Dumper::Useperl = 0; - - $starting = $Data::Dumper::Sparseseen; - $sparseseen = 1; - local $Data::Dumper::Sparseseen = $sparseseen; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddssone'} = _dumptostr($obj); - local $Data::Dumper::Sparseseen = $starting; - - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Sparseseen($sparseseen); - $dumps{'objssone'} = _dumptostr($obj); - - is($dumps{'ddssone'}, $dumps{'objssone'}, - "\$Data::Dumper::Sparseseen = 1 and Sparseseen(1) are equivalent"); - %dumps = (); - - $sparseseen = 0; - local $Data::Dumper::Sparseseen = $sparseseen; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddsszero'} = _dumptostr($obj); - local $Data::Dumper::Sparseseen = $starting; - - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Sparseseen($sparseseen); - $dumps{'objsszero'} = _dumptostr($obj); - - is($dumps{'ddsszero'}, $dumps{'objsszero'}, - "\$Data::Dumper::Sparseseen = 0 and Sparseseen(0) are equivalent"); - - $sparseseen = undef; - local $Data::Dumper::Sparseseen = $sparseseen; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddssundef'} = _dumptostr($obj); - local $Data::Dumper::Sparseseen = $starting; +run_tests_for_sparseseen(); +SKIP: { + skip "XS version was unavailable, so we already ran with pure Perl", 4 + if $Data::Dumper::Useperl; + local $Data::Dumper::Useperl = 1; + run_tests_for_sparseseen(); +} - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Sparseseen($sparseseen); - $dumps{'objssundef'} = _dumptostr($obj); +sub run_tests_for_sparseseen { + note("\$Data::Dumper::Useperl = $Data::Dumper::Useperl"); - is($dumps{'ddssundef'}, $dumps{'objssundef'}, - "\$Data::Dumper::Sparseseen = undef and Sparseseen(undef) are equivalent"); - is($dumps{'ddsszero'}, $dumps{'objssundef'}, - "\$Data::Dumper::Sparseseen = undef and = 0 are equivalent"); - %dumps = (); + my ($obj, %dumps, $sparseseen, $starting); - note("Perl implementation"); - $Data::Dumper::Useperl = 1; + note("\$Data::Dumper::Sparseseen and Sparseseen() set to true value"); $starting = $Data::Dumper::Sparseseen; $sparseseen = 1; @@ -123,6 +84,5 @@ my %d = ( is($dumps{'ddsszero'}, $dumps{'objssundef'}, "\$Data::Dumper::Sparseseen = undef and = 0 are equivalent"); %dumps = (); - } diff --git a/dist/Data-Dumper/t/toaster.t b/dist/Data-Dumper/t/toaster.t index d82524d..6e7d0e0 100644 --- a/dist/Data-Dumper/t/toaster.t +++ b/dist/Data-Dumper/t/toaster.t @@ -26,59 +26,20 @@ my %d = ( alpha => 'a', ); -{ - my ($obj, %dumps, $toaster, $starting); - - note("\$Data::Dumper::Toaster and Toaster() set to true value"); - note("XS implementation"); - $Data::Dumper::Useperl = 0; - - $starting = $Data::Dumper::Toaster; - $toaster = 1; - local $Data::Dumper::Toaster = $toaster; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddtoasterone'} = _dumptostr($obj); - local $Data::Dumper::Toaster = $starting; - - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Toaster($toaster); - $dumps{'objtoasterone'} = _dumptostr($obj); - - is($dumps{'ddtoasterone'}, $dumps{'objtoasterone'}, - "\$Data::Dumper::Toaster = 1 and Toaster(1) are equivalent"); - %dumps = (); - - $toaster = 0; - local $Data::Dumper::Toaster = $toaster; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddtoasterzero'} = _dumptostr($obj); - local $Data::Dumper::Toaster = $starting; - - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Toaster($toaster); - $dumps{'objtoasterzero'} = _dumptostr($obj); - - is($dumps{'ddtoasterzero'}, $dumps{'objtoasterzero'}, - "\$Data::Dumper::Toaster = 0 and Toaster(0) are equivalent"); - - $toaster = undef; - local $Data::Dumper::Toaster = $toaster; - $obj = Data::Dumper->new( [ \%d ] ); - $dumps{'ddtoasterundef'} = _dumptostr($obj); - local $Data::Dumper::Toaster = $starting; +run_tests_for_toaster(); +SKIP: { + skip "XS version was unavailable, so we already ran with pure Perl", 4 + if $Data::Dumper::Useperl; + local $Data::Dumper::Useperl = 1; + run_tests_for_toaster(); +} - $obj = Data::Dumper->new( [ \%d ] ); - $obj->Toaster($toaster); - $dumps{'objtoasterundef'} = _dumptostr($obj); +sub run_tests_for_toaster { + note("\$Data::Dumper::Useperl = $Data::Dumper::Useperl"); - is($dumps{'ddtoasterundef'}, $dumps{'objtoasterundef'}, - "\$Data::Dumper::Toaster = undef and Toaster(undef) are equivalent"); - is($dumps{'ddtoasterzero'}, $dumps{'objtoasterundef'}, - "\$Data::Dumper::Toaster = undef and = 0 are equivalent"); - %dumps = (); + my ($obj, %dumps, $toaster, $starting); - note("Perl implementation"); - $Data::Dumper::Useperl = 1; + note("\$Data::Dumper::Toaster and Toaster() set to true value"); $starting = $Data::Dumper::Toaster; $toaster = 1; @@ -123,6 +84,5 @@ my %d = ( is($dumps{'ddtoasterzero'}, $dumps{'objtoasterundef'}, "\$Data::Dumper::Toaster = undef and = 0 are equivalent"); %dumps = (); - } -- 1.6.3.2 ```
p5pRT commented 11 years ago

From @tsee

On 03/10/2013 04​:15 PM\, James E Keenan via RT wrote​:

I am attaching a new patch which is essentially the same as the last one I provided\, only specific to blead rather than CPAN. This is what should be reviewed for application to blead; I can provide Steffen with another version more specific to CPAN.

Just for the record​: The only differences between core and CPAN versions right now are in "distribution" related files such as Makefile.PL. There is no actual code difference in t/ or lib/. I would feel very strongly inclined to renounce any involvement if the code started to diverge in any way. I've maintained such modules before and have generally tried really hard to eliminate such differences with a vengeance because they make maintenance a nightmare.

Therefore\, if you need to have different code paths in core and on CPAN (and please try to avoid them if at all possible)\, consider using "if ($ENV{PERL_CORE}) {} else {}". This goes for tests only. There's no reason -- ever -- to have the code in lib/ differ. I'm sure you agree to that last bit. :)

Best regards\, Steffen

PS​: sorry for the delay in replying. Been travelling.

p5pRT commented 11 years ago

From @xdg

I have applied Karl's patch as commit d5e7da3f5f24a2f939b1ab09636454644f7dac8a.

As this addresses the initial ticket (at least once a new Data​::Dumper is released to CPAN)\, I am marking this ticket as resolved.

The related issue of what to do about Data​::Dumper on CPAN for systems without a Perl compiler (mandate a compiler vs fix the tests as discussed) is a separate issue and I'll follow up with people separately.

p5pRT commented 11 years ago

@xdg - Status changed from 'open' to 'resolved'

p5pRT commented 11 years ago

From @dolmen

Le Jeu. Mar. 14 16​:12​:59 2013\, dagolden@​cpan.org a �crit�​:

I have applied Karl's patch as commit d5e7da3f5f24a2f939b1ab09636454644f7dac8a.

As this addresses the initial ticket (at least once a new Data​::Dumper is released to CPAN)\, I am marking this ticket as resolved.

Thanks to everyone for the fixes.

Olivier.

p5pRT commented 11 years ago

From [Unknown Contact. See original ticket]

Le Jeu. Mar. 14 16​:12​:59 2013\, dagolden@​cpan.org a �crit�​:

I have applied Karl's patch as commit d5e7da3f5f24a2f939b1ab09636454644f7dac8a.

As this addresses the initial ticket (at least once a new Data​::Dumper is released to CPAN)\, I am marking this ticket as resolved.

Thanks to everyone for the fixes.

Olivier.