]> ruderich.org/simon Gitweb - blhc/blhc.git/commitdiff
Don't perform any tests if hardening-wrapper is used.
authorSimon Ruderich <simon@ruderich.org>
Thu, 22 Mar 2012 01:05:50 +0000 (02:05 +0100)
committerSimon Ruderich <simon@ruderich.org>
Thu, 22 Mar 2012 01:05:50 +0000 (02:05 +0100)
MANIFEST
bin/blhc
t/logs/debian-hardening-wrapper [new file with mode: 0644]
t/tests.t

index 6a79d894a1b78fb272ca96adc0593e89f2e063cd..c5b34a56e15553fa06f9b1af3c6df9ccb28cacc9 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -21,6 +21,7 @@ t/logs/c++
 t/logs/cc
 t/logs/configure
 t/logs/debian
+t/logs/debian-hardening-wrapper
 t/logs/empty
 t/logs/g++
 t/logs/gcc
index d804ecdea41338865a799061ad4c5fad01359639..a28f36f1126e4a404b5cfce9b8c9c9f1127b6f82 100755 (executable)
--- a/bin/blhc
+++ b/bin/blhc
@@ -180,6 +180,12 @@ sub error_non_verbose_build {
            error_color(':', 'yellow'),
            $line;
 }
+sub error_hardening_wrapper {
+    printf "%s%s %s\n",
+            error_color('HARDENING WRAPPER', 'red'),
+            error_color(':', 'yellow'),
+            'no checks possible, aborting';
+}
 sub error_color {
     my ($message, $color) = @_;
 
@@ -366,6 +372,14 @@ while (my $line = <>) {
         }
     }
 
+    # If hardening wrapper is used (wraps calls to gcc and adds hardening
+    # flags automatically) we can't perform any checks, abort.
+    if (not $start and $line =~ /^Build-Depends: .*\bhardening-wrapper\b/) {
+        error_hardening_wrapper();
+        $exit |= 1 << 4;
+        exit $exit;
+    }
+
     # We skip over unimportant lines at the beginning of the log to prevent
     # false positives.
     $start = 1 if $line =~ /^dpkg-buildpackage:/;
@@ -695,6 +709,10 @@ Non verbose build.
 
 Missing hardening flags.
 
+=item B<16>
+
+Hardening wrapper detected, no tests performed.
+
 =back
 
 =head1 AUTHOR
diff --git a/t/logs/debian-hardening-wrapper b/t/logs/debian-hardening-wrapper
new file mode 100644 (file)
index 0000000..2e2966c
--- /dev/null
@@ -0,0 +1,8 @@
+Build-Depends: .., hardening-wrapper, ...
+
+dpkg-buildpackage: source package test
+
+gcc -g -O2 -c test-a.c
+gcc -g -O2 -c test-b.c
+gcc -g -O2 -c test-c.c
+gcc -o test test-a.o test-b.o test-c.o -ltest
index ff9e3edb6f2aa9e1b267b2620d69248672c32378..555b5be3b27d15986c19e5439eb9622e7d78b720 100644 (file)
--- a/t/tests.t
+++ b/t/tests.t
@@ -19,7 +19,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 86;
+use Test::More tests => 88;
 
 
 sub is_blhc {
@@ -540,6 +540,10 @@ CPPFLAGS missing (-D_FORTIFY_SOURCE=2): gcc -c `dpkg-buildflags --get LDFLAGS` t
 LDFLAGS missing (-Wl,-z,relro): gcc -o test test.o `dpkg-buildflags --get CFLAGS`
 ';
 
+is_blhc 'debian-hardening-wrapper', '', 16,
+        'HARDENING WRAPPER: no checks possible, aborting
+';
+
 
 # buildd support