Skip Menu |

This queue is for tickets about the File-Rsync CPAN distribution.

Report information
The Basics
Id: 11063
Status: resolved
Priority: 0/
Queue: File-Rsync

People
Owner: LEAKIN [...] cpan.org
Requestors: harlan [...] artselect.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.35
Fixed in: 0.36



Subject: Remove "uninitialized value" warning wrt buffer tails.
The $tail variable is only set if there is a short read, but then $str->{buffer_tail} is set to $tail unconditionally later. This results in the possibility (and in our case the actuality) of $str->{buffer_tail} being undefined, resulting in "Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/File/Rsync.pm line 575." (This is pasted from when I ran with version 0.34 of File::Rsync; the patch is against 0.35.) My patch simply initializes $tail to ''. You could equally leave $tail undefined and change: $str->{buffer_tail} = $tail; to: $str->{buffer_tail} = $tail if defined $tail; Debian Linux (Sarge), with stock (0.34) and self-compiled (0.35) File::Rsync on i386. Perl 5.8.4. HTH.
--- Rsync.pm.orig 2005-01-18 16:46:04.000000000 -0600 +++ Rsync.pm 2005-01-18 16:46:24.000000000 -0600 @@ -548,7 +548,7 @@ if ( $fd->sysread($buffer, $str->{block_size}) ) { ${$str->{data}} .= $buffer; if ( $str->{handler} ) { - my $tail; + my $tail = ''; $tail = $1 if $buffer =~ s/([^\n]+)\z//s; foreach my $line ( split /^/m, $str->{buffer_tail}.$buffer ) { &{$str->{handler}}($line, $str->{name});
Date: Tue, 18 Jan 2005 17:17:35 -0600
From: Lee Eakin <Leakin [...] dfw.Nostrum.com>
To: Guest via RT <bug-File-Rsync [...] rt.cpan.org>
Subject: Re: [cpan #11063] Remove "uninitialized value" warning wrt buffer tails.
RT-Send-Cc:
Thanks for the error report and suggested fix. I've just uploaded 0.36 to cpan.org with the fix included (no other changes at this time). -Lee Show quoted text
> Date: Tue, 18 Jan 2005 18:00:21 -0500 (EST) > From: Guest via RT <bug-File-Rsync@rt.cpan.org> > To: undisclosed-recipients: ; > Subject: [cpan #11063] Remove "uninitialized value" warning wrt buffer tails. > Reply-To: bug-File-Rsync@rt.cpan.org > X-RT-Loop-Prevention: cpan > RT-Ticket: cpan #11063 > Managed-by: RT 2.0.15 (http://bestpractical.com/rt/) > RT-Originator: > > > This message about File-Rsync was sent to you by guest <> via rt.cpan.org > > Full context and any attached attachments can be found at: > <URL: https://rt.cpan.org/Ticket/Display.html?id=11063 > > > The $tail variable is only set if there is a short read, but then $str->{buffer_tail} is set to $tail unconditionally later. This results in the possibility (and in our case the actuality) of $str->{buffer_tail} being undefined, resulting in "Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/File/Rsync.pm line 575." (This is pasted from when I ran with version 0.34 of File::Rsync; the patch is against 0.35.) > > My patch simply initializes $tail to ''. You could equally leave $tail undefined and change: > > $str->{buffer_tail} = $tail; > > to: > > $str->{buffer_tail} = $tail if defined $tail; > > Debian Linux (Sarge), with stock (0.34) and self-compiled (0.35) File::Rsync on i386. Perl 5.8.4. > > HTH.
-- Lee Eakin - leakin@dfw.nostrum.com Law of Selective Gravity: An object will fall so as to do the most damage.