[maemo-commits] [maemo-commits] r16045 - in projects/haf/trunk/dbus/debian: . patches

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Sep 5 21:36:26 EEST 2008
Author: guillem
Date: 2008-09-05 21:36:26 +0300 (Fri, 05 Sep 2008)
New Revision: 16045

Added:
   projects/haf/trunk/dbus/debian/patches/90-atomic-file-change-sync.patch
Modified:
   projects/haf/trunk/dbus/debian/changelog
   projects/haf/trunk/dbus/debian/patches/series
Log:
Make atomic file changes really atomic by syncing the data before rename

(Closes at FreeDesktop.org: #17352)
Thanks to Artem Bityutskiy <Artem.Bityutskiy at nokia.com>.


Modified: projects/haf/trunk/dbus/debian/changelog
===================================================================
--- projects/haf/trunk/dbus/debian/changelog	2008-09-05 18:30:47 UTC (rev 16044)
+++ projects/haf/trunk/dbus/debian/changelog	2008-09-05 18:36:26 UTC (rev 16045)
@@ -1,6 +1,10 @@
 dbus (1.2.3-0maemo1) UNRELEASED; urgency=low
 
   * New upstream release.
+  * Make atomic file changes really atomic by syncing the data before rename.
+    - debian/patches/90-atomic-file-change-sync.patch: New file.
+    (Closes at FreeDesktop.org: #17352)
+    Thanks to Artem Bityutskiy <Artem.Bityutskiy at nokia.com>.
 
  -- Guillem Jover <guillem.jover at nokia.com>  Fri, 05 Sep 2008 20:52:49 +0300
 

Added: projects/haf/trunk/dbus/debian/patches/90-atomic-file-change-sync.patch
===================================================================
--- projects/haf/trunk/dbus/debian/patches/90-atomic-file-change-sync.patch	2008-09-05 18:30:47 UTC (rev 16044)
+++ projects/haf/trunk/dbus/debian/patches/90-atomic-file-change-sync.patch	2008-09-05 18:36:26 UTC (rev 16045)
@@ -0,0 +1,42 @@
+From c29d149a3aab3c6a6de3c76b2dca5319e79b558e Mon Sep 17 00:00:00 2001
+From: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
+Date: Fri, 29 Aug 2008 17:13:15 +0300
+Subject: [PATCH] Bug 17352: synchronize the file before renaming
+
+Dbus is doing atomic file updates by copying them, changing
+the copy, and re-naming them. However, it does not synchronize
+the file before re-naming, which results in corruption in
+case of unclean reboots. The reason for this is that file-systems
+have write-back cache and they postpone writing data to the media.
+
+This patch adds the missed fsync() for the Unix part. I do
+not have windows so cannot provide a windows port fix.
+
+Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
+---
+ dbus/dbus-sysdeps-unix.c |    9 +++++++++
+ 1 files changed, 9 insertions(+), 0 deletions(-)
+
+diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c
+index 33f56ff..3f963bc 100644
+--- a/dbus/dbus-sysdeps-unix.c
++++ b/dbus/dbus-sysdeps-unix.c
+@@ -2224,6 +2224,15 @@ _dbus_string_save_to_file (const DBusString *str,
+       total += bytes_written;
+     }
+ 
++  if (fsync(fd))
++    {
++      dbus_set_error (error, _dbus_error_from_errno (errno),
++                      "Could not synchronize file %s: %s",
++                      tmp_filename_c, _dbus_strerror (errno));
++
++      goto out;
++  }
++
+   if (!_dbus_close (fd, NULL))
+     {
+       dbus_set_error (error, _dbus_error_from_errno (errno),
+-- 
+1.5.6
+

Modified: projects/haf/trunk/dbus/debian/patches/series
===================================================================
--- projects/haf/trunk/dbus/debian/patches/series	2008-09-05 18:30:47 UTC (rev 16044)
+++ projects/haf/trunk/dbus/debian/patches/series	2008-09-05 18:36:26 UTC (rev 16045)
@@ -16,3 +16,4 @@
 21-add-missing-va_end.patch
 22-use-signed-return-value.patch
 32-add-oom-check-to-main.patch
+90-atomic-file-change-sync.patch


More information about the maemo-commits mailing list