TWiki should not use the Apache user for RCS, instead it should override it in cfg{RCS}{ciCmd}
The following is a summary of an email dialog between
ColasNahaboo and
CrawfordCurrie in response to the question posed by
MartinCleaver. My thanks to Colas and Crawford.
Original question was posed in
Bugs:Item1286
:
>
I moved a web from an old Cairo install held in unix user 'usera' to a new Dakar install held in unix
>
user 'userb'.
>
>
Doing so caused TWiki to barf on save (can't get lock).
As the topics should be accessed only by one apache user, the following solution saves all that editing the ,v files replacing the locking user when moving to a different apache user. (i.e.
RelockRcsOnDakar)
--
MartinCleaver - 07 Jan 2006
--++ Solution
For Dakar:
>
$cfg{RCS}{ciCmd} = 'export USER=twiki; export LOGNAME=twiki; /usr/bin/ci.......
For Cairo:
$ENV{USER} = nobody; $ENV{LOGNAME} = nobody;
(Though am not quite sure where this goes for Cairo).
This means the
RCS files always use the same
RCS user irrespective of the apache user.
A one-off
RelockRcsFiles to the twiki
RCS user is needed after
--++ Dialog
Hi Colas,
Was speaking to Crawford... relevant bits below... Can you please comment on
http://develop.twiki.org/~develop/cgi-bin/view/Bugs/Item1286#r6
?
Thanks, and Happy New Year,
Martin.
[5:29:25 PM] Martin Cleaver| London, UK says: Hi Crawford - re: Should Cairo strict locks be softened when edited by Dakar? - which is the right approach, bulk unlocking or bulk non-stricting?
[5:30:04 PM] Crawford Currie says: it depends
[5:30:14 PM] Martin Cleaver| London, UK says: oh
[5:30:29 PM] Martin Cleaver| London, UK says: dakar locks are not strict though?
[5:30:47 PM] Martin Cleaver| London, UK says: so why does it depend?
[5:33:00 PM] Crawford Currie says: ok. Dakar locks are strict, I think - check the RCS commands
[5:33:30 PM] Crawford Currie says: it depends whether you plan to edit the topics in the same web with Cairo again
[5:33:47 PM] Crawford Currie says: I share webs between Cairo and Dakar quite happily
[5:34:09 PM] Crawford Currie says: but within the same apache server (i.e. with the same locking user)
[5:34:19 PM] Martin Cleaver| London, UK says: I read in TWiki: Codev.RcsNonStrictLocking or TWiki:Codev.KeepRcsFilesUnlocked that locks were now non strict
[5:34:34 PM] Crawford Currie says: don't read the docs; read the code ;)
[5:35:04 PM] Martin Cleaver| London, UK says: awww. :(
[5:35:39 PM] Martin Cleaver| London, UK says: ok, I think I don't care whether this web works with Cairo any more
[5:35:40 PM] * Crawford Currie hates over-documenting code, cos people start believing the docs
[5:36:16 PM] Crawford Currie says: if you don't care, then just unlock the topics in the web
[5:36:42 PM] Crawford Currie says: I can't remember the command, sorry :(
[5:37:02 PM] Martin Cleaver| London, UK says: what if I make them non-strict and unlocked?
[5:37:08 PM] Crawford Currie says: god knows
[5:37:15 PM] Crawford Currie says: try it; see what explodes
[5:37:20 PM] Crawford Currie says: >:-)
[5:37:40 PM] Martin Cleaver| London, UK says: unlocked is just one off I guess. As TWiki will relock
[5:37:47 PM] Martin Cleaver| London, UK says: non-strict is permanent
[5:38:28 PM] Martin Cleaver| London, UK says: as the topics should be accessed only by one apache user and negotiates locks with the .lock file shared by all TWiki users it seems that it would not matter
[5:38:59 PM] * Martin Cleaver| London, UK wonders whether what he just said makes much sense
[5:39:31 PM] Crawford Currie says: the .lock file has *nothing* to do with RCS locks
[5:39:45 PM] Martin Cleaver| London, UK says: I know
[5:39:57 PM] Martin Cleaver| London, UK says: so we don't need rcs locks as we do it ourselves?
[5:41:54 PM] Crawford Currie says: we need RCS locks
[5:42:15 PM] Crawford Currie says: well, actually, we don't have a choice in the matter
[5:42:33 PM] Crawford Currie says: as long as RCS is used, it creates locks. It needs to, for atomicity
[5:42:42 PM] Martin Cleaver| London, UK says: but do they need to check the user accessing them? (i.e. be strict)
[5:42:58 PM] Crawford Currie says: I really don't know
[5:43:08 PM] Crawford Currie says: I worked on the prinicpile of least change
[5:43:20 PM] Martin Cleaver| London, UK says: ok. I suspect they don't
[5:43:40 PM] Crawford Currie says: poss
[5:43:45 PM] Martin Cleaver| London, UK says: I'll ask Colas as he proposed that TWiki not have strict locking
[5:44:02 PM] Crawford Currie says: k
[5:44:26 PM] Martin Cleaver| London, UK says: saves all that editing the ,v files replacing the locking user when moving to a different apache user
Colas Nahaboo
to Martin, Colas, Crawford
Mmm. from my understanding:
RCS uses as user to lock the
RCS file the user set by apache. this is just the value of a shell env variable that you must set in the shell launcging apache.
The obvious solution would be to have TWiki set this variable itself to a twiki value ( e.g. "twiki") before calling any
RCS command, ensuring portability across (dakar and afterwards) implementation
If I understand the discussion. The major problem however IMHO is fixing the lock cloberring problem:
user A edits, goes to lunch
user B edits and save
user A saves ==> clobber
user B makes back in browser, edits, save ==> clobber
Crawford Currie says:
>
That's already fixed, with change merging. user A edits, goes to lunch user B...
Colas Nahaboo
to Martin, me, Crawford
On Tue, 3 Jan 2006 17:54:55 +0000
"Martin@Cleaver.org" <mrjcleaver@gmail.com> wrote:
>
[5:44:26 PM] Martin Cleaver| London, UK says: saves all that editing the
>
,v files replacing the locking user when moving to a different apache user
I think we should still use strict locking, as I found out that
RCS is
really designed to work in strcit locking mode. In non-strict, you are
always forced to temporarily re-strict-lock, do some operation not working
in non-strict, then re-lock. You thus loose atomicity of many operation, so
it is both more complex, slower, and brittle.
However,
RCS do not use the "apache user". It uses the contents of the
environment (aka shell) variables USER and LOGNAME. For instance in my
/etc/init.d/apache shell script launcher I have
export USER=nobody
export LOGNAME=nobody
So the solution I would advise is to, in perl, set the env variables
(I dont know the exact syntax)
$ENV{USER} = twiki; $ENV{LOGNAME} = twiki;
or (for better backwards compatibility with - most - Cairo installs)
$ENV{USER} = nobody; $ENV{LOGNAME} = nobody;
The above line should be called before each call to a
RCS command I guess,
(or just at the start of each bin/ script?)
to avoid problems with mod_perl
--
MartinCleaver - 07 Jan 2006