[Reproducible-commits] [dpkg] 20/32: dpkg: Defer hardlink renames to avoid breakage on unpack

Holger Levsen holger at layer-acht.org
Tue May 3 08:43:14 UTC 2016


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to annotated tag 1.15.10
in repository dpkg.

commit 3fe96e302867a6e983c1c469a2751dfc050ecb1f
Author: Guillem Jover <guillem at debian.org>
Date:   Sat Aug 13 03:19:24 2011 +0200

    dpkg: Defer hardlink renames to avoid breakage on unpack
    
    Cherry picked from commit efcf279a50aba3369b24d062017d581006d47d9b.
    
    This fixes two issues related to making the new file contents available
    through an alternative but final path before
    
    1) the one "carrying" the content has been fsync()ed, to avoid getting
    garbage on system failure.
    
    2) the deferred fsync() on the main path has been performed, avoiding
    a possible error when reopening the file for writing if it's currently
    under execution.
    
    Deferring the hardlink is safe as they are always after the tar entry
    containing the actual file data.
    
    Regression introduced in commit 9cd41fdda1c27169c52d73b3b3ce71991d724994.
    
    Closes: #635683
    
    Reported-by: Niko Tyni <ntyni at debian.org>
    Based-on-patch-by: Jonathan Nieder <jrnieder at gmail.com>
    Signed-off-by: Guillem Jover <guillem at debian.org>
---
 debian/changelog | 5 +++++
 src/archives.c   | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 9851c33..f7416c2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,11 @@ dpkg (1.15.8.12) UNRELEASED; urgency=low
   [ Guillem Jover ]
   * Do not fail to unpack shared directories missing on the file system
     from packages being replaced by other packages. Closes: #631808
+  * Defer hardlink renames so that there's never a point were the new
+    file contents are accessible from the final path before they have
+    been fsync()ed and cannot be executed causing ETXTBSY when trying
+    to open the to be installed paths for writing.
+    Thanks to Jonathan Nieder <jrnieder at gmail.com>. Closes: #635683
 
   [ Updated man page translations ]
   * German (Helge Kreutzmann). Minor fixe(s), including improvement by "Flo".
diff --git a/src/archives.c b/src/archives.c
index 7189045..0e9c113 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -846,7 +846,8 @@ tarobject(void *ctx, struct tar_entry *ti)
    * in dpkg-new.
    */
 
-  if (ti->type == tar_filetype_file || ti->type == tar_filetype_symlink) {
+  if (ti->type == tar_filetype_file || ti->type == tar_filetype_hardlink ||
+      ti->type == tar_filetype_symlink) {
     nifd->namenode->flags |= fnnf_deferred_rename;
 
     debug(dbg_eachfiledetail, "tarobject done and installation deferred");

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list