aboutsummaryrefslogtreecommitdiff
path: root/doc/bugs/structured_config_data_is_mangled.mdwn
diff options
context:
space:
mode:
authorhttps://www.google.com/accounts/o8/id?id=AItOawlSFgIlytGZgMLh_Cw4IA011V8pLKk5dVg <Brian@web>2013-11-29 10:04:10 -0400
committeradmin <admin@branchable.com>2013-11-29 10:04:10 -0400
commit9919f92be5243918178e222b876ab09317b00ab2 (patch)
treeb88284e32589b9611ccd878fd2c16c00f0cae4ef /doc/bugs/structured_config_data_is_mangled.mdwn
parent68987ed560d45b005c15cbb87d6713cbdfc3ea3a (diff)
downloadikiwiki-9919f92be5243918178e222b876ab09317b00ab2.tar
ikiwiki-9919f92be5243918178e222b876ab09317b00ab2.tar.gz
Diffstat (limited to 'doc/bugs/structured_config_data_is_mangled.mdwn')
-rw-r--r--doc/bugs/structured_config_data_is_mangled.mdwn48
1 files changed, 48 insertions, 0 deletions
diff --git a/doc/bugs/structured_config_data_is_mangled.mdwn b/doc/bugs/structured_config_data_is_mangled.mdwn
new file mode 100644
index 000000000..7d8f5defb
--- /dev/null
+++ b/doc/bugs/structured_config_data_is_mangled.mdwn
@@ -0,0 +1,48 @@
+Put something like this in the setup file:
+
+~~~
+conversion:
+ - from: odt
+ to: pdf
+ command: [unoconv, -f, pdf, -o, $OUTPUTDIR, $INPUTFILE]
+ - from: ditaa
+ to: png
+ command: [ditaa, $INPUTFILE, $OUTPUTFILE, -s, 0.7]
+~~~
+
+However `Dumper($config{conversion})` shows:
+
+~~~
+$VAR1 = [
+ 'HASH(0x164e1a0)',
+ 'HASH(0x164e3c8)'
+ ];
+~~~
+
+I think it is getting mangled in `sub merge` in `IkiWiki/Setup.pm` and its calls to `possibly_foolish_untaint`
+
+Workaround: force the array values to be strings, and then re-parse them using YAML::XS::Load:
+
+~~~
+conversion:
+ - |
+ from: [odt, odp]
+ to: pdf
+ command: [unoconv, -f, pdf, -o, $OUTPUTDIR, $INPUTFILE]
+ - |
+ from: ditaa
+ to: png
+ command: [ditaa, $INPUTFILE, $OUTPUTFILE, -s, 0.7]
+
+...
+
+sub checkconfig {
+ if (!defined $config{conversion} || ref $config{conversion} ne "ARRAY") {
+ error(sprintf(gettext("Must specify '%s' and it must be a list"), "conversion"));
+ }
+ for (my $i=0; $i < @{$config{conversion}}; $i++) {
+ $config{conversion}->[$i] = YAML::XS::Load($config{conversion}->[$i]) if
+ ref $config{conversion}->[$i] ne 'HASH';
+ }
+}
+~~~