Просмотр исходного кода

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 лет назад: 9
Родитель
Сommit
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;