aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2012-01-28 22:01:49 -0400
committerJoey Hess <joey@kitenet.net>2012-01-28 22:36:14 -0400
commit6c3cdb04ac1794d2b3fd24f7da4c9ec4aac05d11 (patch)
treed0f3614f89a3a8162eae96ffba816e6a1f52680d
parente9c38d16fc587ccd5ab08166253afdc9363de65b (diff)
downloadikiwiki-6c3cdb04ac1794d2b3fd24f7da4c9ec4aac05d11.tar
ikiwiki-6c3cdb04ac1794d2b3fd24f7da4c9ec4aac05d11.tar.gz
Switch to YAML::XS to work around insanity in YAML::Mo. Closes: #657533
https://rt.cpan.org/Ticket/Display.html?id=74487 Gave up trying to support multiple YAML backends. The XS one requires ugly manual encoding to get unicode right, and doesn't allow dumping yaml fragments w/o the yaml header, but at least it doesn't randomly crash on import like YAML::Mo has started to.
-rw-r--r--Bundle/IkiWiki.pm2
-rw-r--r--IkiWiki/Setup/Yaml.pm12
-rw-r--r--debian/changelog1
-rw-r--r--debian/control4
-rwxr-xr-xikiwiki.in6
5 files changed, 11 insertions, 14 deletions
diff --git a/Bundle/IkiWiki.pm b/Bundle/IkiWiki.pm
index a0bd60e46..005936250 100644
--- a/Bundle/IkiWiki.pm
+++ b/Bundle/IkiWiki.pm
@@ -28,7 +28,7 @@ CGI::Session
Mail::Sendmail
CGI
Data::Dumper
-YAML
+YAML::XS
JSON
RPC::XML
diff --git a/IkiWiki/Setup/Yaml.pm b/IkiWiki/Setup/Yaml.pm
index 6da93bb64..6bf20f480 100644
--- a/IkiWiki/Setup/Yaml.pm
+++ b/IkiWiki/Setup/Yaml.pm
@@ -11,10 +11,8 @@ sub loaddump ($$) {
my $class=shift;
my $content=shift;
- eval q{use YAML::Any};
- eval q{use YAML} if $@;
+ eval q{use YAML::XS};
die $@ if $@;
- $YAML::Syck::ImplicitUnicode=1;
IkiWiki::Setup::merge(Load(encode_utf8($content)));
}
@@ -35,12 +33,12 @@ sub dumpline ($$$$) {
my $type=shift;
my $prefix=shift;
- eval q{use YAML::Old};
- eval q{use YAML} if $@;
+ eval q{use YAML::XS};
die $@ if $@;
- $YAML::UseHeader=0;
+ $YAML::XS::QuoteNumericStrings=0;
- my $dump=Dump({$key => $value});
+ my $dump=decode_utf8(Dump({$key => $value}));
+ $dump=~s/^---\n//; # yaml header, we don't want
chomp $dump;
if (length $prefix) {
$dump=join("\n", map { $prefix.$_ } split(/\n/, $dump));
diff --git a/debian/changelog b/debian/changelog
index d014abd50..dbc9b16a5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ ikiwiki (3.20120116) UNRELEASED; urgency=low
* mdwn: Added nodiscount setting, which can be used to avoid using the
markdown discount engine, when maximum compatability is needed.
+ * Switch to YAML::XS to work around insanity in YAML::Mo. Closes: #657533
-- Joey Hess <joeyh@debian.org> Mon, 16 Jan 2012 13:41:14 -0400
diff --git a/debian/control b/debian/control
index 922fe3c77..9403dfb44 100644
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,7 @@ Build-Depends-Indep: dpkg-dev (>= 1.9.0), libxml-simple-perl,
libtimedate-perl, libhtml-template-perl,
libhtml-scrubber-perl, wdg-html-validator,
libhtml-parser-perl, liburi-perl (>= 1.36), perlmagick, po4a (>= 0.34),
- libfile-chdir-perl, libyaml-perl, python-support
+ libfile-chdir-perl, libyaml-libyaml-perl, python-support
Maintainer: Joey Hess <joeyh@debian.org>
Uploaders: Josh Triplett <josh@freedesktop.org>
Standards-Version: 3.9.2
@@ -19,7 +19,7 @@ Architecture: all
Depends: ${misc:Depends}, ${perl:Depends}, ${python:Depends},
libtext-markdown-discount-perl,
libhtml-scrubber-perl, libhtml-template-perl,
- libhtml-parser-perl, liburi-perl (>= 1.36), libyaml-perl, libjson-perl
+ libhtml-parser-perl, liburi-perl (>= 1.36), libyaml-libyaml-perl, libjson-perl
Recommends: gcc | c-compiler,
libc6-dev | libc-dev,
git (>= 1:1.7) | git-core (>= 1:1.5.0) | subversion | tla | bzr (>= 0.91) | mercurial | monotone (>= 0.38) | darcs,
diff --git a/ikiwiki.in b/ikiwiki.in
index adff1411e..e6b64f439 100755
--- a/ikiwiki.in
+++ b/ikiwiki.in
@@ -108,11 +108,9 @@ sub getconfig () {
if (! defined $var || ! defined $val) {
die gettext("usage: --set-yaml var=value"), "\n";
}
- eval q{use YAML::Any};
- eval q{use YAML} if $@;
+ eval q{use YAML::XS; use Encode};
die $@ if $@;
- eval q{$YAML::Syck::ImplicitUnicode=1};
- $config{$var}=Load($val."\n");
+ $config{$var}=Load(encode_utf8($val)."\n");
},
"version" => sub {
print "ikiwiki version $IkiWiki::version\n";