Received: (at submit) by bugs.debian.org; 8 Sep 1999 17:57:07 +0000 Received: (qmail 12140 invoked from network); 8 Sep 1999 17:57:06 -0000 Received: from magic.magic.metawire.com (HELO magic.merlins.org) (root@204.80.113.97) by master.debian.org with SMTP; 8 Sep 1999 17:57:06 -0000 Received: (from merlin@localhost) by magic.merlins.org (8.9.3/8.9.3) id KAA12430 for submit@bugs.debian.org; Wed, 8 Sep 1999 10:57:01 -0700 Date: Wed, 8 Sep 1999 10:57:01 -0700 From: Marc Merlin To: submit@bugs.debian.org Subject: Mirror does not return a failure error code if server goes away Message-ID: <19990908105701.D11608@marc.merlins.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.6i X-Sysadmin: BOFH X-URL: http://marc.merlins.org/ X-Operating-System: Proudly running Linux 2.2.7-1.18/Debian potato Package: mirror Version: 2.9-4 Yet another bug in mirror that I found with my debugging/informational patch that was part of my first report. Before: ---------------------------------------------------------------------------- Got contrib/libc6/SRPMS/le-1.5.2-1.src.rpm 308060 45 Failed to get contrib/libc6/SRPMS/klyx-0.9.9-2.src.rpm: remote server gone away Failed to get file remote server gone away Fatal error talking to site, skipping rest of transfers Mirror redhat:redhat.ftp (pid 8311) ended with status: 0 ---------------------------------------------------------------------------- After: ---------------------------------------------------------------------------- Got 6.0/i386/XFree86-I128-3.3.5-0.6.0.i386.rpm 944170 84 Failed to get 6.0/i386/XFree86-3.3.5-0.6.0.i386.rpm: remote server gone away Failed to get file remote server gone away Mirror redhat:redhat.updates (pid 16598) ended with status: 256 ---------------------------------------------------------------------------- Patch for this bug: ---------------------------------------------------------------------------- --- mirror.debian Tue Aug 24 19:18:23 1999 +++ mirror Tue Sep 7 15:53:38 1999 @@ -1377,9 +1377,10 @@ } &make_dirs(); - &do_all_transfers(); - - $exit_status = $exit_ok; # Everything went ok. + if (&do_all_transfers() != -1) + { + $exit_status = $exit_ok; # Everything went ok. + } if( $get_file ){ # I must have finished with the remote information @@ -2685,7 +2686,7 @@ if( $ftp'fatalerror || $timeouts > $max_timeouts ){ &msg( $log, "Fatal error talking to site, skipping rest of transfers\n" ); &disconnect(); - return; + return -1; } next; } ---------------------------------------------------------------------------- Full patch including my previous bug report on mirror (bug 44020): ---------------------------------------------------------------------------- --- mirror.debian Tue Aug 24 19:18:23 1999 +++ mirror Tue Sep 7 15:53:38 1999 @@ -731,7 +731,7 @@ $value{ 'get_patt' } = pop( @get_patt ); $value{ 'local_dir' } = '.'; $value{ 'remote_user' } = 'anonymous'; - $exit_status = &do_mirror(); + &do_mirror(); } return; } @@ -740,7 +740,7 @@ if( $command_line{ 'interactive' } ){ # No config file to read $value{ 'package' } = 'interactive'; - $exit_status = &do_mirror(); + &do_mirror(); return; } @@ -760,7 +760,7 @@ # Is this a new package? if( $value{ 'package' } && $key eq 'package' ){ # mirror the existing package - $exit_status = &do_mirror(); + &do_mirror(); # reset &set_defaults(); @@ -786,7 +786,7 @@ # Mirror the last package in the file if( $value{ 'package' } ){ - $exit_status = &do_mirror(); + &do_mirror(); } } @@ -994,7 +994,7 @@ $skip_till = $limit_packages = 0; } - local( $exit_status ) = $exit_fail_noconnect; # Presume the worse. + $exit_status = $exit_fail_noconnect; # Presume the worse. $timeouts = 0; # set things from the command line arguments @@ -1377,9 +1377,10 @@ } &make_dirs(); - &do_all_transfers(); - - $exit_status = $exit_ok; # Everything went ok. + if (&do_all_transfers() != -1) + { + $exit_status = $exit_ok; # Everything went ok. + } if( $get_file ){ # I must have finished with the remote information @@ -2685,7 +2686,7 @@ if( $ftp'fatalerror || $timeouts > $max_timeouts ){ &msg( $log, "Fatal error talking to site, skipping rest of transfers\n" ); &disconnect(); - return; + return -1; } next; } @@ -3860,14 +3861,14 @@ { $sigs ++; if( $sigs > $max_sigs ){ - exit( 0 ); + exit( 127 ); } local( $sig ) = @_; local( $msg ) = "Caught a SIG$sig shutting down"; local( $package, $filename, $line ) = caller; warn "$package:$filename:$line $msg"; - exit( 0 ); + exit( 127 ); } sub trap_signals ---------------------------------------------------------------------------- Cheers, Marc -- Microsoft is to software what McDonalds is to gourmet cooking Home page: http://marc.merlins.org/ (friendly to non IE browsers) Finger marc_f@merlins.org for PGP key and other contact information