Hello community,

here is the log from the commit of package AppStream for openSUSE:Factory 
checked in at 2020-11-19 11:49:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/AppStream (Old)
 and      /work/SRC/openSUSE:Factory/.AppStream.new.5913 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "AppStream"

Thu Nov 19 11:49:23 2020 rev:19 rq:848417 version:0.12.11

Changes:
--------
--- /work/SRC/openSUSE:Factory/AppStream/AppStream.changes      2020-07-06 
16:18:39.905202716 +0200
+++ /work/SRC/openSUSE:Factory/.AppStream.new.5913/AppStream.changes    
2020-11-23 10:20:42.536699579 +0100
@@ -1,0 +2,6 @@
+Thu Nov 12 08:39:54 UTC 2020 - Fabian Vogt <[email protected]>
+
+- Add patch to avoid FD leak:
+  * 0001-Set-FD_CLOEXEC-on-the-LMDB-FD-manually.patch
+
+-------------------------------------------------------------------

New:
----
  0001-Set-FD_CLOEXEC-on-the-LMDB-FD-manually.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ AppStream.spec ++++++
--- /var/tmp/diff_new_pack.TTMvAN/_old  2020-11-23 10:20:43.088700232 +0100
+++ /var/tmp/diff_new_pack.TTMvAN/_new  2020-11-23 10:20:43.092700236 +0100
@@ -30,6 +30,8 @@
 Source2:        %{name}.keyring
 # PATCH-FIX-UPSTREAM
 Patch1:         properly-escape-markup.patch
+# https://github.com/ximion/appstream/pull/287
+Patch2:         0001-Set-FD_CLOEXEC-on-the-LMDB-FD-manually.patch
 # PATCH-FIX-OPENSUSE
 Patch100:       fix-build-gcc7.patch
 BuildRequires:  docbook-xsl-stylesheets

++++++ 0001-Set-FD_CLOEXEC-on-the-LMDB-FD-manually.patch ++++++
From 7e4b99464fc9463082465f4ccdae5d69ff001682 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <[email protected]>
Date: Thu, 12 Nov 2020 09:29:55 +0100
Subject: [PATCH] Set FD_CLOEXEC on the LMDB FD manually

Currently the FD referring to the appstreacm-cache-FOO.mdb is leaked into
child processes. The only way to fix is in a race-free way is by passing
O_CLOEXEC when opening it inside LMDB, but that's currently not done.
---
 src/as-cache.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/as-cache.c b/src/as-cache.c
index 831d94a9..777b40bb 100644
--- a/src/as-cache.c
+++ b/src/as-cache.c
@@ -35,6 +35,8 @@
 
 #include <lmdb.h>
 #include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
 #include <glib/gstdio.h>
 
 #include "as-utils-private.h"
@@ -723,6 +725,7 @@ as_cache_open (AsCache *cache, const gchar *fname, const 
gchar *locale, GError *
        gboolean nosync;
        gboolean readonly;
        g_autoptr(GMutexLocker) locker = NULL;
+       int db_fd, db_fd_flags = -1;
 
        /* close cache in case it was open */
        as_cache_close (cache);
@@ -829,6 +832,16 @@ as_cache_open (AsCache *cache, const gchar *fname, const 
gchar *locale, GError *
                goto fail;
        }
 
+       /* set FD_CLOEXEC manually. LMDB should do that, but it doesn't:
+          https://www.openldap.org/lists/openldap-bugs/201702/msg00003.html */
+       rc = mdb_env_get_fd (priv->db_env, &db_fd);
+       if (rc == MDB_SUCCESS) {
+               db_fd_flags = fcntl (db_fd, F_GETFD);
+       }
+       if (db_fd_flags != -1) {
+               fcntl (db_fd, F_SETFD, db_fd_flags | FD_CLOEXEC);
+       }
+
        /* unlink the file, so it gets removed as soon as we don't need it 
anymore */
        if (priv->volatile_db_fname != NULL)
                g_unlink (priv->volatile_db_fname);
-- 
2.20.1
_______________________________________________
openSUSE Commits mailing list -- [email protected]
To unsubscribe, email [email protected]
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/[email protected]

Reply via email to