Bug#748922: python-apt: TagFile doesnt close file
Package: python-apt
Version: 0.9.3.5
Severity: normal
Consider the following snippet:
--%<---------------------------------------------------
import gc
import os
import sys
import apt_pkg
print os.listdir("/proc/self/fd/")
f = apt_pkg.TagFile(sys.argv[1])
print os.listdir("/proc/self/fd/")
del f
print os.listdir("/proc/self/fd/")
gc.collect
print os.listdir("/proc/self/fd/")
-->%---------------------------------------------------
calling apt_pkg.TagFile() opens a file descriptor but that descriptor is
not closed when the object gets deleted or even garbage collection is
explicitly run. Here the output:
['0', '1', '2', '3']
['0', '1', '2', '3', '4']
['0', '1', '2', '3', '4']
['0', '1', '2', '3', '4']
The opened fd should be closed when the python object is destroyed.
cheers, josch
-- System Information:
Debian Release: jessie/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.11-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages python-apt depends on:
ii libapt-inst1.5 1.0.1
ii libapt-pkg4.12 1.0.1
ii libc6 2.18-4
ii libgcc1 1:4.8.2-16
ii libstdc++6 4.8.2-16
ii python 2.7.5-5
ii python-apt-common 0.9.3.5
Versions of packages python-apt recommends:
ii iso-codes 3.52-1
ii lsb-release 4.1+Debian12
ii xz-utils 5.1.1alpha+20120614-2
Versions of packages python-apt suggests:
pn python-apt-dbg <none>
pn python-apt-doc <none>
ii python-gtk2 2.24.0-3+b1
pn python-vte <none>
-- debconf-show failed
-- debsums errors found:
sh: 1: /usr/sbin/dpkg-divert: not found
Reply to: