]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - doc/bugs/ikiwiki-mass-rebuild_has_probably_never_worked_portably.mdwn
Added my patch to pkgsrc ikiwiki for evaluation.
[git.ikiwiki.info.git] / doc / bugs / ikiwiki-mass-rebuild_has_probably_never_worked_portably.mdwn
1 As best as I can recall, running ikiwiki-mass-rebuild as root has never worked for me on NetBSD or Mac OS X. On both platforms, it gives me a shell as each user in the system wikilist. This is due to non-portable arguments to su(1).
3 The following patch works much better on the aforementioned platforms, as well as CentOS 6:
5     diff --git ikiwiki-mass-rebuild ikiwiki-mass-rebuild
6     index ce4e084e8..2ff33b493 100755
7     --- ikiwiki-mass-rebuild
8     +++ ikiwiki-mass-rebuild
9     @@ -32,7 +32,7 @@ sub processuser {
10         my $user=shift;
11         return if $user=~/^-/ || $users{$user};
12         $users{$user}=1;
13     -   my $ret=system("su", $user, "-s", "/bin/sh", "-c", "--", "$0 --nonglobal @ARGV");
14     +   my $ret=system("su", "-m", $user, "-c", "/bin/sh -c -- '$0 --nonglobal @ARGV'");
15         if ($ret != 0) {
16                 print STDERR "warning: processing for $user failed with code $ret\n";
17         }
19 The `-m` may be overzealous. I have some sites running as users with `/sbin/nologin` for a shell, and this allows running a command as those users, though without some typical environment variables. This is probably wrong. Maybe I should be doing something else to limit shell access for those users, and the su arg should instead be `-`.
21 --[[schmonz]]
23 > To get some real-world and very cross-platform testing, I've committed
24 > a conservative version of this patch, with `-` in place of `-m`, to
25 > pkgsrc's ikiwiki package (rev 3.20180311nb1), and will report back. In
26 > the meanwhile, would this change cause any obvious regressions on
27 > Debian? --[[schmonz]]