瀏覽代碼

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 10 年之前
父節點
當前提交
1095fdab35
共有 2 個文件被更改,包括 6 次插入 和 2 次删除
  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;