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