Bug#762135: libyaml-tiny-perl: YAML::Tiny >=1.60 generates certain(?) strings without quotes
Michael Prokop
mika at debian.org
Thu Sep 18 19:54:47 UTC 2014
Package: libyaml-tiny-perl
Version: 1.63-1
Severity: important
NOTE: I've already reported this to upstream in
https://rt.cpan.org/Public/Bug/Display.html?id=97870 but as I would
like to prevent this bug to appear in Debian/jessie I'm reporting it
here as well.
I noticed a parsing problem with a YAML file which is caused by the way
YAML::Tiny generates the YAML file since recent versions.
Minimized demo code:
% cat demo.pl
#!/usr/bin/perl
use strict;
use warnings;
use YAML::Tiny;
my $yaml = YAML::Tiny->new;
my $outputfile = shift;
$yaml->[0]->{foo} = '^00|\+([1-9][0-9]+)$';
open(my $fh, '>', "$outputfile");
print $fh $yaml->write_string();
Now that's what's working as expected with older versions:
% dpkg --list libyaml-tiny-perl | grep '^ii'
ii libyaml-tiny-perl 1.56-1 all Perl module for reading and writing YAML files
% perl ./demo.pl demo.yml
% cat demo.yml
---
foo: '^00|\+([1-9][0-9]+)$'
But at least since YAML::Tiny v1.60 (verified with 1.60 + 1.63) it's
generating unexpected output WRT the quoting:
% dpkg --list libyaml-tiny-perl | grep '^ii'
ii libyaml-tiny-perl 1.63-1 all Perl module for reading and writing YAML files
% perl ./demo.pl demo.yml
% cat demo.yml
---
foo: ^00|\+([1-9][0-9]+)$
Notice the missing quotes around the '^00...' string in its output.
This is the (minimised) code that's in use and broke with the
change:
% cat foo.pl
#!/usr/bin/perl
use strict;
use warnings;
use Hash::Merge qw(merge);
use YAML qw/LoadFile/;
my $file = "demo.yml";
my $config = {};
$config = merge($config, LoadFile($file) || die $!);
When using the input from above:
% cat demo.yml
---
foo: ^00|\+([1-9][0-9]+)$
... this fails with:
% perl ./foo.pl
YAML Error: Unrecognized implicit value '^00|\+([1-9][0-9]+)$'
Code: YAML_PARSE_ERR_BAD_IMPLICIT
Line: 2
Document: 1
at /usr/share/perl5/YAML/Loader.pm line 567.
It works fine with the strings around the ^00....' as generated from
previous versions of YAML::Tiny though. (FTR:
/usr/share/perl5/YAML/Loader.pm is from libyaml-perl, reproduced
with versions 0.98 and 1.09-1.)
regards,
-mika-
More information about the pkg-perl-maintainers
mailing list