[devscripts] 03/03: rc-alert: Clarify the error when curl/wget dies

James McCoy jamessan at debian.org
Fri Sep 8 04:17:21 UTC 2017


This is an automated email from the git hooks/post-receive script.

jamessan pushed a commit to branch master
in repository devscripts.

commit 135249b2717fb2204f15a71cf447af6ac57036c2
Author: James McCoy <jamessan at debian.org>
Date:   Thu Sep 7 23:58:26 2017 -0400

    rc-alert: Clarify the error when curl/wget dies
    
    Signed-off-by: James McCoy <jamessan at debian.org>
---
 debian/changelog    | 2 ++
 scripts/rc-alert.pl | 9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index bcc2bc9..21d16a9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -44,6 +44,8 @@ devscripts (2.17.10) UNRELEASED; urgency=medium
   * debsign:
     + Use --with-colons in bash completion to fix key completion with gpg2.
       (Closes: #837380)
+  * rc-alert:
+    + Clarify the error when curl/wget dies.  (Closes: #820426)
 
   [ Daniel Shahaf ]
   * bts:
diff --git a/scripts/rc-alert.pl b/scripts/rc-alert.pl
index 331bddd..72a488a 100755
--- a/scripts/rc-alert.pl
+++ b/scripts/rc-alert.pl
@@ -184,6 +184,7 @@ if (! -d $cachedir) {
     }
 }
 
+my $usingcache = 0;
 if (-d $cachedir) {
     chdir $cachedir or die "$progname: can't cd $cachedir: $!\n";
 
@@ -201,6 +202,7 @@ if (-d $cachedir) {
 	die "$progname: Unknown download program $curl_or_wget!\n";
     }
     open BUGS, $cachefile or die "$progname: could not read $cachefile: $!\n";
+    $usingcache = 1;
 }
 else {
     open BUGS, "$getcommand $url |" or
@@ -291,7 +293,12 @@ foreach my $stanza (@stanzas) {
 }
 for (sort {$a <=> $b } keys %pkg_store) { print $pkg_store{$_}; }
 
-close BUGS or die "$progname: could not close $cachefile: $!\n";
+if ($usingcache) {
+  close BUGS or die "$progname: could not close $cachefile: $!\n";
+} else {
+  close BUGS or die $! ? "$progname: could not close $curl_or_wget pipe: $!\n"
+		       : "$progname: exit status from $curl_or_wget: $?\n";
+}
 
 exit 0;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list