Bug: cannot update pages more than once in beta
After the first edit the following error shows up:
Software error:
Month '-1' out of range 0..11 at ../lib/TWiki.pm line 718
Test case
Environment
| TWiki version: |
03 Aug 2002 |
| TWiki plugins: |
Smilies |
| Server OS: |
Linux |
| Web server: |
Rapidsite/Apa/1.3.26 (Unix) ? |
| Perl version: |
5.6.0 |
| Client OS: |
Windows XP Pro |
| Web Browser: |
Opera 6 |
--
SvenTissot - 02 Oct 2002
Follow up
I got the same error on my TWiki, problems is arround "sub revDate2EpSecs" when it does $2-1.
If you take a look at your wikitopic.txt,v file probably date line has an imposible date with month 00
If you delete your wikitopic.txt,v there is no way to edit it.
I noticed this when I try
RcsLite ... I was almost lossing my hope ...
Jumping to
TWiki CVS I downloaded las TWiki.cfg ( 1.45) and TWiki.pm (1.58) - 9-Aug-2002- and ...
BINGO everything seems works fine for me now, even with
RcsLite and even deleting file wikitopic.txt,v
I hope it hepls !!!
Main.Jesus.Perez - 04 Oct 2002
Yes I am using
RcsLite (my ISP has no rcs provided) and I updated the above mentioned files
- it seems to work now ! Thank you very much .
kind regards
--
SvenTissot - 04 Oct 2002
oops, it does not work
If I edit an entry sometimes (?? not quite sure, i fear all the time )
the rcs
,v file suddenly gets entries like
1.2 date 70.00.01.00.00.00; author SvenTissot; state Exp; branches; next 1.1;
therefore diff and all version related things do not work for
this version
even after manually fixing this entry (diff does work again) and edit it again the
70.00.01.00.00.00 shows up again
I did a cvs update on my
lib and
bin directories but no cure
--
SvenTissot - 14 Oct 2002
The first edit is ok i.e. gets the correct timestamp, but if I
reedit within the locking period the timestamp is updated with the incorrect value. Which is the module to look in :
RcsLite.pm ... or one of the TWiki Modules ?
--
SvenTissot - 22 Oct 2002
RcsLite is maintained by
JohnTalintyre, so hopefully he will comment

You might want to try
RcsWrap, i.e. a separate
RCS -
RcsLite is quite new code. If you do, be sure to use GNU
RCS, 5.7 or higher.
I've taken off the
ImplementationDate as this refers to when a bug is fixed. For a better chance of getting this fixed, generate an
exact test case that shows the bug, ideally from a page shipped with TWiki or (better) a completely new page. If the developer can reproduce your bug easily, a fix is much more likely!
--
RichardDonkin - 28 Oct 2002
This is the RCSLite generated
,v File for a
new page:
head 1.1;
access;
symbols;
locks; strict;
comment @@;
1.1
date 2002.09.28.09.34.54; author SvenTissot; state Exp;
branches;
next ;
desc
@@
1.1
log
@none@
text
@%META:TOPICINFO{author="SvenTissot" date="1035797694" format="1.0" version="1.1"}%
1
-- Tissot.SvenTissot - 28 Oct 2002
@
and this is the same file after an immediate following edit:
head 1.1;
access;
symbols;
locks; strict;
comment @@;
1.1
date 70.00.01.00.00.00; author SvenTissot; state Exp;
branches;
next ;
desc
@@
1.1
log
@none@
text
@%META:TOPICINFO{author="SvenTissot" date="1033205760" format="1.0" version="1.1"}%
1
2
-- Tissot.SvenTissot - 28 Oct 2002
@
I think the problem is in line 447 in
RcsLite.pm sub
addRevision which states
$date = time() if( ! $date );
${$self->{"date"}}[$head] = TWiki::Store::RcsFile::_epochToRcsDateTime( $date );
if the var date is set it is a formated date which is the wrong format for TWiki::Store::RcsFile::_epochToRcsDateTime( $date ) .
I patched my
RcsLite.pm to
$date = time() ; # if( ! $date );
${$self->{"date"}}[$head] = TWiki::Store::RcsFile::_epochToRcsDateTime( $date );
and this patch seems to work.
oops, it works only partially: on my WebChanges page
http://www.tissot.de/cgi-local/view/Tissot/WebChanges
the new topic
TestSeite2 which has been created with this patch active has the date September not October - looks like some code does not evaluate perl months starting with 0 ?
But where to go from here ?
I have to use RCSLite because my provider does not provide
RCS.
I finally patched also
RcsFile.pm:
# ======================
sub _epochToRcsDateTime
{
my( $dateTime ) = @_;
# TODO: should this be gmtime or local time?
my( $sec,$min,$hour,$mday,$mon,$year,$wday,$yday ) = gmtime( $dateTime );
$year += 1900 if( $year > 99 );
my $rcsDateTime = sprintf "%d.%02d.%02d.%02d.%02d.%02d", ( $year, $mon +1 , $mday, $hour, $min, $sec );
return $rcsDateTime;
}
and get now the correct listing, but I am not quite sure if this is really correctly patched ?
--
SvenTissot - 28 Oct 2002
I dont know if changing the two files as described above is the correct procedure to do, but I've got the same problem and after these corrections, my TWiki seems to work very well.
--
CleberAkira - 05 Feb 2003
I am trying to get to the bottom of this - but, I've found it difficult to find the exact problem. I've had some failures, but have yet to get a fix I'm happy with.
--
JohnTalintyre - 06 Feb 2003
I made the following fix to sub RCSLite::addRevision and the change Sven mentions above to fix the zero month problem.
# $date = time() if( ! $date );
# ${$self->{"date"}}[$head] = TWiki::Store::RcsFile::_epochToRcsDateTime( $date );
if( $date ) {
$date =~ s/ /./go;
$date =~ s/\//./go;
$date =~ s/:/./go;
} else {
$date = TWiki::Store::RcsFile::_epochToRcsDateTime(time());
}
${$self->{"date"}}[$head] = $date;
It appears that the date passed to the routine is OK on the rcs command line but not for internal format.
I'm not a Perl programmer but I strongly suspect you can accomplish in one line with $date what I did in many! :-P
--
JonLambert - 26 Apr 2003
Fix record
The changes of
SvenTissot and
JonLambert are now in
TWikiAlphaRelease. Changes:
*** ../../TWiki/Store/RcsFile.pm Wed Jan 29 22:13:06 2003
--- TWiki/Store/RcsFile.pm Sat Apr 26 20:33:34 2003
***************
*** 250,256 ****
# TODO: should this be gmtime or local time?
my( $sec,$min,$hour,$mday,$mon,$year,$wday,$yday ) = gmtime( $dateTime );
$year += 1900 if( $year > 99 );
! my $rcsDateTime = sprintf "%d.%02d.%02d.%02d.%02d.%02d", ( $year, $mon, $mday, $hour, $min, $sec );
return $rcsDateTime;
}
--- 250,256 ----
# TODO: should this be gmtime or local time?
my( $sec,$min,$hour,$mday,$mon,$year,$wday,$yday ) = gmtime( $dateTime );
$year += 1900 if( $year > 99 );
! my $rcsDateTime = sprintf "%d.%02d.%02d.%02d.%02d.%02d", ( $year, $mon + 1, $mday, $hour, $min, $sec );
return $rcsDateTime;
}
*** ../../TWiki/Store/RcsLite.pm Sat Jan 4 17:37:28 2003
--- TWiki/Store/RcsLite.pm Sat Apr 26 20:38:49 2003
***************
*** 444,451 ****
$self->{"head"} = $head;
${$self->{"log"}}[$head] = $log;
${$self->{"author"}}[$head] = $author;
! $date = time() if( ! $date );
! ${$self->{"date"}}[$head] = TWiki::Store::RcsFile::_epochToRcsDateTime( $date );
return $self->_writeMe();
}
--- 444,455 ----
$self->{"head"} = $head;
${$self->{"log"}}[$head] = $log;
${$self->{"author"}}[$head] = $author;
! if( $date ) {
! $date =~ s/[ \/\:]/\./go;
! } else {
! $date = TWiki::Store::RcsFile::_epochToRcsDateTime( time() );
! }
! ${$self->{"date"}}[$head] = $date;
return $self->_writeMe();
}
Could someone please test and let us know if it fixes all date problems with RcsLite?
--
PeterThoeny - 27 Apr 2003
Peter, though not related to date problems, in the same routine I get warnings in lower level functions relating to the $type parameter not being passed. Passing an empty string seems to fix it.
if( $head ) {
! my $delta = _diffText( \$text, \$self->delta($head), "" );
${$self->{"delta"}}[$head] = $delta;
}
And further off the subject, there are many warnings in logs as well...
For example: Ambiguous use of ${delta} resolved to $delta at ../lib/TWiki/Store/RcsLite.pm line 568.
while( $pos <= $#${delta} ) {
I'm on Cygwin using Perl 5.6
--
JonLambert - 27 Apr 2003
Thanks Jon,
TWikiAlphaRelease is updated accordingly. Let us know in case there are any issues.
--
PeterThoeny - 27 Apr 2003
I found that month errors still occured even after all of the above fixes.
I opened the TWiki.pm (v1.215) and found that +1 had been added to all months under
the sub formatGmTime
accept for if: $theFormat =~ /http|email/i
This is the line with mods: $weekDay[$wday], $mday, $isoMonth[$mon+1], $year,
Does this condition only occur when emailing is enabled?
Can anyone approve this?
--
ShaneNuessler - 13 May 2003
No, the line with
$isoMonth[$mon] is correct,
$mon of value
0 turns into the first entry in the array,
Jan.
Please verify if it works with new topics. Existing
,v files of topics that have been changed before the bug fix might be corrupt.
--
PeterThoeny - 13 May 2003
I got the problem too (didn't try to apply the fix) and I found that it appears only when you try to edit the page that is locked as "being edited" - locked to me or anyone else, it doesn't matter. So I updated the config file so that the pages were locked for 1 second after the edit and everything became OK (by the price of losing the page locking feature).
--
AntonMochalin - 02 Jun 2003
I applied the above fixes to RcsLite.pm and RcsFile.pm and the problem was fixed. I had to delete the BrokenPage.lock and BrokenPage.txt,v files for some topics.
--
LukeCloss - 06 Jun 2003
I had been trying to this out for some time and couldn't seem to get it right - thanks for all the attention above. Still at least I know people are getting benefit out of
RcsLite
--
JohnTalintyre - 06 Jun 2003
I've gone through and applied the above changes to TWiki.cfg and TWiki.pm and now I'm not getting any revisioning on an edited file. No matter how many times I edit a certain file, all I ever get is v1.1 -
no history. I have even moved the original ,v file out of the way as it is stated above that these archive files may have become corrupted before applying these patches. Still get only v1.1.
--
GreggLowrimore - 26 Jun 2003
Did you wait for one hour? TWiki does not bump the revision if the same person edits the same topic within a one hour window (or the time set in TWiki.cfg)
--
PeterThoeny - 01 Jul 2003
Hi, I have the problem
MonthOutOfRangeWithRcsLite and I did all the procedure below and didn't work, could someone explain me what changes I have to do?
I did those changes and didn't work: I applied the above changes to TWiki.cfg and TWiki.pm and later and fixed the files TWiki/Store/RcsLite.pm and TWiki/Store/RcsFile.pm.
--
RosaMora - 04 Jul 2003
I can't regenerate the problem above, I think the patch above (now in CVS) was correct. The reason I didn't see the error earlier was I had my edit lock time set to 1.
Rosa, if you are still having problem I suggest you add the following debug lines to
RcsLite.pm
# ======================
sub addRevision
{
my( $self, $text, $log, $author, $date ) = @_;
_trace( "::addRevision date=\"$date\"" );
... cut code ...
if( $date ) {
$date =~ s/[ \/\:]/\./go;
} else {
$date = TWiki::Store::RcsFile::_epochToRcsDateTime( time() );
}
_trace("::addRevision date now=\"$date\"" );
${$self->{"date"}}[$head] = $date;
return $self->_writeMe();
}
Make sure you uncomment the two lines in _trace at the top of
RcsLite. The debug output will appear in
debug.txt which is usually in your
data directory. Please post the result, I'm sure that will quickly lead to a fix.
--
JohnTalintyre - 09 Jul 2003
Hi... I copied the newest available version of RcsLite.pm (Rev. 1.8, which seems to be 2 months and 1 week old) and RcsFile.pm (Rev. 1.11, 2 months 3 weeks old) from
TWiki CVS over my old version (not sure how it was). It seems to be working very well right now. I will keep testing and post if I see anything wrong with that.
Let's close this issue

?
--
AndreDantas - 18 Jul 2003
I'm butting in quite late, but I have just pulled my hair out debugging this yesterday (without realising about this note). My fix was to change line 608 in Store.pm which is the
SaveNow function in the "repRev" IF block - something like:
$topicHandler->replaceRevision(..,..,.., $epochSec) # This used to use $date
The motivation was that since the
RCS stuff to checkin used epochsec style formats then just changing this line means that we now use epochSec format everywhere (at least as far as I can see).
Works fine here (Apache 2, Perl 5.8 on Win32)
Oh by the way, I'm using the Feb 2003 release not the Beta for what it's worth
--
EdWildgoose - 30 Jul 2003
Question:
I've edited my
RcsLite.pm and
RcsFile.pm files as I believe this forum suggests. ( I tried just using the new versions of
RcsLite and
RcsFile, but that caused an
RcsWrap error.
PeterTheony informed me that you can't replace older files with new ones. The interfaces are different. You have to edit the old files, which I have now done ). So..., my site is at least back up and "working".
However, I still don't have revisioning. If I edit a page and save it, the changes are displayed, but if I go back to edit it again, my pervious changes are lost.
I've edited TWiki.cfg to use
RcsLite ( comment out $storeTopicImpl = "RcsWrap"; and uncomment $storeTopicImpl = "RcsLite"; ). Is this correct? Is this all I need to change? What do I need to change ( if anything ) in TWiki.pm?
I've read this entire topic several times, and I guess I'm just dense or something. I don't see any explicit instructions regarding these two files.
I believe I've made the changes to
RcsLite.pm and
RcsFile.pm suggested somewhere above, but I guess I'm not used to the ! syntax. I'm assuming that those are the lines to be changed.
Hope someone can help me.
Regards,
--
ChrisVogel
Chris - can you come to
TWikiIRC sometime?
otherwise, it sound like you have done the right thing, so we'll need more info

(mmm, almost everything you have - start with attaching the files you have patched)
--
SD