]> sipb.mit.edu Git - ikiwiki.git/blob - doc/bugs/methodResponse_in_add__95__plugins.mdwn
comments
[ikiwiki.git] / doc / bugs / methodResponse_in_add__95__plugins.mdwn
1 **problem description:** when using an external plugin like rst, the cgi script (but not the build process) fails with the following words:
2
3     Unsuccessful stat on filename containing newline at /usr/share/perl5/IkiWiki.pm line 501.
4     Unsuccessful stat on filename containing newline at /usr/share/perl5/IkiWiki.pm line 501.
5     Failed to load plugin IkiWiki::Plugin::</methodResponse>
6     : Can't locate IkiWiki/Plugin/.pm in @INC (@INC contains: /home/ikiwiki/.ikiwiki /etc/perl \
7     /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 \
8     /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at (eval 44) line 3. 
9     BEGIN failed--compilation aborted at (eval 44) line 3.
10
11 **setup used:** blank debian sid with ikiwiki 2.61 (but as the patch can be cleanly merged to git HEAD, i suppose this would happen on HEAD as well). perl version is 5.10.0-13.
12
13 **problem analysis:** `strings ikiwiki.cgi` tells that the stored WRAPPED\_OPTIONS contain the string "&lt;/methodResponse&gt;\n" where i'd expect "rst" in `config{add_plugins}`. this seems to originate in the use of `$_` in the plugin loading function.
14
15 **patch comment:** solves the problem on 2.61. as these are the first lines of perl i've knowingly written, i can not explain what exactly was happening there.
16
17 > Perl's `$_` handling is the worst wart on it, or possibly any language.
18 > Here it's an alias to the actual value in the array, and when deep
19 > in the external plugin load code something resets `$_` to a different
20 > value, the alias remains and it changes the value at a distance.
21
22 > Thanks for the excellent problem report, [[fixed|done]]. --[[Joey]]
23
24 ------------------------------------------------------------------------------
25     diff --git a/IkiWiki.pm b/IkiWiki.pm
26     index e476521..d43abd4 100644
27     --- a/IkiWiki.pm
28     +++ b/IkiWiki.pm
29     @@ -471,7 +471,11 @@ sub loadplugins () {
30                     unshift @INC, possibly_foolish_untaint($config{libdir});
31             }
32      
33     -       loadplugin($_) foreach @{$config{default_plugins}}, @{$config{add_plugins}};
34     +       my $pluginname;
35     +       foreach $pluginname (@{$config{default_plugins}}, @{$config{add_plugins}})
36     +       {
37     +               loadplugin($pluginname);
38     +       }
39      
40             if ($config{rcs}) {
41                     if (exists $IkiWiki::hooks{rcs}) {