[dpkg] 02/200: Dpkg::Dist::Files: Do not try to load non-files in load_dir method

Ximin Luo infinity0 at debian.org
Wed Apr 5 15:17:06 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 1095fdab355a0e41114e753827dc41dd3d8b879c
Author: Guillem Jover <guillem at debian.org>
Date:   Sun Nov 6 07:42:11 2016 +0100

    Dpkg::Dist::Files: Do not try to load non-files in load_dir method
    
    Non-Linux systems allow to open directories, which return their
    contents, this makes the load method fail with parsing errors. Make
    the code only try to ever load regular files.
---
 debian/changelog           | 4 +++-
 scripts/Dpkg/Dist/Files.pm | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 13392c2..726102f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,8 @@
 dpkg (1.18.13) UNRELEASED; urgency=medium
 
-  *
+  * Perl modules:
+    - Do not try to load non-files in Dpkg::Dist::Files load_dir method.
+      Fixes test failures on non-Linux architectures.
 
  -- Guillem Jover <guillem at debian.org>  Sun, 06 Nov 2016 06:28:11 +0100
 
diff --git a/scripts/Dpkg/Dist/Files.pm b/scripts/Dpkg/Dist/Files.pm
index 2c4ab53..347f58e 100644
--- a/scripts/Dpkg/Dist/Files.pm
+++ b/scripts/Dpkg/Dist/Files.pm
@@ -110,7 +110,9 @@ sub load_dir {
     my $dh = IO::Dir->new($dir) or syserr(g_('cannot open directory %s'), $dir);
 
     while (defined(my $file = $dh->read)) {
-        $count += $self->load("$dir/$file");
+        my $pathname = "$dir/$file";
+        next unless -f $pathname;
+        $count += $self->load($pathname);
     }
 
     return $count;

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