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) = @_;
}
}
+ # 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:/;
Missing hardening flags.
+=item B<16>
+
+Hardening wrapper detected, no tests performed.
+
=back
=head1 AUTHOR
--- /dev/null
+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
use strict;
use warnings;
-use Test::More tests => 86;
+use Test::More tests => 88;
sub is_blhc {
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