[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 2.5.14-68-gc3f74e4



The following commit has been merged in the master branch:
commit 12ffe5d649d90d8ed7a5871ffc73084b6cb38aec
Author: Bastien ROUCARIÈS <roucaries.bastien@gmail.com>
Date:   Tue Jul 16 20:25:30 2013 +0200

    Fix object file with build-id debug or with compress debug section
    
    Object files are not checked if:
    - they have build-id debug file.
    - they have compress debug section.
    
    Check this and add test.
    
    [Niels Thykier]
    
    Reformat and suggestion
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/checks/binaries.pm b/checks/binaries.pm
index 924ebc8..8eaf70f 100644
--- a/checks/binaries.pm
+++ b/checks/binaries.pm
@@ -361,12 +361,13 @@ foreach my $file ($info->sorted_index) {
     }
 
     # Something other than detached debugging symbols in /usr/lib/debug paths.
-    if ($file =~ m,^usr/lib/debug/(?:lib\d*|s?bin|usr|opt|dev|emul)/,) {
+    if ($file =~ m,^usr/lib/debug/(?:lib\d*|s?bin|usr|opt|dev|emul|.build-id)/,) {
         if (scalar (@{ $objdump->{NEEDED} }) ) {
             tag 'debug-file-should-use-detached-symbols', $file;
         }
         tag 'debug-file-with-no-debug-symbols', $file
-            unless exists $objdump->{'SH'}->{'.debug_line'};
+            unless (exists $objdump->{'SH'}->{'.debug_line'}
+                    or exists $objdump->{'SH'}->{'.zdebug_line'});
     }
 
     # Detached debugging symbols directly in /usr/lib/debug.
diff --git a/t/tests/binaries-general/debian/Makefile b/t/tests/binaries-general/debian/Makefile
index 73446c0..c6271ac 100644
--- a/t/tests/binaries-general/debian/Makefile
+++ b/t/tests/binaries-general/debian/Makefile
@@ -1,4 +1,6 @@
 COMPILE:= $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
+# extract from readelf
+GETBUILDID:=./getbuildid
 
 all:
 	# rpath not matching any of the exceptions to the rpath checks
@@ -10,6 +12,8 @@ all:
 	$(COMPILE) -o basicshippedrpath basic.c -Wl,--rpath,/usr/share/foo
 	# static version of basic for debugging checks
 	$(COMPILE) -static -o basic.static basic.c
+	# version with debug
+	$(COMPILE) -o basicdebug -g3 -Wl,--build-id basic.c
 
 install:
 	install -d $(DESTDIR)/usr/share/foo/
@@ -21,6 +25,15 @@ install:
 	install -m 755 -c basiclibrpath $(DESTDIR)/usr/lib/foo/basiclibrpath
 	install -m 755 -c basicshippedrpath $(DESTDIR)/usr/lib/foo/basicshippedrpath
 	objcopy --only-keep-debug basic $(DESTDIR)/usr/lib/debug/basic
+	install -d "$(DESTDIR)/usr/lib/debug/.build-id/"`$(GETBUILDID) -s basicdebug`
+	install -m 755 -c basicdebug $(DESTDIR)/usr/share/foo/basicdebug
+	# force fake buildid in order to have tag matching ok (deadbeefdeadbeef)
+	install -d "$(DESTDIR)/usr/lib/debug/.build-id/de"
+	objcopy --compress-debug-sections basicdebug \
+		"$(DESTDIR)/usr/lib/debug/.build-id/de/deadbeefdeadbeef.debug"
+	install -d "$(DESTDIR)/usr/lib/debug/.build-id/"`$(GETBUILDID) -s basicdebug`
+	objcopy --compress-debug-sections --only-keep-debug basicdebug \
+		"$(DESTDIR)/usr/lib/debug/.build-id/"`$(GETBUILDID) -s basicdebug`"/"`$(GETBUILDID) -f basicdebug`.debug
 	cp basic.static $(DESTDIR)/usr/lib/debug/
 	# dh_strip attempts to play the smart guy if the ELF obj is executable.
 	cd $(DESTDIR)/usr/lib/debug/ && chmod -x basic basic.static
diff --git a/t/tests/binaries-general/debian/debian/rules b/t/tests/binaries-general/debian/debian/rules
new file mode 100644
index 0000000..c60cf8b
--- /dev/null
+++ b/t/tests/binaries-general/debian/debian/rules
@@ -0,0 +1,7 @@
+#!/usr/bin/make -f
+
+%:
+	dh $@
+
+override_dh_strip:
+	dh_strip -X usr/lib/debug
diff --git a/t/tests/binaries-general/debian/getbuildid b/t/tests/binaries-general/debian/getbuildid
new file mode 100755
index 0000000..0060d2b
--- /dev/null
+++ b/t/tests/binaries-general/debian/getbuildid
@@ -0,0 +1,30 @@
+#!/bin/sh
+# get build-id of binary
+
+set -e
+
+usage() {
+    echo "Usage: getbuildid [flag] file";
+    echo "       print build-id of an object file"
+    echo "flags:"
+    echo "  -f : full build-id (default)."
+    echo "  -s : short build-id aka the first two characters."
+}
+
+if test $# -lt 1; then usage; exit 77; fi
+if test $# -gt 3; then usage; exit 77; fi
+
+if test $# -eq 1; then
+ LC_ALL=C readelf -n "$1" |  grep -i 'Build Id:' | sed 's/.*:[[:blank:]]*\([[:digit:]|abcdef]*\).*/\1/g'
+else
+ case "x$1" in
+     'x-f')
+	LC_ALL=C readelf -n "$2" |  grep -i 'Build Id:' | sed 's/.*:[[:blank:]]*\([[:digit:]|abcdef]*\).*/\1/g' ;;
+     'x-s')
+	LC_ALL=C readelf -n "$2" |  grep -i 'Build Id:' | sed 's/.*:[[:blank:]]*\([[:digit:]|abcdef]\{2\}\).*/\1/g' ;;
+     *)
+	exit 2;
+ esac
+fi
+
+exit 0;
diff --git a/t/tests/binaries-general/desc b/t/tests/binaries-general/desc
index 0c51bd7..8b2d05e 100644
--- a/t/tests/binaries-general/desc
+++ b/t/tests/binaries-general/desc
@@ -8,5 +8,6 @@ Test-For:
  binary-compiled-with-profiling-enabled
  binary-or-shlib-defines-rpath
  debug-symbols-directly-in-usr-lib-debug
+ debug-file-should-use-detached-symbols
  debug-file-with-no-debug-symbols
  library-in-debug-or-profile-should-not-be-stripped
diff --git a/t/tests/binaries-general/tags b/t/tests/binaries-general/tags
index e795381..d3481fa 100644
--- a/t/tests/binaries-general/tags
+++ b/t/tests/binaries-general/tags
@@ -1,8 +1,10 @@
 E: binaries-general: arch-dependent-file-in-usr-share usr/share/foo/basic
+E: binaries-general: arch-dependent-file-in-usr-share usr/share/foo/basicdebug
 E: binaries-general: binary-or-shlib-defines-rpath usr/lib/foo/basiclibrpath /usr/lib
 E: binaries-general: binary-or-shlib-defines-rpath usr/share/foo/basic /usr/local/lib
 E: binaries-general: debug-symbols-directly-in-usr-lib-debug usr/lib/debug/basic
 E: binaries-general: library-in-debug-or-profile-should-not-be-stripped usr/lib/debug/usr/share/foo/basic
 W: binaries-general: binary-compiled-with-profiling-enabled usr/share/foo/basic
+W: binaries-general: debug-file-should-use-detached-symbols usr/lib/debug/.build-id/de/deadbeefdeadbeef.debug
 W: binaries-general: debug-file-with-no-debug-symbols usr/lib/debug/usr/share/foo/basic
-W: binaries-general: debug-package-should-be-named-dbg usr/lib/debug/basic
+W: binaries-general: debug-package-should-be-named-dbg usr/lib/debug/.build-id/

-- 
Debian package checker


Reply to: