After upgrading from 4.0.2 to 4.0.4, I'm finding that newly created topics are being marked as version 1.2 instead of version 1.1, although the RCS store is correct. The discrepancy disappears after the first revision of the topic (both
*.txt
and
*.txt,v
are marked as version 1.2, then 1.3, etc.). The problem only arises when using
RcsLite, not
RcsWrap.
Here's a example of the files generated for a new topic:
TestTopic0.txt
This is a test.
-- Main.JamesAnderson - 03 Aug 2006
TestTopic0.txt,v
head 1.1;
access ;
symbols;
locks; strict;
comment @@;
1.1
date 2006.08.03.09.58.34; author JamesAnderson; state Exp;
branches;
next ;
desc
@@
1.1
log
@@
text
@%META:TOPICINFO{author="JamesAnderson" date="1154599114" format="1.1" version="1.2"}%
This is a test.
-- Main.JamesAnderson - 03 Aug 2006
@
My setup is: Solaris 5.8, Perl 5.6.1, Apache 1.3.33, Intranet access only.
As for reproducibility, I've yet to find anyone else who has encountered this problem (I asked around on
TWiki:Codev.TWikiIRC #twiki) but I can reproduce it any time I like on my system!
Update: I think I've tracked down the source of the problem. (
Caveat: This is my first foray into the source code!)
From 4.0.2 to 4.0.3 (specifically, SVN revision 10180) the following two lines were inserted into
TWiki::Store::RcsLite::numRevisions
:
# if state is is nocommav, there is only one revision
return 1 if $this->{state} eq 'nocommav';
Unless I'm mistaken, 0 should be returned rather than 1 when there is no RCS store (as is the case with a new topic). What's currently happening is that
numRevisions
is returning 1 for a new topic, then this is incremented (in
TWiki::Store::_noHandlersSave
) and used as the version number. However, on the first revision of the topic, 1 is returned
again and so the version number is correct from there on.
Can anyone with more knowledge of
RcsLite confirm my diagnosis?
Anyway, I've 'corrected' this line in my own installation and now new topics are marked as version 1.1. Whether my 'correction' has broken other things remains to be seen...
I'm surprised no one else has reported this problem. Shouldn't it affect everyone using 4.0.3 or 4.0.4 with
RcsLite?
--
TWiki:Main.JamesAnderson - 09 Aug 2006
Update 2: On further investigation, I think the line in question should be replaced with something like:
if( $this->{state} eq 'nocommav' ) {
return 1 if( -e $this->{file} );
return 0;
}
This mirrors the logic of
TWiki::Store::RcsWrap::numRevisions
and should give the correct version number both for non-existent topics (0) and for manually added topic files (1).
--
TWiki:Main.JamesAnderson - 11 Aug 2006
Good debugging, James. Your analysis seems sound. You will be pleased to hear that the unit tests pass with your change in place. I would have been grateful for an updated test that showed the problem, but in the absence of one I have checked in anyway. 11456
CC
Seems like an annoying bug for those using
RcsLite so I add this to hotfix-4.0.4-4
KJL
closed with 4.0.5
KJL