Package: sbuild
Version: 0.65.0-1
Severity: minor
Tags: patch

sbuild-update creates two temporary files every run, but doesn't clean
them up:

$ ls /etc/sbuild/chroot/unstable-amd64-sbuild/tmp
$ sbuild-update -udrc unstable-amd64-sbuild
...
$ ls /etc/sbuild/chroot/unstable-amd64-sbuild/tmp
Akl89y9Pai  ghBrITSJSA

They are created in get_foreign_architectures
(lib/Sbuild/ResolverBase.pm). They attached patch fixes the issue and
also closes both file descriptors.

Cheers
-- 
Sebastian Ramacher
From 47cd10c32e3d87857ddd094bb6136fe0f636c9a7 Mon Sep 17 00:00:00 2001
From: Sebastian Ramacher <sramac...@debian.org>
Date: Sun, 11 Jan 2015 09:41:50 +0100
Subject: [PATCH] Close file descriptors and remove temporary files

Always close both file descriptors and remove the temporary files.
---
 lib/Sbuild/ResolverBase.pm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/Sbuild/ResolverBase.pm b/lib/Sbuild/ResolverBase.pm
index e957cc1..c2223c6 100644
--- a/lib/Sbuild/ResolverBase.pm
+++ b/lib/Sbuild/ResolverBase.pm
@@ -163,7 +163,10 @@ sub get_foreign_architectures {
                 $self->set('Multiarch Support', 0);
             }
         }
+        close $tmpfh;
         close $tmpfh2;
+        unlink $tmpfilename;
+        unlink $tmpfilename2;
         # quietly return nothing if dpkg is too old (for use on older chroots)
         if ($self->get('Multiarch Support'))
         {
@@ -180,6 +183,9 @@ sub get_foreign_architectures {
         push @existing_foreign_arches, $_;
     }
     close $tmpfh;
+    close $tmpfh2;
+    unlink $tmpfilename;
+    unlink $tmpfilename2;
     my %set;
     foreach (@existing_foreign_arches) { $set{$_} = 1; }
     return \%set;
-- 
2.1.4

Attachment: signature.asc
Description: Digital signature

Reply via email to