Bug#270195: gnome-applets: patch to stop the fd leak

Tuukka Hastrup Tuukka Hastrup <Tuukka.Hastrup@iki.fi>, 270195@bugs.debian.org
Sun, 14 Nov 2004 16:49:33 +0200


This is a multi-part MIME message sent by reportbug.

--===============1318371368==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Package: gnome-applets
Version: 2.6.2.1-1tuukka
Tags: patch
Followup-For: Bug #270195

I bumped to the fd leak problem of battstat-applet in the Sarge version.
Luckily, the fix is a simple oneliner (patch attached).

The bug seems to have been there ever since the ACPI event socket code
was introduced in revision 1.8 in Gnome CVS (2003-10-22). I checked HEAD
and it's still there.

To check the problem, stop acpid. Watch the leak of sockets with:
$ pidof battstat-applet-2 | xargs --replace ls -l /proc/\{\}/fd


Thanks,
Tuukka Hastrup

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.8-1-686
Locale: LANG=fi_FI@euro, LC_CTYPE=fi_FI@euro

Versions of packages gnome-applets depends on:
ii  gnome-applets-data       2.6.2.1-1tuukka Various applets for GNOME 2 panel 
ii  gnome-panel              2.6.2-3         Launcher and docking facility for 
ii  gstreamer0.8-alsa [gstre 0.8.5-1         ALSA plugin for GStreamer
ii  gstreamer0.8-artsd [gstr 0.8.5-1         aRtsd plugin for GStreamer
ii  gstreamer0.8-esd [gstrea 0.8.5-1         Enlightened Sound Daemon plugin fo
ii  gstreamer0.8-jack [gstre 0.8.5-1         JACK plugin for GStreamer
ii  gstreamer0.8-oss [gstrea 0.8.5-1         OSS plugin for GStreamer
ii  libapm1                  3.2.2-2         Library for interacting with APM d
ii  libart-2.0-2             2.3.16-6        Library of functions for 2D graphi
ii  libatk1.0-0              1.6.1-5         The ATK accessibility toolkit
ii  libbonobo2-0             2.6.2-7         Bonobo CORBA interfaces library
ii  libbonoboui2-0           2.6.1-1         The Bonobo UI library
ii  libc6                    2.3.2.ds1-18    GNU C Library: Shared libraries an
ii  libgail-common           1.6.6b-1        GNOME Accessibility Implementation
ii  libgail17                1.6.6b-1        GNOME Accessibility Implementation
ii  libgconf2-4              2.6.4-2         GNOME configuration database syste
ii  libglade2-0              1:2.4.0-1       Library to load .glade files at ru
ii  libglib2.0-0             2.4.7-1         The GLib library of C routines
ii  libgnome2-0              2.6.1.2-2       The GNOME 2 library - runtime file
ii  libgnomecanvas2-0        2.6.1.1-2       A powerful object-oriented display
ii  libgnomeui-0             2.6.1.1cvs-1    The GNOME 2 libraries (User Interf
ii  libgnomevfs2-0           2.6.2-2         The GNOME virtual file-system libr
ii  libgstreamer-plugins0.8- 0.8.5-1         Various GStreamer libraries and li
ii  libgstreamer0.8-0        0.8.7-1         Core GStreamer libraries, plugins,
ii  libgtk2.0-0              2.4.13-1        The GTK+ graphical user interface 
ii  libgtop2-2               2.6.0-4         Libraries for gtop system monitori
ii  libice6                  4.3.0.dfsg.1-8  Inter-Client Exchange library
ii  liborbit2                1:2.10.2-1.1    libraries for ORBit2 - a CORBA ORB
ii  libpanel-applet2-0       2.6.2-3         Library for GNOME 2 Panel applets
ii  libpango1.0-0            1.4.1-4         Layout and rendering of internatio
ii  libpopt0                 1.7-5           lib for parsing cmdline parameters
ii  libsm6                   4.3.0.dfsg.1-8  X Window System Session Management
ii  libx11-6                 4.3.0.dfsg.1-8  X Window System protocol client li
ii  libxklavier8             1.03-1          X Keyboard Extension high-level AP
ii  libxml2                  2.6.11-5        GNOME XML library
ii  xlibs                    4.3.0.dfsg.1-8  X Window System client libraries m
ii  zlib1g                   1:1.2.2-1       compression library - runtime

-- no debconf information

--===============1318371368==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="gnome-applets.closefd.patch"

diff -ur gnome-applets-2.6.2.1.orig/battstat/acpi-linux.c gnome-applets-2.6.2.1/battstat/acpi-linux.c
--- gnome-applets-2.6.2.1.orig/battstat/acpi-linux.c	2004-01-04 18:50:21.000000000 +0200
+++ gnome-applets-2.6.2.1/battstat/acpi-linux.c	2004-11-14 15:58:31.000000000 +0200
@@ -268,7 +268,8 @@
       update_ac_info(acpiinfo);
       return TRUE;
     }
+    close(fd);
   }
 
   acpiinfo->event_fd = -1;

--===============1318371368==--