Merged update from upstream sources

This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/glib2.git#dfa01c8fbaa3810b32a17741ad2253fb060d9f73
This commit is contained in:
DistroBaker 2021-03-19 21:14:36 +00:00
parent 280ebdbe38
commit 71ab633e51
3 changed files with 17 additions and 200 deletions

View File

@ -1,194 +0,0 @@
From 1e74c52a6349c9c4f265b9b89fffc32730b9cd24 Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@endlessos.org>
Date: Fri, 19 Feb 2021 18:19:53 +0000
Subject: [PATCH 1/3] gsubprocesslauncher: Improve documentation formatting
slightly
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
---
gio/gsubprocesslauncher.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gio/gsubprocesslauncher.c b/gio/gsubprocesslauncher.c
index b7257f453..16c47d542 100644
--- a/gio/gsubprocesslauncher.c
+++ b/gio/gsubprocesslauncher.c
@@ -596,16 +596,16 @@ g_subprocess_launcher_take_stderr_fd (GSubprocessLauncher *self,
* @target_fd: Target descriptor for child process
*
* Transfer an arbitrary file descriptor from parent process to the
- * child. This function takes "ownership" of the fd; it will be closed
+ * child. This function takes ownership of the @source_fd; it will be closed
* in the parent when @self is freed.
*
* By default, all file descriptors from the parent will be closed.
- * This function allows you to create (for example) a custom pipe() or
- * socketpair() before launching the process, and choose the target
+ * This function allows you to create (for example) a custom `pipe()` or
+ * `socketpair()` before launching the process, and choose the target
* descriptor in the child.
*
* An example use case is GNUPG, which has a command line argument
- * --passphrase-fd providing a file descriptor number where it expects
+ * `--passphrase-fd` providing a file descriptor number where it expects
* the passphrase to be written.
*/
void
--
GitLab
From 55a75590d0c7e703f32513cc409d6e20a7b761ea Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@endlessos.org>
Date: Fri, 19 Feb 2021 18:20:25 +0000
Subject: [PATCH 2/3] =?UTF-8?q?gsubprocesslauncher:=20Don=E2=80=99t=20clos?=
=?UTF-8?q?e=20target=20FDs=20in=20close()=20method?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This is a regression introduced in commit 67a589e505311. Previously, the
source/target FD pairs were stored in `needdup_fd_assignments`, in
consecutive entries, so source FDs had even indices and target FDs had
odd indices.
I didnt notice that the array index was being incremented by 2 when
closing FDs, when porting from the old code. So previously the code was
only closing the source FDs; after the port, it was closing source and
target FDs.
Thats incorrect, as the target FDs are just integers in the parent
process. Its only in the child process where they are actually FDs —
and `g_subprocess_launcher_close()` is never called in the child
process.
This resulted in some strange misbehaviours in any process which used
`g_subprocess_launcher_take_fd()` with target FDs which could have
possibly aliased with other FDs in the parent process (and which werent
equal to their mapped source FDs).
Thanks to Olivier Fourdan for the detailed bug report.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Fixes: #2332
---
gio/gsubprocesslauncher-private.h | 4 ++--
gio/gsubprocesslauncher.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/gio/gsubprocesslauncher-private.h b/gio/gsubprocesslauncher-private.h
index f8a6516c5..d6fe0d784 100644
--- a/gio/gsubprocesslauncher-private.h
+++ b/gio/gsubprocesslauncher-private.h
@@ -42,8 +42,8 @@ struct _GSubprocessLauncher
gint stderr_fd;
gchar *stderr_path;
- GArray *source_fds;
- GArray *target_fds; /* always the same length as source_fds */
+ GArray *source_fds; /* GSubprocessLauncher has ownership of the FD elements */
+ GArray *target_fds; /* always the same length as source_fds; elements are just integers and not FDs in this process */
gboolean closed_fd;
GSpawnChildSetupFunc child_setup_func;
diff --git a/gio/gsubprocesslauncher.c b/gio/gsubprocesslauncher.c
index 16c47d542..a1c65e947 100644
--- a/gio/gsubprocesslauncher.c
+++ b/gio/gsubprocesslauncher.c
@@ -661,11 +661,11 @@ g_subprocess_launcher_close (GSubprocessLauncher *self)
g_assert (self->target_fds != NULL);
g_assert (self->source_fds->len == self->target_fds->len);
+ /* Note: Dont close the target_fds, as theyre only valid FDs in the
+ * child process. This code never executes in the child process. */
for (i = 0; i < self->source_fds->len; i++)
- {
- (void) close (g_array_index (self->source_fds, int, i));
- (void) close (g_array_index (self->target_fds, int, i));
- }
+ (void) close (g_array_index (self->source_fds, int, i));
+
g_clear_pointer (&self->source_fds, g_array_unref);
g_clear_pointer (&self->target_fds, g_array_unref);
}
--
GitLab
From 50cf90dc562d10efa3288357202e8cc04571292c Mon Sep 17 00:00:00 2001
From: Philip Withnall <pwithnall@endlessos.org>
Date: Fri, 19 Feb 2021 18:09:42 +0000
Subject: [PATCH 3/3] =?UTF-8?q?tests:=20Test=20g=5Fsubprocess=5Flauncher?=
=?UTF-8?q?=5Fclose()=20doesn=E2=80=99t=20close=20too=20many=20FDs?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Expand an existing unit test to check that the target FD of a
`g_subprocess_launcher_take_fd()` call doesnt get closed when
`g_subprocess_launcher_close()` is called. Only the source FD should be
closed by the parent process.
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
Helps: #2332
---
gio/tests/gsubprocess.c | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/gio/tests/gsubprocess.c b/gio/tests/gsubprocess.c
index 3c248e610..7e22678ec 100644
--- a/gio/tests/gsubprocess.c
+++ b/gio/tests/gsubprocess.c
@@ -1494,23 +1494,44 @@ test_subprocess_launcher_close (void)
GSubprocessLauncher *launcher;
GSubprocess *proc;
GPtrArray *args;
- int fd;
+ int fd, fd2;
gboolean is_open;
- fd = dup(0);
+ /* Open two arbitrary FDs. One of them, @fd, will be transferred to the
+ * launcher, and the others FD integer will be used as its target FD, giving
+ * the mapping `fd → fd2` if a child process were to be spawned.
+ *
+ * The launcher will then be closed, which should close @fd but *not* @fd2,
+ * as the value of @fd2 is only valid as an FD in a child process. (A child
+ * process is not actually spawned in this test.)
+ */
+ fd = dup (0);
+ fd2 = dup (0);
launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_NONE);
- g_subprocess_launcher_take_fd (launcher, fd, fd);
+ g_subprocess_launcher_take_fd (launcher, fd, fd2);
+
is_open = fcntl (fd, F_GETFD) != -1;
g_assert_true (is_open);
+ is_open = fcntl (fd2, F_GETFD) != -1;
+ g_assert_true (is_open);
+
g_subprocess_launcher_close (launcher);
+
is_open = fcntl (fd, F_GETFD) != -1;
g_assert_false (is_open);
+ is_open = fcntl (fd2, F_GETFD) != -1;
+ g_assert_true (is_open);
+
+ /* Now test that actually trying to spawn the child gives %G_IO_ERROR_CLOSED,
+ * as g_subprocess_launcher_close() has been called. */
args = get_test_subprocess_args ("cat", NULL);
proc = g_subprocess_launcher_spawnv (launcher, (const gchar * const *) args->pdata, error);
g_ptr_array_free (args, TRUE);
g_assert_null (proc);
g_assert_error (local_error, G_IO_ERROR, G_IO_ERROR_CLOSED);
g_clear_error (error);
+
+ close (fd2);
g_object_unref (launcher);
}
--
GitLab

View File

@ -1,5 +1,5 @@
Name: glib2
Version: 2.67.4
Version: 2.67.6
Release: 2%{?dist}
Summary: A library of handy utility functions
@ -21,10 +21,6 @@ Patch002: 0002-gdesktopappinfo-Move-launched-applications-into-tran.patch
Patch003: 0003-gdesktopappinfo-Handle-task-completion-from-spawn-fu.patch
Patch004: 0004-gdesktopappinfo-Add-SourcePath-to-transient-systemd-.patch
# Backported from upstream
# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1958
Patch5: 1958.patch
BuildRequires: chrpath
BuildRequires: gcc
BuildRequires: gcc-c++
@ -46,6 +42,7 @@ BuildRequires: pkgconfig(libelf)
BuildRequires: pkgconfig(libffi)
BuildRequires: pkgconfig(libpcre)
BuildRequires: pkgconfig(mount)
BuildRequires: pkgconfig(sysprof-capture-4)
BuildRequires: pkgconfig(zlib)
BuildRequires: python3-devel
@ -111,6 +108,8 @@ rm glib/pcre/*.[ch]
-Dman=true \
-Ddtrace=true \
-Dsystemtap=true \
-Dsysprof=enabled \
-Dglib_debug=disabled \
-Dgtk_doc=true \
-Dinstalled_tests=true \
%if 0%{?rhel}
@ -242,6 +241,18 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
%{_datadir}/installed-tests
%changelog
* Thu Mar 18 2021 Petr Pisar <ppisar@redhat.com> - 2.67.6-2
- Disable debugging glib (bug #1936339)
* Thu Mar 11 2021 Kalev Lember <klember@redhat.com> - 2.67.6-1
- Update to 2.67.6
* Tue Mar 02 2021 Kalev Lember <klember@redhat.com> - 2.67.5-1
- Update to 2.67.5
* Wed Feb 24 2021 Kalev Lember <klember@redhat.com> - 2.67.4-3
- Enable sysprof capture support
* Fri Feb 19 2021 Kalev Lember <klember@redhat.com> - 2.67.4-2
- Backport a fix for gsubprocesslauncher regression

View File

@ -1 +1 @@
SHA512 (glib-2.67.4.tar.xz) = 65e7de678716f1123e6b9c5bec2cdacf4405501b904f87ca2b6cebb4b23444a6577d108774dcd1ecc00558d0983a674ee72d915c7930457a2ab870a47a02fef5
SHA512 (glib-2.67.6.tar.xz) = df575e2ed1d18a44559ddb51db543fb58ba1f2b6ecee299317fb89ad8d6d96c7eed2c4493ce5a0a25c20d24d7cd1ffac264e429e1ba1e1457afb0d2d62662321