The following commit has been merged in the sid branch:
commit 5ee4e4e0458088cde1625ddb5a3d736f31a335d3
Author: Guillem Jover <[email protected]>
Date:   Thu Jul 29 09:11:02 2010 +0200

    build: Disable usage of synchronous sync(2) by default
    
    It causes undesired I/O on unrelated file systems. It also makes the
    code behave differently on Linux systems.
    
    Allow the possibility to enable it again for the benefit of downstreams,
    which might want to use it regardless of its problems. Although this
    code path will most probably be removed in the near future.
    
    Closes: #588339, #595927, #600075

diff --git a/configure.ac b/configure.ac
index b741769..2a524fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -129,7 +129,7 @@ DPKG_DECL_SYS_SIGLIST
 # Checks for library functions.
 DPKG_FUNC_VA_COPY
 DPKG_FUNC_C99_SNPRINTF
-DPKG_FUNC_ASYNC_SYNC
+DPKG_FUNC_SYNC_SYNC
 DPKG_CHECK_DECL([offsetof], [stddef.h])
 DPKG_CHECK_DECL([WCOREDUMP], [sys/wait.h])
 DPKG_CHECK_DECL([TIOCNOTTY], [sys/ioctl.h])
diff --git a/debian/changelog b/debian/changelog
index f66daa9..4fcd521 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,10 @@ dpkg (1.15.8.6) UNRELEASED; urgency=low
     correct series file if the source package provides vendor specific patch
     sets.
 
+  [ Guillem Jover ]
+  * Disable by default usage of synchronous sync(2), as it causes undesired
+    I/O on unrelated file systems. Closes: #588339, #595927, #600075
+
   [ Updated man page translations ]
   * French (Christian Perrier). Including a typo fix
     and a typographical change reported by Vincent Danjean
diff --git a/m4/dpkg-funcs.m4 b/m4/dpkg-funcs.m4
index d374986..8b1ee70 100644
--- a/m4/dpkg-funcs.m4
+++ b/m4/dpkg-funcs.m4
@@ -84,21 +84,33 @@ AC_DEFUN([DPKG_MMAP],
   )
 ])
 
-# DPKG_FUNC_ASYNC_SYNC
+# DPKG_FUNC_SYNC_SYNC
 # --------------------
-# Define HAVE_ASYNC_SYNC if sync() is asynchronous
-AC_DEFUN([DPKG_FUNC_ASYNC_SYNC],
+# Define USE_SYNC_SYNC if sync() is synchronous and it has been enabled
+# on configure
+AC_DEFUN([DPKG_FUNC_SYNC_SYNC],
 [
   AC_CANONICAL_HOST
-  AC_MSG_CHECKING([whether sync is asynchronous])
+
+  AC_MSG_CHECKING([whether sync is synchronous])
   AS_CASE([$host_os],
-          [linux-*], [dpkg_cv_async_sync=no],
-          [dpkg_cv_async_sync=yes])
-  AS_IF([test "x$dpkg_cv_async_sync" = "xyes"],
-        [AC_DEFINE([HAVE_ASYNC_SYNC], 1,
-                   [Define to 1 if the 'sync' function is asynchronous])])
-  AC_MSG_RESULT([$dpkg_cv_async_sync])
-])# DPKG_FUNC_ASYNC_SYNC
+          [linux-*], [dpkg_cv_sync_sync=yes],
+          [dpkg_cv_sync_sync=no])
+  AC_MSG_RESULT([$dpkg_cv_sync_sync])
+
+  AC_ARG_ENABLE([sync-sync],
+    AS_HELP_STRING([--enable-sync-sync],
+                   [enable usage of synchronous sync(2) if available]),
+    [],
+    [enable_sync_sync=no])
+  AC_MSG_CHECKING([whether to use synchronous sync])
+  AS_IF([test "x$dpkg_cv_sync_sync" = "xyes" &&
+         test "x$enable_sync_sync" = "xyes"],
+        [AC_DEFINE([USE_SYNC_SYNC], 1,
+                   [Define to 1 if sync(2) is synchronous])],
+        [enable_sync_sync=no])
+  AC_MSG_RESULT([$enable_sync_sync])
+])# DPKG_FUNC_SYNC_SYNC
 
 # DPKG_CHECK_COMPAT_FUNCS(LIST)
 # -----------------------
diff --git a/src/archives.c b/src/archives.c
index d1daed4..129e8a3 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -855,7 +855,7 @@ tar_deferred_extract(struct fileinlist *files, struct 
pkginfo *pkg)
   struct filenamenode *usenode;
   const char *usename;
 
-#if !defined(HAVE_ASYNC_SYNC)
+#if defined(USE_SYNC_SYNC)
   debug(dbg_general, "deferred extract mass sync");
   sync();
 #endif
@@ -871,7 +871,7 @@ tar_deferred_extract(struct fileinlist *files, struct 
pkginfo *pkg)
 
     setupfnamevbs(usename);
 
-#if defined(HAVE_ASYNC_SYNC)
+#if !defined(USE_SYNC_SYNC)
     if (cfile->namenode->flags & fnnf_deferred_fsync) {
       int fd;
 

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to