[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 01/02: Only call "file-info" on file objects



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit e49f8c084b645e048a583b8d8c94bd5aa91f66a3
Author: Niels Thykier <niels@thykier.net>
Date:   Mon Oct 13 20:59:14 2014 +0200

    Only call "file-info" on file objects
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 checks/binaries.pm      | 6 ++++--
 checks/scripts.pm       | 5 ++---
 checks/shared-libs.pm   | 1 +
 collection/objdump-info | 1 +
 collection/strings      | 6 +++---
 5 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/checks/binaries.pm b/checks/binaries.pm
index af66879..0035f57 100644
--- a/checks/binaries.pm
+++ b/checks/binaries.pm
@@ -257,9 +257,11 @@ sub run {
     # process all files in package
     foreach my $file ($info->sorted_index) {
         my $fname = $file->name;
-        my $fileinfo = $info->file_info($fname);
-        my $objdump;
+        my ($fileinfo, $objdump);
 
+        next if not $file->is_file;
+
+        $fileinfo = $info->file_info($fname);
         # binary or object file?
         next
           unless ($fileinfo =~ m/^[^,]*\bELF\b/)
diff --git a/checks/scripts.pm b/checks/scripts.pm
index 7025060..88f476e 100644
--- a/checks/scripts.pm
+++ b/checks/scripts.pm
@@ -236,10 +236,9 @@ sub run {
     # says not to depend on it.
 
     foreach my $file ($info->sorted_index) {
+        next if not $file->is_file;
         $ELF{$file} = 1 if $info->file_info($file) =~ /^[^,]*\bELF\b/o;
-
-        my $operm = $file->operm;
-        next unless $file->is_file and ($operm & 0111);
+        next if not ($file->operm & 0111);
         $executable{$file} = 1;
     }
 
diff --git a/checks/shared-libs.pm b/checks/shared-libs.pm
index 4104789..75ce8a3 100644
--- a/checks/shared-libs.pm
+++ b/checks/shared-libs.pm
@@ -68,6 +68,7 @@ sub run {
     }
 
     foreach my $file ($info->sorted_index) {
+        next if not $file->is_file;
         my $fileinfo = $info->file_info($file);
         if ($fileinfo =~ m/^[^,]*\bELF\b/ && $fileinfo =~ m/shared object/) {
             $sharedobject{$file} = 1;
diff --git a/collection/objdump-info b/collection/objdump-info
index 4ffe1c0..ec7794b 100755
--- a/collection/objdump-info
+++ b/collection/objdump-info
@@ -61,6 +61,7 @@ sub collect {
     $opts{pipe_in}->blocking(1);
 
     foreach my $bin ($info->sorted_index) {
+        next if not $bin->is_file;
         my $finfo = $info->file_info($bin);
 
         if ($finfo =~ m/\bELF\b/) {
diff --git a/collection/strings b/collection/strings
index 635f7b8..22ef262 100755
--- a/collection/strings
+++ b/collection/strings
@@ -70,9 +70,9 @@ sub collect {
 
     foreach my $bin ($info->sorted_index) {
         my $filename = $bin->name;
-        my $finfo = $info->file_info($bin);
-        next unless $finfo =~ m/\bELF\b/o;
-        next if $bin =~ m,^usr/lib/debug/,;
+        my $finfo;
+        next if not $bin->is_file or $filename =~ m,^usr/lib/debug/,;
+        next unless $info->file_info($bin) =~ m/\bELF\b/o;
         if ($bin =~ m/[:\n\r]/) {
             # Do these "interesting cases" manual
             push @manual, $filename;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: