Bug#840378: jessie-pu: package openbox/3.5.2-8+deb8u1
Package: release.debian.org
Severity: normal
Tags: jessie
User: release.debian.org@packages.debian.org
Usertags: pu
Hi Stable release managers,
In e.g. environments with a huge amount of groups, openbox is
particularly affected by #808138, since openbox did enumerate multiple
time all groups at startup. This was fixed in the recent upload to
unstable and I would like to propose a fix as well for jessie (I know
a environment where using openbox due to a huge amount of groups on
the system, it is massively slowed down).
Attached is the debdiff. The upload has not yet entered testing,
though.
I have also X-Debbugs-CC Mateusz Å?ukasik.
Regards,
Salvatore
diff -Nru openbox-3.5.2/debian/changelog openbox-3.5.2/debian/changelog
--- openbox-3.5.2/debian/changelog 2014-10-25 14:39:18.000000000 +0200
+++ openbox-3.5.2/debian/changelog 2016-10-10 09:18:43.000000000 +0200
@@ -1,3 +1,12 @@
+openbox (3.5.2-8+deb8u1) jessie; urgency=medium
+
+ * Non-maintainer upload.
+ * Add 808138_Replace-getgrent-with-getgroups.patch patch.
+ Replace getgrent with getgroups for not enumerate all groups at startup.
+ Thanks to Simon <simondobbss@gmail.com> (Closes: #808138)
+
+ -- Salvatore Bonaccorso <carnil@debian.org> Mon, 10 Oct 2016 09:18:43 +0200
+
openbox (3.5.2-8) unstable; urgency=high
* debian/openbox.install:
diff -Nru openbox-3.5.2/debian/patches/808138_Replace-getgrent-with-getgroups.patch openbox-3.5.2/debian/patches/808138_Replace-getgrent-with-getgroups.patch
--- openbox-3.5.2/debian/patches/808138_Replace-getgrent-with-getgroups.patch 1970-01-01 01:00:00.000000000 +0100
+++ openbox-3.5.2/debian/patches/808138_Replace-getgrent-with-getgroups.patch 2016-10-10 09:18:43.000000000 +0200
@@ -0,0 +1,63 @@
+>From e0cb404f53c9b21a521ea2f14c8cd66fdfb68ea7 Mon Sep 17 00:00:00 2001
+From: Simon <simondobbss@gmail.com>
+Date: Tue, 15 Dec 2015 15:46:18 +0100
+Subject: [PATCH] Replace getgrent with getgroups. Fixes #5978.
+
+---
+ obt/paths.c | 34 +++++++++++++++++++++-------------
+ 1 file changed, 21 insertions(+), 13 deletions(-)
+
+diff --git a/obt/paths.c b/obt/paths.c
+index 25cb6b0..d526936 100644
+--- a/obt/paths.c
++++ b/obt/paths.c
+@@ -108,25 +108,33 @@ static void find_uid_gid(uid_t *u, gid_t **g, guint *n)
+ const gchar *name;
+ struct group *gr;
+
++ gid_t gmain;
++ unsigned int maininc;
++ int i;
++
+ *u = getuid();
+ pw = getpwuid(*u);
+ name = pw->pw_name;
+
+- *g = g_new(gid_t, *n=1);
+- (*g)[0] = getgid();
+-
+- while ((gr = getgrent())) {
+- if (gr->gr_gid != (*g)[0]) { /* skip the main group */
+- gchar **c;
+- for (c = gr->gr_mem; *c; ++c)
+- if (strcmp(*c, name) == 0) {
+- *g = g_renew(gid_t, *g, ++(*n)); /* save the group */
+- (*g)[*n-1] = gr->gr_gid;
+- break;
+- }
++ gmain = getgid();
++
++ *n = getgroups(0, *g);
++ *g = g_new(gid_t, *n);
++ *n = getgroups(*n, *g);
++
++ /* Check if the effective group ID of the calling process is already
++ included in the returned list. Add it otherwise. */
++ maininc = 0;
++ for (i = 0; i < *n; i++) {
++ if ( (*g)[i] == gmain ) {
++ maininc = 1;
++ break;
+ }
+ }
+- endgrent();
++ if (!maininc) {
++ *g = g_renew(gid_t, *g, ++(*n));
++ (*g)[*n-1] = gmain;
++ }
+
+ qsort(*g, *n, sizeof(gid_t), gid_cmp);
+ }
+--
+2.1.4
+
diff -Nru openbox-3.5.2/debian/patches/series openbox-3.5.2/debian/patches/series
--- openbox-3.5.2/debian/patches/series 2014-08-22 22:32:09.000000000 +0200
+++ openbox-3.5.2/debian/patches/series 2016-10-10 09:18:43.000000000 +0200
@@ -11,3 +11,4 @@
fix_rsvg_missing_include.patch
update_pl_po.patch
754207_use-scrot.patch
+808138_Replace-getgrent-with-getgroups.patch
Reply to: