Bug: RcsLite generates lots of unitialized value errors
I just installed the latest TWiki on my machine and it seems to be working just fine. However when I looked at the Apache error log file I saw lots & lots of error messages being reported. Mostly
Use of uninitialized value in concatenation (.) or string, all occurring in
RcsLite.pm (e.g. at the beginning of
_write, in the call to
join in
_patchN & elsewhere). Looking further I noticed several apparent problems:
- The new routine does not initialize values for many of the fields.
- The addRevision routine has a call to _trace passing it the (newly added?) calling parameter date, but the routines that call addRevision do not provide a value for date.
- the TWiki debug.txt file is full of identical messages giving the version of Diff.pm
Initializing the various fields in
new & commenting out the call to _trace & writeDebug seem to fix everything---at least no more unitialized value error messages. Patch given below.
Test case
Configure a TWiki to use
RcsLite and create a new page or any other activity that exercises
RCS and then look at the Apache error log file.
Patch
*** twiki/lib/TWiki/Store/RcsLite.pm.old Fri May 28 23:51:35 2004
--- twiki/lib/TWiki/Store/RcsLite.pm Thu Dec 30 15:43:51 2004
***************
*** 50,56 ****
use FileHandle;
use TWiki;
! TWiki::writeDebug("Diff version $Algorithm::Diff::VERSION\n");
my $DIFF_DEBUG = 0;
my $DIFFEND_DEBUG = 0;
--- 50,56 ----
use FileHandle;
use TWiki;
! #TWiki::writeDebug("Diff version $Algorithm::Diff::VERSION\n");
my $DIFF_DEBUG = 0;
my $DIFFEND_DEBUG = 0;
***************
*** 72,77 ****
--- 72,83 ----
bless( $self, $class );
$self->_init();
$self->{head} = 0;
+ $self->{access} = "";
+ $self->{comment} = "";
+ $self->{symbols} = "";
+ $self->{description} = "";
+ $self->{delta} = ();
+ $self->{log} = ();
return $self;
}
***************
*** 579,585 ****
sub addRevision
{
my( $self, $text, $log, $author, $date ) = @_;
! _trace( "::addRevision date=\"$date\"" );
$self->_ensureProcessed();
$self->_save( $self->file(), \$text );
--- 585,591 ----
sub addRevision
{
my( $self, $text, $log, $author, $date ) = @_;
! # _trace( "::addRevision date=\"$date\"" );
$self->_ensureProcessed();
$self->_save( $self->file(), \$text );
Environment
--
RonGoldman - 31 Dec 2004
Follow up
Fix record