]> sipb.mit.edu Git - ikiwiki.git/blob - doc/patchqueue/lib-fixup.mdwn
web commit by http://id.inelegant.org/: Added pm_filter patch to optionally remove...
[ikiwiki.git] / doc / patchqueue / lib-fixup.mdwn
1 I'm using Ikiwiki on a box where I don't have root access, so I install all of my Perl modules in `~/lib`. The `ikiwiki.in` script is ran in Taint mode, which means that it ignores the contents of `$ENV{PERL5LIB}`. The result is that the current versions of the pre-requisite modules I've installed in `~/lib` are ignored by `./make`, which uses the outdated, and therefore incompatible versions, from the system-wide `@INC`... ;-)
2
3 I imagine that there's a clean and elegant solution to this, but the hack I'm currently using is to have `./make` alter `ikiwki.in` before it's run, by inserting `use lib ...` lines for each of the directories in `$ENV{PERL5LIB}`. Again, this is clearly ugly, but it allows me to run `./make`, so I'm submitting it FWIW.
4
5 > I don't like this patch because it's not expected that an environment
6 > variable will stick around outside the shell that it's set in. It could
7 > lead to suprising behavior if PERL5LIB happened to be set during build,
8 > and it's even possible for it to lead to security issues, imagine if I
9 > accidentially built the debian package of ikiwiki with PERL5LIB set --
10 > then it would be hardcoded to look in /home/joey for libraries, which
11 > someone with a "joey" account elsewhere could use to exploit it.
12 >
13 > You could remove the taint switch locally, it's very unlikely to find
14 > tainting problems that nobody else has noticed. --[[Joey]]
15
16 >> I completely understand rejecting this patch, but would you accept one to automate the removal of -T as a `make` option, then? I was trying to install Ikiwiki on a very popular
17 >> web host, and the aforementioned issue took quite a while to debug; I imagine many people would have simply given up. -- Ben
18
19 >>> Well, the problem with an option is finding the option before you give
20 >>> up. Maybe an option and adding some docs to the [[setup]] or [[tips]] page
21 >>> about how to use ikiwiki with $BIG_HOSTING_PROVIDER, that can mention
22 >>> the option. --[[Joey]]
23
24 >>>> I was going to write a guide for shared hosting setup anyway, so that sounds great. My `make`-fu is weak, so I don't know the Right Way to add an extra option, but here's a patch for removing the -T flag. -- Ben
25
26 <pre>
27 Index: pm_filter
28 ===================================================================
29 --- pm_filter   (revision 2644)
30 +++ pm_filter   (working copy)
31 @@ -4,6 +4,7 @@
32         $prefix=shift;
33         $ver=shift;
34         $libdir=shift;
35 +       $notaint=shift;
36  }
37  
38  if (/INSTALLDIR_AUTOREPLACE/) {
39 @@ -19,4 +20,7 @@
40         else {
41                 $_="use lib '$libdir';\n";
42         }
43 +} 
44 +elsif ($. == 1 && $notaint && m{^(#!/usr/bin/perl) -T$}) {
45 +    $_=qq{$1\n};
46  }
47 </pre>