No longer check for "gnat" and "gfortran" packages as dependency.
Instead, apply the special handling unconditionally. This might be
slightly slower but permits running blhc on Ada/Fortran build logs which
provide no information about dependencies (e.g. when running just
dpkg-buildpackage).
t/logs/empty
t/logs/false-positives
t/logs/fortran
+t/logs/fortran-no-build-deps
t/logs/g++
t/logs/gcc
t/logs/good
by Ross Vandegrift, patch from Mathieu Parent (Debian bug #929503).
- Fix false positive in non-verbose check for python setuptools; reported by
Simon McVittie (Debian Bug #930993).
+- Fix special handling of format CFLAGS for Ada/Fortran with build logs not
+ generated pbuilder/sbuild (pbuilder and sbuild provide build dependencies
+ but other do not); reported by Christoph Berg and Rafael Laboissière (Debian
+ bug #924387).
Version 0.09
my $harden_bindnow = $option_bindnow; # defaults to 0
my $harden_pie = $option_pie; # defaults to 0
- # Does this build log use ada? Ada also uses gcc as compiler but uses
- # different CFLAGS. But only perform ada checks if an ada compiler is used
- # for performance reasons.
- my $ada = 0;
- # Fortran also requires different CFLAGS.
- my $fortran = 0;
-
# Number of parallel jobs to prevent false positives when detecting
# non-verbose builds. As not all jobs declare the number of parallel jobs
# use a large enough default.
}
next FILE;
}
-
- # Ada compiler.
- if ($line =~ /\bgnat\b/) {
- $ada = 1;
- }
- # Fortran compiler.
- if ($line =~ /\bgfortran\b/) {
- $fortran = 1;
- }
}
# This flags is not always available, but if it is use it.
}
# Ada doesn't support format hardening flags, see #680117 for more
- # information. Same for fortran. Filter them out if either language is
- # used.
+ # information. Same for fortran.
my @cflags_backup;
- my @cflags_noformat;
- if (($ada or $fortran) and $harden_format) {
- @cflags_noformat = grep {
+ my @cflags_noformat = grep {
my $ok = 1;
foreach my $flag (@def_cflags_format) {
$ok = 0 if $_ eq $flag;
}
$ok;
} @cflags;
- }
# Hack to fix cppflags_fortify_broken() if --ignore-flag
# -D_FORTIFY_SOURCE=2 is used to ignore missing fortification. Only works
and extension_found(\%extensions_compile_cpp, @extensions)) {
$compile = 0;
$compile_cpp = 1;
- # Ada needs special CFLAGS, use them if only ada files are compiled.
- } elsif ($ada
- and extension_found(\%extensions_ada, @extensions)) {
+ # Ada needs special CFLAGS
+ } elsif (extension_found(\%extensions_ada, @extensions)) {
$restore_cflags = 1;
$preprocess = 0; # Ada uses no CPPFLAGS
@cflags_backup = @cflags;
@cflags = @cflags_noformat;
- # Same for fortran.
- } elsif ($fortran
- and extension_found(\%extensions_fortran, @extensions)) {
+ # Same for fortran
+ } elsif (extension_found(\%extensions_fortran, @extensions)) {
$restore_cflags = 1;
@cflags_backup = @cflags;
@cflags = @cflags_noformat;
--- /dev/null
+dpkg-buildpackage: source package fortran package
+
+gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 -Wl,-z,relro -o balls balls.f
+gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 -c -o quadric.o quadric.f
+gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 -c -o suv.o suv.f
+gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 \
+rastep.f quadric.o suv.o -Wl,-z,relro \
+-o rastep
+gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 -c -o render.o render.f
+gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 -fstack-protector-strong -o balls-without-ldflags balls.f
+
+mpifort -cpp -DDOUB -g -O2 -fdebug-prefix-map=/«PKGBUILDDIR»=. -c -o transform.o transform.f90
+
+# correct
+gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 -Wl,-z,relro -fstack-protector-strong -o balls balls.f
+mpifort -cpp -DDOUB -g -O2 -fdebug-prefix-map=/«PKGBUILDDIR»=. -fstack-protector-strong -c -o paste.o paste.f90
use strict;
use warnings;
-use Test::More tests => 238;
+use Test::More tests => 240;
sub is_blhc {
CFLAGS missing (-fstack-protector-strong): mpifort -cpp -DDOUB -g -O2 -fdebug-prefix-map=/«PKGBUILDDIR»=. -c -o transform.o transform.f90
';
+is_blhc 'fortran-no-build-deps', '', 8,
+ 'CFLAGS missing (-fstack-protector-strong): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 -Wl,-z,relro -o balls balls.f
+CFLAGS missing (-fstack-protector-strong): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 -c -o quadric.o quadric.f
+CFLAGS missing (-fstack-protector-strong): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 -c -o suv.o suv.f
+CFLAGS missing (-fstack-protector-strong): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 \ rastep.f quadric.o suv.o -Wl,-z,relro \ -o rastep
+CFLAGS missing (-fstack-protector-strong): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 -c -o render.o render.f
+LDFLAGS missing (-Wl,-z,relro): gfortran -g -w -O2 -Wtabs -ffixed-line-length-132 -fstack-protector-strong -o balls-without-ldflags balls.f
+CFLAGS missing (-fstack-protector-strong): mpifort -cpp -DDOUB -g -O2 -fdebug-prefix-map=/«PKGBUILDDIR»=. -c -o transform.o transform.f90
+';
+
# libtool