BackupPC-users

Re: [BackupPC-users] jLib bug with md5sum stuff

2010-12-07 13:43:45
Subject: Re: [BackupPC-users] jLib bug with md5sum stuff
From: "Jeffrey J. Kosowsky" <backuppc AT kosowsky DOT org>
To: "General list for user discussion, questions and support" <backuppc-users AT lists.sourceforge DOT net>
Date: Tue, 07 Dec 2010 13:41:57 -0500
Jeffrey J. Kosowsky wrote at about 13:34:19 -0500 on Tuesday, December 7, 2010:
 > Robin Lee Powell wrote at about 21:48:17 -0800 on Monday, December 6, 2010:
 >  > On Mon, Dec 06, 2010 at 12:32:01PM -0800, Robin Lee Powell wrote:
 >  > > 
 >  > > substr outside of string at /usr/local/lib64/BackupPC/jLib.pm line 162.
 >  > > Use of uninitialized value in concatenation (.) or string at 
 > /usr/local/lib64/BackupPC/jLib.pm line 162.
 >  > > 
 >  > > The line(s) in question:
 >  > > 
 >  > >             $datalast = substr($data[($i-1)%2], $rsize, _128KB-$rsize)
 >  > >                         . substr($data[$i%2], 0 ,$rsize);
 >  > > 
 >  > > in zFile2MD5
 >  > > 
 >  > > I have no idea how that could happen.  -_-  Will help debug any way
 >  > > requested.
 >  > 
 >  > Had to figure it out sooner rather than later.  :)
 >  > 
 >  > It happens when a file is > 128KiB but < 256KiB, so only one buffer
 >  > is full.  Fix:
 >  > 
 >  > --- /tmp/jLib.pm        2010-12-07 05:47:42.086646699 +0000
 >  > +++ /usr/local/lib64/BackupPC/jLib.pm   2010-12-07 05:46:55.108231972 
 > +0000
 >  > @@ -159,8 +159,8 @@
 >  >                 while ( ($rsize = $fh->read(\$data[(++$i)%2], _128KB)) == 
 > _128KB
 >  >                         &&  ($totsize += $rsize) < _1MB) {}
 >  >                 $totsize +=$rsize if $rsize < _128KB; # Add back in 
 > partial read
 >  > -           $datalast = ( $data[($i-1)%2] ? substr($data[($i-1)%2], 
 > $rsize, _128KB-$rsize) : '' )
 >  > -                       . ( $data[$i%2] ? substr($data[$i%2], 0 ,$rsize) 
 > : '' );
 >  > +           $datalast = substr($data[($i-1)%2], $rsize, _128KB-$rsize)
 >  > +                       . substr($data[$i%2], 0 ,$rsize);
 >  >      }
 >  >      $filesize = $totsize if $totsize < _1MB; #Already know the size 
 > because read it all
 >  >      if ($filesize == 0) { # Try to find size from attrib file
 >  > 
 > 
 > OK I was confused for a second there since usually the convention is
 > to use '---' as the original code and '+++' as the new code...
 > 
 > Well actually, I had found and fixed that bug a *long* time ago (Dec
 > 2009) or earlier but the new version was not updated on the Wiki.
 > 
 > Actually, my correction is IMO simpler and less kludgey. Here it is
 > and my apologies for not updating it earlier
 > Hmmmm if per convention the '---' is the original code, then I don't
 > remember writing the code that way (it looks rather klugey so if I did
 > my apologies). The '+++' code which by convention is the mod seems
 > wrong for exactly the reason you mention.
 > 
 >          $datalast = ($i > 1 ? 
 >                                       substr($data[($i-1)%2], $rsize, 
 > _128KB-$rsize) : '')
 >                      . substr($data[$i%2], 0 ,$rsize); #Last 128KB (up to 
 > 1MB)
 > 
 > In fact, the "$i>1" is precisely there to make sure that it is done
 > correctly when only one buffer is full (it concatenates it with '').
 > 

I uploaded the latest (Dec 2009) version of jLib.pm to the Wiki:
https://sourceforge.net/apps/mediawiki/backuppc/index.php?title=BackupPC_DeleteFile

------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

<Prev in Thread] Current Thread [Next in Thread>