X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=bin%2Fblhc;h=028dfbe53190d67f1a70768098fba0c3bfb33531;hb=002738b1c775343f96d4a8228529ba4257085fd3;hp=7f1fd84fe1b078841eebbcd06a1c4f83cd6a5e2c;hpb=aa0da48a68484b4656e97251de39086d0a80137d;p=blhc%2Fblhc.git diff --git a/bin/blhc b/bin/blhc index 7f1fd84..028dfbe 100755 --- a/bin/blhc +++ b/bin/blhc @@ -209,6 +209,7 @@ my %exit_code = ( non_verbose_build => 1 << 2, flags_missing => 1 << 3, hardening_wrapper => 1 << 4, + invalid_cmake => 1 << 5, ); # Statistics of missing flags and non-verbose build commands. Used for @@ -253,6 +254,14 @@ sub error_non_verbose_build { error_color(':', 'yellow'), $line; } +sub error_invalid_cmake { + my ($version) = @_; + + printf "%s%s %s\n", + error_color('INVALID CMAKE', 'red'), + error_color(':', 'yellow'), + $version; +} sub error_hardening_wrapper { printf "%s%s %s\n", error_color('HARDENING WRAPPER', 'red'), @@ -483,7 +492,7 @@ FILE: foreach my $file (@ARGV) { # flags are not checked. if ($option_buildd and $line =~ /^Toolchain package versions: /) { require Dpkg::Version; - if ($line !~ /dpkg-dev_(\S+)/ + if ($line !~ /\bdpkg-dev_(\S+)/ or Dpkg::Version::version_compare($1, '1.16.1') < 0) { $harden_format = 0; $harden_fortify = 0; @@ -494,6 +503,23 @@ FILE: foreach my $file (@ARGV) { } } + # The following two versions of CMake in Debian obeyed CPPFLAGS, but + # this was later dropped because upstream rejected the patch. Thus + # build logs with these versions will have fortify hardening flags + # enabled, even though they may be not correctly set and are missing + # when build with later CMake versions. Thanks to Aron Xu for letting + # me know. + if ($line =~ /^Package versions: / + and $line =~ /\bcmake_(\S+)/ + and ($1 eq '2.8.7-1' or $1 eq '2.8.7-2')) { + if (not $option_buildd) { + error_invalid_cmake($1); + } else { + print "W-invalid-cmake-used $1\n"; + } + $exit |= $exit_code{invalid_cmake}; + } + # If hardening wrapper is used (wraps calls to gcc and adds hardening # flags automatically) we can't perform any checks, abort. if ($line =~ /^Build-Depends: .*\bhardening-wrapper\b/) {