]> sipb.mit.edu Git - ikiwiki.git/blob - doc/plugins/contrib/cvs/discussion.mdwn
e1fa6e428cbe6ec876e300333eea388adcb3cfdd
[ikiwiki.git] / doc / plugins / contrib / cvs / discussion.mdwn
1 I've started reviewing this, and the main thing I don't like is the
2 post-commit wrapper wrapper that ikiwiki-makerepo is patched to set up.
3 That just seems unnecessarily complicated. Why can't ikiwiki itself detect
4 the "cvs add <directory>" call and avoid doing anything in that case?
5 --[[Joey]] 
6
7 > The wrapper wrapper does three things:
8 >
9 > 7. It ignores `cvs add <directory>`, since this is a weird CVS
10 > behavior that ikiwiki gets confused by and doesn't need to act on.
11 > 7. It prevents `cvs` locking against itself: `cvs commit` takes a
12 > write lock and runs the post-commit hook, which runs `cvs update`,
13 > which wants a read lock and sleeps forever -- unless the post-commit
14 > hook runs in the background so the commit can "finish".
15 > 7. It fails silently if the ikiwiki post-commit hook is missing.
16 > CVS doesn't have any magic post-commit filenames, so hooks have to
17 > be configured explicitly. I don't think a commit will actually fail
18 > if a configured post-commit hook is missing (though I can't test
19 > this at the moment).
20 >
21 > Thing 1 can probably be handled within ikiwiki, if that seems less
22 > gross to you.
23
24 >> It seems like it might be. You can use a `getopt` hook to check
25 >> `@ARGV` to see how it was called. --[[Joey]] 
26
27 >>> This does the trick iff the post-commit wrapper passes its args
28 >>> along. Committed on my branch. This seems potentially dangerous,
29 >>> since the args passed to ikiwiki are influenced by web commits.
30 >>> I don't see an exploit, but for paranoia's sake, maybe the wrapper
31 >>> should only be built with execv() if the cvs plugin is loaded?
32 >>> --[[schmonz]]
33
34 >>>> Hadn't considered that. While in wrapper mode the normal getopt is not
35 >>>> done, plugin getopt still runs, and so any unsafe options that 
36 >>>> other plugins support could be a problem if another user runs
37 >>>> the setuid wrapper and passes those options through. --[[Joey]]
38
39 >>>>> I've tried compiling the argument check into the wrapper as
40 >>>>> the first thing main() does, and was surprised to find that
41 >>>>> this doesn't prevent the `cvs add <dir>` deadlock in a web
42 >>>>> commit. I was convinced this'd be a reasonable solution,
43 >>>>> especially if conditionalized on the cvs plugin being loaded,
44 >>>>> but it doesn't work. And I stuck debug printfs at the beginning
45 >>>>> of all the rcs_foo() subs, and whatever `cvs add <dir>` is
46 >>>>> doing to ikiwiki isn't visible to my plugin, because none of
47 >>>>> those subs are getting called. Nuts. Can you think of anything
48 >>>>> else that might solve the problem, or should I go back to
49 >>>>> generating a minimal wrapper wrapper that checks for just
50 >>>>> this one thing? --[[schmonz]]
51
52 >>>>>> I don't see how there could possibly be a difference between
53 >>>>>> ikiwiki's C wrapper and your shell wrapper wrapper here. --[[Joey]]
54
55 > Thing 2 I'm less sure of. (I'd like to see the web UI return
56 > immediately on save anyway, to a temporary "rebuilding, please wait
57 > if you feel like knowing when it's done" page, but this problem
58 > with CVS happens with any kind of commit, and could conceivably
59 > happen with some other VCS.)
60
61 >> None of the other VCSes let a write lock block a read lock, apparently.
62 >> 
63 >> Anyway, re the backgrounding, when committing via the web, the
64 >> post-commit hook doesn't run anyway; the rendering is done via the
65 >> ikiwiki CGI. It would certianly be nice if it popped up a quick "working"
66 >> page and replaced it with the updated page when done, but that's
67 >> unrelated;  the post-commit
68 >> hook only does rendering when committing using the VCS directly. The
69 >> backgrounding you do actually seems safe enough -- but tacking
70 >> on a " &" to the ikiwiki wrapper call doesn't need a wrapper script,
71 >> does it? --[[Joey]]
72
73 >>> Nope, it works fine to append it to the `CVSROOT/loginfo` line.
74 >>> Fixed on my branch. --[[schmonz]]
75
76 > Thing 3 I think I did in order to squelch the error messages that
77 > were bollixing up the CGI. It was easy to do this in the wrapper
78 > wrapper, but if that's going away, it can be done just as easily
79 > with output redirection in `CVSROOT/loginfo`.
80 >
81 > --[[schmonz]]
82
83 >> If the error messages screw up the CGI they must go to stdout.
84 >> I thought we had stderr even in the the CVS dark ages. ;-) --[[Joey]] 
85
86 >>> Some messages go to stderr, but definitely not all. That's why
87 >>> I wound up reaching for IPC::Cmd, to execute the command line
88 >>> safely while shutting CVS up. Anyway, I've tested what happens
89 >>> if a configured post-commit hook is missing, and it seems fine,
90 >>> probably also thanks to IPC::Cmd.
91 >>> --[[schmonz]]