[Qa-jenkins-scm] [jenkins.debian.net] 02/03: udd-query: remove the temporary file with a trap

Mattia Rizzolo mattia at debian.org
Mon Nov 6 14:06:30 UTC 2017


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

mattia pushed a commit to branch master
in repository jenkins.debian.net.

commit c45bf9c48100cb6ceb273fc474af52aa1f20721f
Author: Mattia Rizzolo <mattia at debian.org>
Date:   Mon Nov 6 14:42:19 2017 +0100

    udd-query: remove the temporary file with a trap
    
    in case this script is called with the wrong argument, and in case of
    failures, etc, the temporary file would be left around otherwise
    
    Signed-off-by: Mattia Rizzolo <mattia at debian.org>
---
 bin/udd-query.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/bin/udd-query.sh b/bin/udd-query.sh
index 0efb18e..fb62c8c 100755
--- a/bin/udd-query.sh
+++ b/bin/udd-query.sh
@@ -62,7 +62,6 @@ multiarch_versionskew() {
 		# TODO: show versions (per arch) too
 		done
 	fi
-	rm $UDD
 }
 
 orphaned_without_o_bug() {
@@ -95,13 +94,15 @@ orphaned_without_o_bug() {
 		done
 	fi
 
-	rm -f "$UDD" "$WNPPRM" "$SORTED_UDD"
+	rm -f "$WNPPRM" "$SORTED_UDD"
 }
 
 #
 # main
 #
 UDD=$(mktemp)
+function rmtmpfile { rm -f "$UDD"; }
+trap rmtmpfile exit
 case $1 in
 	orphaned_without_o_bug)
 			orphaned_without_o_bug

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list