[Apt-listbugs-commits] [SCM] dpkg-ruby development branch, master, updated. debian/0.3.4-3-g17a9cc7

Ryan Niebur ryanryan52 at gmail.com
Sat Jan 9 12:44:20 UTC 2010


The following commit has been merged in the master branch:
commit 02f226f5378e77390d21757bca7a88b85c066508
Author: Ryan Niebur <ryanryan52 at gmail.com>
Date:   Fri Jan 8 17:47:31 2010 -0800

    fix some file leaks (Closes: #564117)

diff --git a/debian/changelog b/debian/changelog
index c0e613d..da29556 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+dpkg-ruby (0.3.5) UNRELEASED; urgency=low
+
+  * fix some file leaks (Closes: #564117)
+
+ -- Ryan Niebur <ryan at debian.org>  Fri, 08 Jan 2010 17:47:20 -0800
+
 dpkg-ruby (0.3.4) unstable; urgency=low
 
   * add myself to d/copyright, thanks to Barry deFreese
diff --git a/lib/debian.rb b/lib/debian.rb
index cbcf471..ced8a50 100644
--- a/lib/debian.rb
+++ b/lib/debian.rb
@@ -136,13 +136,17 @@ module Debian
 
     def load(debfile)
       info = ''
-      Debian::Ar.new(debfile).open('control.tar.gz') {|ctz|
+      ar = Debian::Ar.new(debfile)
+      ar.open('control.tar.gz') {|ctz|
 	Debian::Utils::gunzip(ctz) {|ct|
 	  Debian::Utils::tar(ct, Debian::Utils::TAR_EXTRACT, '*/control'){|fp|
 	    info = fp.readlines.join("")
+            fp.close
 	  }
+          ct.close
 	}
       }
+      ar.close
       deb = Deb.new(info)
       deb.filename = File.expand_path(debfile, Dir.getwd)
       deb.freeze
diff --git a/lib/debian/ar.rb b/lib/debian/ar.rb
index b8cdc94..b959731 100644
--- a/lib/debian/ar.rb
+++ b/lib/debian/ar.rb
@@ -112,7 +112,11 @@ module Debian
       end
       @ofs = []
     end
-    
+
+    def close
+      @fp.close
+    end
+
     def list
       @fp.seek(SARMAG, IO::SEEK_SET)
       while ! @fp.eof?
diff --git a/lib/debian/utils.rb b/lib/debian/utils.rb
index 62e3d7c..c9210ff 100644
--- a/lib/debian/utils.rb
+++ b/lib/debian/utils.rb
@@ -27,6 +27,7 @@ module Debian
     TAR_LIST = '-t'
     
     def Utils.pipeline(io,progs,stderr = false)
+      Signal.trap('CHLD', 'IGNORE')
       # wr0 -> rd0 [gunzip] wr -> rd
       rd,wr = IO.pipe
       rde,wre = IO.pipe
@@ -69,6 +70,7 @@ module Debian
 
     def gunzip(io)
       Utils.pipeline(io, [GUNZIP]) {|fp,fpe|
+        fpe.close
 	if block_given?
 	  return yield(fp)
 	else
@@ -95,6 +97,7 @@ module Debian
             exit
           end
         end
+        fpe.close
 	if block_given?
 	  return yield(fp)
 	else

-- 
dpkg-ruby development



More information about the Apt-listbugs-commits mailing list