Hi,

Niko Tyni wrote:

> Looks like dpkg tries to sync /usr/bin/perl5.12.4.dpkg-new when a hard
> link has already been renamed to /usr/bin/perl and presumably gotten
> executed by someone else.

Ah, fun. :)

Does this help?
---
 debian/changelog |    6 ++++++
 src/archives.c   |    4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 20c296d5..5bab74e7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -186,6 +186,12 @@ dpkg (1.16.1~jrn) local; urgency=low
   * Add new --raw-extract option to dpkg-deb combining --control and
     --extract. Closes: #552123
 
+  [ Jonathan Nieder ]
+  * Open extracted files for reading, not writing, in order to fsync() them.
+    Otherwise the open can error out when preparing to rename a binary into
+    place that has a hard link already in use. Regression introduced in
+    1.15.6.1. Closes: #635683
+
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312
   * Swedish (Peter Krefting).
diff --git a/src/archives.c b/src/archives.c
index f060e706..d0bb2d8f 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -894,7 +894,7 @@ tar_writeback_barrier(struct fileinlist *files, struct 
pkginfo *pkg)
 
     setupfnamevbs(usename);
 
-    fd = open(fnamenewvb.buf, O_WRONLY);
+    fd = open(fnamenewvb.buf, O_RDONLY);
     if (fd < 0)
       ohshite(_("unable to open '%.255s'"), fnamenewvb.buf);
     /* Ignore the return code as it should be considered equivalent to an
@@ -937,7 +937,7 @@ tar_deferred_extract(struct fileinlist *files, struct 
pkginfo *pkg)
 
       debug(dbg_eachfiledetail, "deferred extract needs fsync");
 
-      fd = open(fnamenewvb.buf, O_WRONLY);
+      fd = open(fnamenewvb.buf, O_RDONLY);
       if (fd < 0)
         ohshite(_("unable to open '%.255s'"), fnamenewvb.buf);
       if (fsync(fd))
-- 
1.7.6





-- 
To UNSUBSCRIBE, email to debian-dpkg-bugs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to