In
TWikiTopicUpgradeScript SvenDowideit let it slip that he just used
RCS to unlock the locks.
ThomasWeigert followed up with some more detailed info, and
MattWilkie hacked together
a cgi script which does it all at the push of a button.
Please note that Matt doesn't have much of a clue when it comes to programming. However there are few others about who do who kindly massaged Matt's working crud into real code that fits with the rest of twiki:
CrawfordCurrie and
SvenDowideit. Thanks guys!
This function changes the
RCS lock owner to the web server user.
It is to be run only as needed, which is probably:
- on a new installation,
- you've moved to a different server
- you've installed some new plugins or addons.
To access it interactively, go to
http://yourdomain.com/bin/testenv and look for the link titled
relock.
This is a function in
TWiki::UI::Manage
,
sub relockRcsFiles
that gets called from a button on the
TestenvCgiScript (adding it as a
CgiParam to
ManageCgiScript makes sense due to the authentication needs).
--
MattWilkie,
CrawfordCurrie,
SvenDowideit - 28 Jun 2004 thru 24 Sept 2004
[...] I will refactor
StoreDotPm etc to so that i can use unlock and lock functions generically in
DakarRelease.
--
SvenDowideit - 25 Jul 2004
Changelog for _chgrcslocks
- 1.1 initial version
- 1.2 improved feedback
- 1.3 CrawfordCurrie re-worked script to work on large numbers of topics, cleaned out cruft. Thanks CC!
- 1.4 renamed to
relockrcs
and moved into TWiki::UI::Manage
.Version numbers will no longer be kept.
Known to work on
- CYGWIN_NT-5.0 1.5.7(0.109/3/2) 2004-01-30 19:32 i686 unknown unknown Cygwin, Apache/2.0.48 (Win32), perl 5.8.1 (Cygwin)
- Linux 2.4.21 #1 SMP Fri Jul 11 14:00:33 PDT 2003 i686 i686 i386 GNU/Linux, Apache/2.0.49, perl 5.8.0
- NetBSD 1.6.2 NetBSD 1.6.2 (sdf) #0: Mon Mar 8 21:35:25 UTC 2004, Apache/1.3.29 (Unix), perl 5.6.1
- ...?
Has problems on
-
NetBSD 1.6.2 NetBSD 1.6.2 (sdf) #0: Mon Mar 8 21:35:25 UTC 2004, Apache/1.3.29 (Unix), perl 5.6.1 works now that the code has been moved into Manage.pm
(as relockrcs
)
- ...?
Discussion
...discussion prompted from SourceForgeDec2004UpgradeIssue
There is something bad with the
manage?action=relockrcs
code. I could verify that the backup I did yesterday had the correct author
TomWhite for
TikiWiki (
1.19 date 2004.02.10.15.16.18; author TomWhite; state Exp;
), now it is nfsnobody (
1.20 date 2004.12.09.21.10.47; author nfsnobody; state Exp;
)
--
PeterThoeny - 10 Dec 2004
Had a look at the
relockRcsFiles
sub in MAIN's SVNMAIN:lib/TWiki/UI/Manage.pm and it seems that it does it using the
RCS commands. Running a
perl -pi.bak
substitution would avoid the author becoming nfsnobody, which is presumably the result of the four
RCS commands in
relockRcsFiles
.
Why does this code do the
ci
and
co
at the end? The first two commands,
rcs -u
and
rcs -l
, should be enough to successfully lock and unlock, and the last two just seem to do a new checkout that messes things up, though I haven't tested this.
If we do go the Perl route, the
-pi.bak
must use a backup file on Windows - if you don't, I think it can delete the file or fail to replace or something, though strangely it works when just tested on Cygwin Perl 5.8.5.
On whatever platform, might be useful to avoid copying the entire set of topics into
.bak
but relock is normally done on a new install so may not be an issue.
--
RichardDonkin - 10 Dec 2004
Note that
relockrcs
has been removed in DEVELOP r3284. There was a very short bug fix in
LockRecoveryFailure which made it completely unnecessary.
I don't know why there is an extra checkin at the end. The original script didn't do that (
RelockingRCSFiles).
--
MattWilkie - 10 Dec 2004
Does the bug fix in DEVELOP mean that there's no point having
testenv
check on the lock owner and/or offer to re-lock? At least on releases after 3284 that is -
testenv
is meant to work on all earlier releases, but if the relock code delivered in Cairo is broken we should take out the easy one-click relocking from
testenv
as well!
If we do still need relocking from testenv for older releases, the code should be moved from Manage.pm into
testenv
- otherwise testenv will break on some releases.
--
RichardDonkin - 10 Dec 2004
Yes, relock should be removed from testenv for newer releases (
TestEnvAndManageScriptStillReferenceRelockRcsFiles).
And as for the relock breakage, I would comment out:
print `$TWiki::rcsDir/ci -mtestenv -t-missing_v $TWiki::dataDir/$web/$topic`;
print `$TWiki::rcsDir/co -q -l -M $TWiki::dataDir/$web/$topic`;
and keep it (I still think this is less dangerous than getting people to mass edit the ,v files with perl from the shell). At least until someone can explain why the extra ci/co was needed.
--
MattWilkie - 10 Dec 2004
I think I added them to cater for an upgrade of topics that do not have ,v files, or for the possibility that the .txt has not been checked into the ,v (i think it happend at the time). it probably has more to do with upgrade than pure re-lock though.
--
SvenDowideit - 10 Dec 2004
%ACTION{ who="Main.SvenDowideit" state="open" }%
RichardDonkin has correctly reminded me that we probably need a version of this code in DEVELOP to upgrade existing TWiki's