From c6903ab9db7dc702fdff1e4964fab49a3d0de91c Mon Sep 17 00:00:00 2001 From: Matthias Klumpp Date: Sun, 8 Dec 2024 23:08:26 +0100 Subject: [PATCH] utils: Explicitly set permissions on installed metadata files Resolves: #681 --- src/as-utils.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/as-utils.c b/src/as-utils.c index 75b3d336..4def1dce 100644 --- a/src/as-utils.c +++ b/src/as-utils.c @@ -2434,6 +2434,7 @@ as_utils_install_metadata_file_internal (const gchar *filename, g_autofree gchar *path_parent = NULL; g_autoptr(GFile) file_dest = NULL; g_autoptr(GFile) file_src = NULL; + g_autoptr(GError) tmp_error = NULL; /* create directory structure */ path_parent = g_strdup_printf ("%s%s", destdir, dir); @@ -2472,6 +2473,17 @@ as_utils_install_metadata_file_internal (const gchar *filename, if (!g_file_copy (file_src, file_dest, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, error)) return FALSE; + /* explicitly set permissions on the copied file */ + if (!g_file_set_attribute_uint32 (file_dest, + G_FILE_ATTRIBUTE_UNIX_MODE, + 0644, + G_FILE_QUERY_INFO_NONE, + NULL, + &tmp_error)) { + g_debug ("Error setting file permissions: %s", tmp_error->message); + g_clear_error (&tmp_error); + } + /* update the origin for XML files */ if (origin != NULL && !is_yaml) { g_autoptr(AsMetadata) mdata = as_metadata_new ();