[dpkg] 150/200: Dpkg::File: Disable the NFS-unsafe warning on Linux

Ximin Luo infinity0 at debian.org
Wed Apr 5 15:17:31 UTC 2017


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

infinity0 pushed a commit to branch master
in repository dpkg.

commit afa428a4175c4aeeb640a4b9cb45a4fdb5ddf247
Author: Guillem Jover <guillem at debian.org>
Date:   Sat Jan 28 04:19:05 2017 +0100

    Dpkg::File: Disable the NFS-unsafe warning on Linux
    
    On Linux systems the flock() locks get converted to file-range locks on
    NFS mounts, which makes it safe.
    
    The correct solution here will be to completely get rid of the need to
    do any locking, which should also make parallel builds faster.
    
    Addresses: #677865 (on Linux)
---
 debian/changelog     | 2 ++
 scripts/Dpkg/File.pm | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 919cc8c..6e04ca1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,8 @@ dpkg (1.18.20) UNRELEASED; urgency=medium
       from dpkg-shlibdeps.
     - Encode the ELF ABI as a big-endian byte stream, so that decoding for
       output gives meaningful results.
+    - Disable the NFS-unsafe warning on Linux, as using flock() on NFS has
+      been safe for some time now. Addresses: #677865 (on Linux)
 
   [ Updated scripts translations ]
   * German (Helge Kreutzmann).
diff --git a/scripts/Dpkg/File.pm b/scripts/Dpkg/File.pm
index 075238e..cf68d9e 100644
--- a/scripts/Dpkg/File.pm
+++ b/scripts/Dpkg/File.pm
@@ -43,7 +43,11 @@ sub file_lock($$) {
         use File::FcntlLock;
     };
     if ($@) {
-        warning(g_('File::FcntlLock not available; using flock which is not NFS-safe'));
+        # On Linux systems the flock() locks get converted to file-range
+        # locks on NFS mounts.
+        if ($^O ne 'linux') {
+            warning(g_('File::FcntlLock not available; using flock which is not NFS-safe'));
+        }
         flock($fh, LOCK_EX)
             or syserr(g_('failed to get a write lock on %s'), $filename);
     } else {

-- 
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