]> ruderich.org/simon Gitweb - blhc/blhc.git/commitdiff
Fix architecture detection with recent dpkg-buildpackage versions
authorMathieu Parent <math.parent@gmail.com>
Sat, 24 Aug 2019 09:52:10 +0000 (11:52 +0200)
committerSimon Ruderich <simon@ruderich.org>
Sat, 24 Aug 2019 09:52:10 +0000 (11:52 +0200)
[sr: Taken from patch in Debian package 0.09-2 and modified slightly;
added a test.]

NEWS
bin/blhc
t/logs/dpkg-buildpackage-architecture-new [new file with mode: 0644]
t/tests.t

diff --git a/NEWS b/NEWS
index 89b39063a89ec726acc94fa61397fdebb6e7fb7e..d550adc764d6aec13ef2aca07be7e63e51b9d248 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ Version 0.XX
 ------------
 
 - Sync architecture specific hardening support with dpkg 1.19.7.
 ------------
 
 - Sync architecture specific hardening support with dpkg 1.19.7.
+- Fix architecture detection with recent dpkg-buildpackage versions; reported
+  by Ross Vandegrift, patch from Mathieu Parent (Debian bug #929503).
 
 
 Version 0.09
 
 
 Version 0.09
index 17944127a9e1f60db42761790ca44797f6724f55..43000271861b6512d66543e6104361a9d9f15736 100755 (executable)
--- a/bin/blhc
+++ b/bin/blhc
@@ -954,6 +954,10 @@ foreach my $file (@ARGV) {
 
         # Detect architecture automatically unless overridden.
         if (not $arch
 
         # Detect architecture automatically unless overridden.
         if (not $arch
+                and index($line, 'dpkg-buildpackage: info: host architecture ') == 0) {
+            $arch = substr $line, 43, -1; # -1 to ignore '\n' at the end
+        # Older versions of dpkg-buildpackage
+        } elsif (not $arch
                 and index($line, 'dpkg-buildpackage: host architecture ') == 0) {
             $arch = substr $line, 37, -1; # -1 to ignore '\n' at the end
 
                 and index($line, 'dpkg-buildpackage: host architecture ') == 0) {
             $arch = substr $line, 37, -1; # -1 to ignore '\n' at the end
 
diff --git a/t/logs/dpkg-buildpackage-architecture-new b/t/logs/dpkg-buildpackage-architecture-new
new file mode 100644 (file)
index 0000000..bfcdf49
--- /dev/null
@@ -0,0 +1,5 @@
+dpkg-buildpackage: info: source package test
+dpkg-buildpackage: info: host architecture ia64
+
+gcc -D_FORTIFY_SOURCE=2 -g -O2 -fPIE -Wformat -Wformat-security -Werror=format-security -Wall -c test.c
+gcc -fPIE -pie -o test test.o
index b40bb1b8bd1a01305cccf53d7979dcd5ce8b25ae..2e2b9d7eb119d21f1aa059cf1a813d508a8b2ff6 100644 (file)
--- a/t/tests.t
+++ b/t/tests.t
@@ -19,7 +19,7 @@
 use strict;
 use warnings;
 
 use strict;
 use warnings;
 
-use Test::More tests => 236;
+use Test::More tests => 238;
 
 
 sub is_blhc {
 
 
 sub is_blhc {
@@ -857,6 +857,11 @@ LDFLAGS missing (-pie -Wl,-z,relro): gcc -fPIE -o test test.o
 is_blhc 'dpkg-buildpackage-architecture-old', '', 0,
         '';
 
 is_blhc 'dpkg-buildpackage-architecture-old', '', 0,
         '';
 
+# architecture in newer buildd logs
+
+is_blhc 'dpkg-buildpackage-architecture-new', '', 0,
+        '';
+
 
 # correct architecture detection
 
 
 # correct architecture detection