Browse Source

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.
Guillem Jover 7 years ago
parent
commit
1095fdab35
2 changed files with 6 additions and 2 deletions
  1. 3 1
      debian/changelog
  2. 3 1
      scripts/Dpkg/Dist/Files.pm

+ 3 - 1
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@debian.org>  Sun, 06 Nov 2016 06:28:11 +0100
 

+ 3 - 1
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;