diff --git a/SOURCES/dconf-0.26.0-db-mtime.patch b/SOURCES/dconf-0.26.0-db-mtime.patch new file mode 100644 index 0000000..69fe241 --- /dev/null +++ b/SOURCES/dconf-0.26.0-db-mtime.patch @@ -0,0 +1,77 @@ +From 6a6797446f13378035a2700253546b524d629c8a Mon Sep 17 00:00:00 2001 +From: Marek Kasik +Date: Tue, 10 Jul 2018 18:29:16 +0200 +Subject: [PATCH] Check mtimes of files when updating databases + +Do not check just mtimes of directories in /etc/dconf/db/ +but also mtimes of the files in those directories +to catch all modifications in them. + +https://bugzilla.gnome.org/show_bug.cgi?id=708258 +--- + bin/dconf-update.vala | 41 ++++++++++++++++++++++++++++++++++------- + 1 file changed, 34 insertions(+), 7 deletions(-) + +diff --git a/bin/dconf-update.vala b/bin/dconf-update.vala +index d452092..5aac6c7 100644 +--- a/bin/dconf-update.vala ++++ b/bin/dconf-update.vala +@@ -162,21 +162,48 @@ Gvdb.HashTable read_directory (string dirname) throws GLib.Error { + return table; + } + ++time_t get_directory_mtime (string dirname, Posix.Stat dir_buf) throws GLib.Error { ++ Posix.Stat lockdir_buf; ++ Posix.Stat file_buf; ++ time_t dir_mtime = dir_buf.st_mtime; ++ ++ var files = list_directory (dirname, Posix.S_IFREG); ++ files.sort (strcmp); ++ files.reverse (); ++ ++ foreach (var filename in files) { ++ if (Posix.stat (filename, out file_buf) == 0 && file_buf.st_mtime > dir_mtime) ++ dir_mtime = file_buf.st_mtime; ++ } ++ ++ if (Posix.stat (dirname + "/locks", out lockdir_buf) == 0 && Posix.S_ISDIR (lockdir_buf.st_mode)) { ++ if (lockdir_buf.st_mtime > dir_mtime) { ++ // if the lock directory has been updated more recently then consider its timestamp instead ++ dir_mtime = lockdir_buf.st_mtime; ++ } ++ ++ files = list_directory (dirname + "/locks", Posix.S_IFREG); ++ files.sort (strcmp); ++ files.reverse (); ++ ++ foreach (var filename in files) { ++ if (Posix.stat (filename, out file_buf) == 0 && file_buf.st_mtime > dir_mtime) ++ dir_mtime = file_buf.st_mtime; ++ } ++ } ++ ++ return dir_mtime; ++} ++ + void maybe_update_from_directory (string dirname) throws GLib.Error { + Posix.Stat dir_buf; + + if (Posix.stat (dirname, out dir_buf) == 0 && Posix.S_ISDIR (dir_buf.st_mode)) { +- Posix.Stat lockdir_buf; + Posix.Stat file_buf; + + var filename = dirname.substring (0, dirname.length - 2); + +- if (Posix.stat (dirname + "/locks", out lockdir_buf) == 0 && lockdir_buf.st_mtime > dir_buf.st_mtime) { +- // if the lock directory has been updated more recently then consider its timestamp instead +- dir_buf.st_mtime = lockdir_buf.st_mtime; +- } +- +- if (Posix.stat (filename, out file_buf) == 0 && file_buf.st_mtime > dir_buf.st_mtime) { ++ if (Posix.stat (filename, out file_buf) == 0 && file_buf.st_mtime > get_directory_mtime (dirname, dir_buf)) { + return; + } + +-- +2.17.1 + diff --git a/SPECS/dconf.spec b/SPECS/dconf.spec index bc47250..42aa675 100644 --- a/SPECS/dconf.spec +++ b/SPECS/dconf.spec @@ -3,7 +3,7 @@ Name: dconf Version: 0.26.0 -Release: 2%{?dist} +Release: 3%{?dist}.1 Summary: A configuration system Group: System Environment/Base @@ -19,6 +19,9 @@ Patch1: dconf-0.26.0-read-flag.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1281253 Patch2: dconf-0.26.0-permissions.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1626372 +Patch3: dconf-0.26.0-db-mtime.patch + BuildRequires: glib2-devel >= %{glib2_version} BuildRequires: libxml2-devel BuildRequires: dbus-devel @@ -47,6 +50,7 @@ development using dconf. %patch0 -p1 -R -b .libdbus %patch1 -p1 -b .read-flag %patch2 -p1 -b .permissions +%patch3 -p1 -b .mtimes autoreconf -ivf @@ -127,6 +131,11 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || : %{_datadir}/vala %changelog +* Fri Sep 14 2018 Marek Kasik - 0.26.0-3 +- Check mtimes of files in /etc/dconf/db/*.d/ directories +- when running "dconf update" +- Resolves: #1626372 + * Mon Mar 6 2017 Marek Kasik - 0.26.0-2 - Restore permissions on updated database - Resolves: #1281253