浏览代码

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)
Guillem Jover 9 年之前
父节点
当前提交
afa428a417
共有 2 个文件被更改,包括 7 次插入1 次删除
  1. 2 0
      debian/changelog
  2. 5 1
      scripts/Dpkg/File.pm

+ 2 - 0
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).

+ 5 - 1
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 {