forked from pool/dconf
Accepting request 420585 from home:zhangxiaofei:branches:GNOME:Factory
- Add 0001-gvdb-Restore-permissions-on-changed-files.patch: 'dconf update' writes new contents into temporary file and renames it to the original one, resulting permission inconsistencies if umask has been changed before that. The patch restores the changed permissions (bsc#971074, bgo#758066). OBS-URL: https://build.opensuse.org/request/show/420585 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/dconf?expand=0&rev=91
This commit is contained in:
parent
64887db45d
commit
c187a1fb73
49
0001-gvdb-Restore-permissions-on-changed-files.patch
Normal file
49
0001-gvdb-Restore-permissions-on-changed-files.patch
Normal file
@ -0,0 +1,49 @@
|
||||
From 4e303b094dc2b6c53739fb65f0e6e9f508a8f99c Mon Sep 17 00:00:00 2001
|
||||
From: Marek Kasik <mkasik@redhat.com>
|
||||
Date: Fri, 13 Nov 2015 17:22:31 +0100
|
||||
Subject: [PATCH] gvdb: Restore permissions on changed files
|
||||
|
||||
Restore permissions of files changed in gvdb_table_write_contents().
|
||||
Since g_file_set_contents() doesn't preserve permissions it can happen
|
||||
that if user calling e.g. "dconf update" has umask set then
|
||||
the originally readable file becomes unreadable.
|
||||
---
|
||||
gvdb/gvdb-builder.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/gvdb/gvdb-builder.c b/gvdb/gvdb-builder.c
|
||||
index 90ea50b..a185cb3 100644
|
||||
--- a/gvdb/gvdb-builder.c
|
||||
+++ b/gvdb/gvdb-builder.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "gvdb-format.h"
|
||||
|
||||
#include <glib.h>
|
||||
+#include <glib/gstdio.h>
|
||||
#include <fcntl.h>
|
||||
#if !defined(G_OS_WIN32) || !defined(_MSC_VER)
|
||||
#include <unistd.h>
|
||||
@@ -509,13 +510,20 @@ gvdb_table_write_contents (GHashTable *table,
|
||||
gboolean status;
|
||||
FileBuilder *fb;
|
||||
GString *str;
|
||||
+ GStatBuf buf;
|
||||
+ gint stat_ret;
|
||||
|
||||
fb = file_builder_new (byteswap);
|
||||
file_builder_add_hash (fb, table, &root);
|
||||
str = file_builder_serialise (fb, root);
|
||||
|
||||
+ stat_ret = g_stat (filename, &buf);
|
||||
+
|
||||
status = g_file_set_contents (filename, str->str, str->len, error);
|
||||
g_string_free (str, TRUE);
|
||||
|
||||
+ if (stat_ret == 0)
|
||||
+ g_chmod (filename, buf.st_mode);
|
||||
+
|
||||
return status;
|
||||
}
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,3 +1,12 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Aug 19 18:10:24 UTC 2016 - fezhang@suse.com
|
||||
|
||||
- Add 0001-gvdb-Restore-permissions-on-changed-files.patch:
|
||||
'dconf update' writes new contents into temporary file and
|
||||
renames it to the original one, resulting permission
|
||||
inconsistencies if umask has been changed before that. The patch
|
||||
restores the changed permissions (bsc#971074, bgo#758066).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Apr 13 09:51:11 UTC 2016 - fezhang@suse.com
|
||||
|
||||
|
@ -25,6 +25,8 @@ Group: System/Libraries
|
||||
Url: http://live.gnome.org/dconf
|
||||
Source: http://download.gnome.org/sources/dconf/0.26/%{name}-%{version}.tar.xz
|
||||
Source99: baselibs.conf
|
||||
# PATCH-FIX-UPSTREAM 0001-gvdb-Restore-permissions-on-changed-files.patch bsc#971074 bgo#758066 fezhang@suse.com -- Restore permissions on files changed by dconf update.
|
||||
Patch0: 0001-gvdb-Restore-permissions-on-changed-files.patch
|
||||
# For directory ownership
|
||||
BuildRequires: dbus-1
|
||||
BuildRequires: docbook-xsl-stylesheets
|
||||
@ -91,6 +93,7 @@ have configuration storage systems.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
|
||||
%if 0%{?BUILD_FROM_VCS}
|
||||
[ -x ./autogen.sh ] && NOCONFIGURE=1 ./autogen.sh
|
||||
|
Loading…
Reference in New Issue
Block a user