]> sipb.mit.edu Git - ikiwiki.git/blob - doc/patchqueue/lib-fixup.mdwn
response
[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 <pre> 
25 Index: Makefile.PL
26 ===================================================================
27 --- Makefile.PL (revision 2630)
28 +++ Makefile.PL (working copy)
29 @@ -24,6 +24,7 @@
30  )
31  
32  extra_build:
33 +       LANG=C ./lib-fixup.pl ikiwiki.in
34         LANG=C ./ikiwiki.in doc html --templatedir=templates \
35                 --underlaydir=basewiki \
36                 --wikiname="ikiwiki" --verbose --no-rcs \
37 Index: lib-fixup.pl
38 ===================================================================
39 --- lib-fixup.pl        (revision 0)
40 +++ lib-fixup.pl        (revision 0)
41 @@ -0,0 +1,9 @@
42 +#!/usr/bin/perl -i.bak -p
43 +use strict;
44 +use warnings;
45 +my @dirs = $ENV{PERL5LIB} =~ /:/ ? split /:/, $ENV{PERL5LIB} : $ENV{PERL5LIB};
46 +if (@dirs) {
47 +    my $libs = join('', map { " use lib '$_';\n" } @dirs);
48 +    s/(use IkiWiki;)/$libs$1/;
49 +}
50
51
52 Property changes on: lib-fixup.pl
53 ___________________________________________________________________
54 Name: svn:executable
55    + *
56
57 </pre>