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

[SCM] Debian package checker branch, master, updated. 2.5.13-45-g2855e9d



The following commit has been merged in the master branch:
commit 2855e9ddeccff10c0f8d52787e099b749cacc97e
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Jun 29 13:08:18 2013 +0200

    coll/hardening-info: Do not unconditionally create file
    
    Quite a few packages have no hardening issues left (e.g. most arch:all
    packages).  Instead of creating an empty file to signal this, have
    L::C::Binary handle the absence of the file.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/collection/hardening-info b/collection/hardening-info
index b92bd37..06d6e4f 100755
--- a/collection/hardening-info
+++ b/collection/hardening-info
@@ -78,8 +78,6 @@ foreach my $bin ($info->sorted_index) {
 if (%opts) {
     close($opts{pipe_in});
     reap (\%opts);
-} else {
-    touch_file("$dir/hardening-info");
 }
 
 }
diff --git a/collection/hardening-info.desc b/collection/hardening-info.desc
index fbb4e23..cf1adfc 100644
--- a/collection/hardening-info.desc
+++ b/collection/hardening-info.desc
@@ -3,6 +3,6 @@ Author: Kees Cook <kees@debian.org>
 Info: This script runs hardening-check(1) over all ELF binaries of a binary
  package.
 Type: binary, udeb
-Version: 4
+Version: 5
 Needs-Info: bin-pkg-control, file-info, index, unpacked
 Interface: perl-coll
diff --git a/lib/Lintian/Collect/Binary.pm b/lib/Lintian/Collect/Binary.pm
index 8c86d72..af0dd9e 100644
--- a/lib/Lintian/Collect/Binary.pm
+++ b/lib/Lintian/Collect/Binary.pm
@@ -421,20 +421,20 @@ sub hardening_info {
     return $self->{hardening_info} if exists $self->{hardening_info};
     my $hardf = $self->lab_data_path ('hardening-info');
     my %hardening_info;
-    my ($file);
-    local $_;
-    open(my $idx, '<', $hardf);
-    while (<$idx>) {
-        chomp;
-
-        if (m,^([^:]+):(?:\./)?(.*)$,) {
-            my ($tag, $file) = ($1, $2);
-            push(@{$hardening_info{$file}}, $tag);
+    if ( -e $hardf ) {
+        open(my $idx, '<', $hardf);
+        while (my $line = <$idx>) {
+            chomp($line);
+
+            if ($line =~ m,^([^:]+):(?:\./)?(.*)$,) {
+                my ($tag, $file) = ($1, $2);
+                push(@{$hardening_info{$file}}, $tag);
+            }
         }
+        close($idx);
     }
 
     $self->{hardening_info} = \%hardening_info;
-    close($idx);
     return $self->{hardening_info};
 }
 

-- 
Debian package checker


Reply to: