Skip Menu |

This queue is for tickets about the Jifty CPAN distribution.

Report information
The Basics
Id: 60354
Status: resolved
Priority: 0/
Queue: Jifty

People
Owner: Nobody in particular
Requestors: ANSGAR [...] cpan.org
Cc:
AdminCc:

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



Subject: Test failure with YAML-Syck 1.12
Date: Sun, 15 Aug 2010 12:26:51 +0900
To: bug-Jifty [...] rt.cpan.org
From: Ansgar Burchardt <ANSGAR [...] cpan.org>
Hi, for Jifty 0.91117 the test t/TestApp-Plugin-SetupWizard/t/001-basic.t fails with YAML-Syck 1.12: --8<---------------cut here---------------start------------->8--- 'etc/site_config.yml' is empty or non-existant at /usr/lib/perl5/YAML/Syck.pm line 129. # Looks like you planned 14 tests but ran 3. # Looks like your test exited with 2 just after 3. t/TestApp-Plugin-SetupWizard/t/001-basic.t ............. Dubious, test returned 2 (wstat 512, 0x200) Failed 11/14 subtests --8<---------------cut here---------------end--------------->8--- (from Debian Bug #592981 [1], full log available at [2]) [1] <http://bugs.debian.org/592981> [2] <http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=salvi-jifty_0.91117%2Bdfsg-2-amd64-20100814-1944;att=1;bug=592981> This is due to a change in YAML-Syck 1.10_01: --8<---------------cut here---------------start------------->8--- [Changes for 1.10_01 (JSON::Syck 0.34) - 2010-07-15] * LoadFile aborts loading an empty file [...] @@ -29,12 +28,17 @@ sub DumpFile { sub LoadFile { my $file = shift; if ( YAML::Syck::_is_openhandle($file) ) { + if(-z $file) { + die("Cannot load an empty file"); + } YAML::Syck::LoadJSON(do { local $/; <$file> }); } else { - local *FH; - open FH, "< $file" or die "Cannot read from $file: $!"; - YAML::Syck::LoadJSON(do { local $/; <FH> }); + if(!-e $file || -z $file) { + die("'$file' is non-existant or empty"); + } + open(my $fh, '<', $file) or die "Cannot read from $file: $!"; + YAML::Syck::LoadJSON(do { local $/; <$fh> }); } } --8<---------------cut here---------------end--------------->8--- The function site_config_is in t/TestApp-Plugin-SetupWizard/lib/TestApp/Plugin/SetupWizard/Test.pm needs to be adjusted for this changed behavior, it only handles the "Cannot read from " error message right now. Regards, Ansgar
Subject: Re: [rt.cpan.org #60354] AutoReply: Test failure with YAML-Syck 1.12
Date: Sun, 15 Aug 2010 12:47:55 +0900
To: bug-Jifty [...] rt.cpan.org
From: Ansgar Burchardt <ANSGAR [...] cpan.org>
Hi, Show quoted text
> - local *FH; > - open FH, "< $file" or die "Cannot read from $file: $!"; > - YAML::Syck::LoadJSON(do { local $/; <FH> }); > + if(!-e $file || -z $file) { > + die("'$file' is non-existant or empty"); > + } > + open(my $fh, '<', $file) or die "Cannot read from $file: $!"; > + YAML::Syck::LoadJSON(do { local $/; <$fh> });
This was the wrong chunk of the diff, but an equivalent change has been done to the LoadYAML function as well. There is only a subtle difference: It uses the message "'$file' is empty or non-existant". I have attached a patch that makes Jifty pass the tests here. Please consider applying it. Regards, Ansgar
--- jifty-0.91117+dfsg.orig/t/TestApp-Plugin-SetupWizard/lib/TestApp/Plugin/SetupWizard/Test.pm +++ jifty-0.91117+dfsg/t/TestApp-Plugin-SetupWizard/lib/TestApp/Plugin/SetupWizard/Test.pm @@ -34,7 +34,7 @@ sub site_config_is { my $name = shift; my $got = eval { Jifty::YAML::LoadFile('etc/site_config.yml') }; - die $@ if $@ && $@ !~ /Cannot read from/; + die $@ if $@ && $@ !~ /Cannot read from/ && $@ !~ /is empty or non-existant/; Test::More::is_deeply($got, $expected, $name); }
Thanks! This is fixed by commit 8922e575e6c25488e73155160530199aea69740e. http://github.com/bestpractical/jifty/commit/8922e575e6c25488e731551605301 99aea69740e Cheers, Thomas