From 6b172a9dd6203a9d29e8fdf24598218ddff03c74 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 26 2022 10:10:01 +0000 Subject: import glib2-2.56.4-160.el8 --- diff --git a/SOURCES/1134.patch b/SOURCES/1134.patch new file mode 100644 index 0000000..b1719e3 --- /dev/null +++ b/SOURCES/1134.patch @@ -0,0 +1,139 @@ +From 08f5ab3c3a1877e4a8965a9075bd7675f64eae53 Mon Sep 17 00:00:00 2001 +From: Philip Withnall +Date: Fri, 27 Sep 2019 14:46:18 +0100 +Subject: [PATCH 1/2] gfile: Factor out flags when copying files + +This introduces no functional changes; just reduces duplication in the +code a little. + +Signed-off-by: Philip Withnall +--- + gio/gfile.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/gio/gfile.c b/gio/gfile.c +index 29ebaaa62..a617b4cc8 100644 +--- a/gio/gfile.c ++++ b/gio/gfile.c +@@ -3184,6 +3184,7 @@ file_copy_fallback (GFile *source, + const char *target; + char *attrs_to_read; + gboolean do_set_attributes = FALSE; ++ GFileCreateFlags create_flags; + + /* need to know the file type */ + info = g_file_query_info (source, +@@ -3274,18 +3275,21 @@ file_copy_fallback (GFile *source, + * If a future API like g_file_replace_with_info() is added, switch + * this code to use that. + */ ++ create_flags = G_FILE_CREATE_PRIVATE; ++ if (flags & G_FILE_COPY_OVERWRITE) ++ create_flags |= G_FILE_CREATE_REPLACE_DESTINATION; ++ + if (G_IS_LOCAL_FILE (destination)) + { + if (flags & G_FILE_COPY_OVERWRITE) + out = (GOutputStream*)_g_local_file_output_stream_replace (_g_local_file_get_filename (G_LOCAL_FILE (destination)), + FALSE, NULL, + flags & G_FILE_COPY_BACKUP, +- G_FILE_CREATE_REPLACE_DESTINATION | +- G_FILE_CREATE_PRIVATE, info, ++ create_flags, info, + cancellable, error); + else + out = (GOutputStream*)_g_local_file_output_stream_create (_g_local_file_get_filename (G_LOCAL_FILE (destination)), +- FALSE, G_FILE_CREATE_PRIVATE, info, ++ FALSE, create_flags, info, + cancellable, error); + } + else if (flags & G_FILE_COPY_OVERWRITE) +@@ -3293,13 +3297,12 @@ file_copy_fallback (GFile *source, + out = (GOutputStream *)g_file_replace (destination, + NULL, + flags & G_FILE_COPY_BACKUP, +- G_FILE_CREATE_REPLACE_DESTINATION | +- G_FILE_CREATE_PRIVATE, ++ create_flags, + cancellable, error); + } + else + { +- out = (GOutputStream *)g_file_create (destination, G_FILE_CREATE_PRIVATE, cancellable, error); ++ out = (GOutputStream *)g_file_create (destination, create_flags, cancellable, error); + } + + if (!out) +-- +2.37.3 + +From b37d628c01da0bd61348b3ac73b7a436af008d8d Mon Sep 17 00:00:00 2001 +From: Philip Withnall +Date: Fri, 27 Sep 2019 15:02:32 +0100 +Subject: [PATCH 2/2] =?UTF-8?q?gfile:=20Don=E2=80=99t=20copy=20files=20as?= + =?UTF-8?q?=20private=20if=20using=20default=20permissions?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If a copy operation is started with `G_FILE_COPY_TARGET_DEFAULT_PERMS`, +don’t create the destination file as private. Instead, create it with +the process’ current umask (i.e. ‘default permissions’). + +This is a partial re-work of commit d8f8f4d637ce43f8699ba94c9b, with +input from Ondrej Holy. + +Signed-off-by: Philip Withnall + +Fixes: #174 +--- + gio/gfile.c | 22 +++++++++++++++++++--- + 1 file changed, 19 insertions(+), 3 deletions(-) + +diff --git a/gio/gfile.c b/gio/gfile.c +index a617b4cc8..447da3cfb 100644 +--- a/gio/gfile.c ++++ b/gio/gfile.c +@@ -3274,8 +3274,22 @@ file_copy_fallback (GFile *source, + * + * If a future API like g_file_replace_with_info() is added, switch + * this code to use that. ++ * ++ * Use %G_FILE_CREATE_PRIVATE unless ++ * - we were told to create the file with default permissions (i.e. the ++ * process’ umask), ++ * - or if the source file is on a file system which doesn’t support ++ * `unix::mode` (in which case it probably also makes sense to create the ++ * destination with default permissions because the source cannot be ++ * private), ++ * - or if the destination file is a `GLocalFile`, in which case we can ++ * directly open() it with the permissions from the source file. + */ +- create_flags = G_FILE_CREATE_PRIVATE; ++ create_flags = G_FILE_CREATE_NONE; ++ if (!(flags & G_FILE_COPY_TARGET_DEFAULT_PERMS) && ++ g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_UNIX_MODE) && ++ !G_IS_LOCAL_FILE (destination)) ++ create_flags |= G_FILE_CREATE_PRIVATE; + if (flags & G_FILE_COPY_OVERWRITE) + create_flags |= G_FILE_CREATE_REPLACE_DESTINATION; + +@@ -3285,11 +3299,13 @@ file_copy_fallback (GFile *source, + out = (GOutputStream*)_g_local_file_output_stream_replace (_g_local_file_get_filename (G_LOCAL_FILE (destination)), + FALSE, NULL, + flags & G_FILE_COPY_BACKUP, +- create_flags, info, ++ create_flags, ++ (flags & G_FILE_COPY_TARGET_DEFAULT_PERMS) ? NULL : info, + cancellable, error); + else + out = (GOutputStream*)_g_local_file_output_stream_create (_g_local_file_get_filename (G_LOCAL_FILE (destination)), +- FALSE, create_flags, info, ++ FALSE, create_flags, ++ (flags & G_FILE_COPY_TARGET_DEFAULT_PERMS) ? NULL : info, + cancellable, error); + } + else if (flags & G_FILE_COPY_OVERWRITE) +-- +2.37.3 + diff --git a/SPECS/glib2.spec b/SPECS/glib2.spec index 6a3a684..c52732b 100644 --- a/SPECS/glib2.spec +++ b/SPECS/glib2.spec @@ -5,7 +5,7 @@ Name: glib2 Version: 2.56.4 -Release: 159%{?dist} +Release: 160%{?dist} Summary: A library of handy utility functions License: LGPLv2+ @@ -113,6 +113,10 @@ Patch19: gnetworkmonitornm.patch # https://gitlab.gnome.org/GNOME/glib/-/merge_requests/13 Patch20: 13.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=2125184 +# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1134.patch +Patch21: 1134.patch + %description GLib is the low-level core library that forms the basis for projects such as GTK+ and GNOME. It provides data structure handling for C, @@ -310,6 +314,10 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || : %{_datadir}/installed-tests %changelog +* Wed Nov 16 2022 Michael Catanzaro - 2.56.4-160 +- Fix G_FILE_COPY_TARGET_DEFAULT_PERMS, should not create private files +- Resolves: #2125184 + * Fri Apr 22 2022 Michael Catanzaro - 2.56.4-159 - Add --interface-info-[body|header] modes to gdbus-codegen - Related: #2061994