From: Martin Langhoff Date: Tue, 23 May 2006 20:29:07 GMT Subject: Re: [PATCH 2/2] cvsimport: cleanup commit function Message-ID: <46a038f90605231329w35d10cfdg1ac413ebf8d32e11@mail.gmail.com> In-Reply-To: On 5/24/06, Linus Torvalds wrote: > Martin, that problem seems to go away when I initialize $res to 0 in > _fetchfile. > > I don't know perl, and maybe local variables are pre-initialized to empty. > > It's entirely possible that the fact that it now seems to work for me is > purely timing-related, since I also ended up using "-P cvsps-output" to > avoid having a huge cvsps binary in memory at the same time. Strange! Cannot repro here with v5.8.8 (debian/etch 5.8.8-4) but initialising it doesn't hurt, so let's do it: diff --git a/git-cvsimport.perl b/git-cvsimport.perl index ace7087..abbfd0b 100755 --- a/git-cvsimport.perl +++ b/git-cvsimport.perl @@ -371,7 +371,7 @@ sub file { } sub _fetchfile { my ($self, $fh, $cnt) = @_; - my $res; + my $res = 0; my $bufsize = 1024 * 1024; while($cnt) { if ($bufsize > $cnt) { cheers, martin