Package: debmirror
Version: 20041209
Severity: normal
Tags: patch

If you unlink the meta files too early they will get downloaded on every
run. This is no problem with Release* since they are only a few bytes
and Packages* and Sources* are checked by other means first. But if you
specify --getcontents the Contents-*.gz files are downloaded even if
they had not changed. Since they only change every few days and are
several MB in size this is a serious issue. Patch attached.

    Ingo

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.4.28-pinguin20041118
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)

Versions of packages debmirror depends on:
ii  bzip2                         1.0.2-2    high-quality block-sorting file co
ii  libcompress-zlib-perl         1.33-3     Perl module for creation and manip
ii  liblockfile-simple-perl       0.2.5-4    Simple advisory file locking
ii  libwww-perl                   5.803-3    WWW client/server library for Perl
ii  perl [libdigest-md5-perl]     5.8.4-5    Larry Wall's Practical Extraction 
ii  perl-modules [libnet-perl]    5.8.4-5    Core Perl modules
ii  rsync                         2.6.3-2    fast remote file copy program (lik

-- no debconf information
--- debmirror.old       2004-12-16 17:45:31 +0100
+++ debmirror   2005-01-10 20:55:55 +0100
@@ -974,7 +974,6 @@ sub remote_get {
  METHOD: {
     $_ = $download_method;
     /^hftp$/ && do {
-      unlink($file) if (-f $file);
       $res=hftp_get($file);
       $res=$res && check_lists($file);
       if (!$res) {
@@ -984,7 +983,6 @@ sub remote_get {
     };
 
     /^http$/ && do {
-      unlink($file) if (-f $file);
       $res=http_get($file);
       $res=$res && check_lists($file);
       if (!$res) {
@@ -994,7 +992,6 @@ sub remote_get {
     };
 
     /^ftp$/ && do {
-      unlink($file) if (-f $file);
       $res=ftp_get($file);
       $res=$res && check_lists($file);
       if (!$res) {
@@ -1030,6 +1027,7 @@ sub hftp_get {
     print "Getting: $file... ";
   }
   if (! $dry_run) {
+    unlink($file) if (-f $file);
     $ret = $ua->mirror($url, $file);
     print $ret->status_line . "\n" if ($debug);
     if ($ret->is_error) {
@@ -1060,6 +1058,7 @@ sub http_get {
     print "Getting: $file... ";
   }
   if (! $dry_run) {
+    unlink($file) if (-f $file);
     $ret = $ua->mirror($url, $file);
     print $ret->status_line . "\n" if ($debug);
     if ($ret->is_error) {
@@ -1107,6 +1106,7 @@ sub ftp_get {
   }
   my $ret=1;
   if (! $dry_run) {
+    unlink($file) if (-f $file);
     $ret = $ftp->get($file, $file);
     if ($ret) {
       my $mtime=$ftp->mdtm($file);

Reply via email to