Package: lintian Version: 2.5.13 control: tags -1 + patch Ok joined here the patches.
I have added some news test
From e953bf71de0e6e2c5b8c4cab608bd01354af6462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastien=20ROUCARI=C3=88S?= <[email protected]> Date: Tue, 16 Jul 2013 20:25:30 +0200 Subject: [PATCH 1/3] [PATCH] 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 --- checks/binaries.pm | 5 +++-- t/tests/binaries-general/debian/Makefile | 13 +++++++++++++ t/tests/binaries-general/debian/debian/rules | 7 +++++++ t/tests/binaries-general/desc | 1 + t/tests/binaries-general/tags | 4 +++- 5 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 t/tests/binaries-general/debian/debian/rules 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/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/ -- 1.7.10.4
From b338b08dd69cc8bc257f15d2de1068d5f971b9c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastien=20ROUCARI=C3=88S?= <[email protected]> Date: Tue, 16 Jul 2013 21:20:36 +0200 Subject: [PATCH 2/3] Test for unstripped-binary-or-object --- t/tests/binaries-general/debian/Makefile | 13 ++++++++----- t/tests/binaries-general/debian/debian/rules | 2 +- t/tests/binaries-general/desc | 2 ++ t/tests/binaries-general/tags | 2 ++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/t/tests/binaries-general/debian/Makefile b/t/tests/binaries-general/debian/Makefile index c6271ac..a2165db 100644 --- a/t/tests/binaries-general/debian/Makefile +++ b/t/tests/binaries-general/debian/Makefile @@ -16,12 +16,15 @@ all: $(COMPILE) -o basicdebug -g3 -Wl,--build-id basic.c install: + # according to local debian rules /usr/lib/debug is unstripped install -d $(DESTDIR)/usr/share/foo/ - install -m 755 -c basic $(DESTDIR)/usr/share/foo/basic install -d $(DESTDIR)/usr/lib/debug/usr/share/foo/ + install -d $(DESTDIR)/usr/lib/foo/ + install -d $(DESTDIR)/usr/bin + + install -m 755 -c basic $(DESTDIR)/usr/share/foo/basic objcopy --only-keep-debug basic $(DESTDIR)/usr/lib/debug/usr/share/foo/basic strip -s $(DESTDIR)/usr/lib/debug/usr/share/foo/basic - install -d $(DESTDIR)/usr/lib/foo/ 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 @@ -34,9 +37,9 @@ install: 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 + install -m 755 -c basic.static $(DESTDIR)/usr/lib/debug/ + # according to local debian rules unstripped in name avoit dh_strip to do the work + install -m 755 basicdebug $(DESTDIR)/usr/bin/unstripped clean distclean: rm -f basic diff --git a/t/tests/binaries-general/debian/debian/rules b/t/tests/binaries-general/debian/debian/rules index c60cf8b..37608c2 100644 --- a/t/tests/binaries-general/debian/debian/rules +++ b/t/tests/binaries-general/debian/debian/rules @@ -4,4 +4,4 @@ dh $@ override_dh_strip: - dh_strip -X usr/lib/debug + dh_strip -X usr/lib/debug -X unstripped diff --git a/t/tests/binaries-general/desc b/t/tests/binaries-general/desc index 8b2d05e..bae4bde 100644 --- a/t/tests/binaries-general/desc +++ b/t/tests/binaries-general/desc @@ -11,3 +11,5 @@ Test-For: debug-file-should-use-detached-symbols debug-file-with-no-debug-symbols library-in-debug-or-profile-should-not-be-stripped + unstripped-binary-or-object + diff --git a/t/tests/binaries-general/tags b/t/tests/binaries-general/tags index d3481fa..ab2e298 100644 --- a/t/tests/binaries-general/tags +++ b/t/tests/binaries-general/tags @@ -4,7 +4,9 @@ E: binaries-general: binary-or-shlib-defines-rpath usr/lib/foo/basiclibrpath /us 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 +E: binaries-general: unstripped-binary-or-object usr/bin/unstripped W: binaries-general: binary-compiled-with-profiling-enabled usr/share/foo/basic +W: binaries-general: binary-without-manpage usr/bin/unstripped 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/.build-id/ -- 1.7.10.4
From 7132f61db231e5e944eeb3ccfd11423f9ce9e9b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastien=20ROUCARI=C3=88S?= <[email protected]> Date: Tue, 16 Jul 2013 21:25:38 +0200 Subject: [PATCH 3/3] Test tag statically-linked-binary --- t/tests/binaries-general/debian/Makefile | 1 + t/tests/binaries-general/desc | 1 + t/tests/binaries-general/tags | 2 ++ 3 files changed, 4 insertions(+) diff --git a/t/tests/binaries-general/debian/Makefile b/t/tests/binaries-general/debian/Makefile index a2165db..718546b 100644 --- a/t/tests/binaries-general/debian/Makefile +++ b/t/tests/binaries-general/debian/Makefile @@ -40,6 +40,7 @@ install: install -m 755 -c basic.static $(DESTDIR)/usr/lib/debug/ # according to local debian rules unstripped in name avoit dh_strip to do the work install -m 755 basicdebug $(DESTDIR)/usr/bin/unstripped + install -m 755 basic.static $(DESTDIR)/usr/bin/static clean distclean: rm -f basic diff --git a/t/tests/binaries-general/desc b/t/tests/binaries-general/desc index bae4bde..69fb151 100644 --- a/t/tests/binaries-general/desc +++ b/t/tests/binaries-general/desc @@ -11,5 +11,6 @@ Test-For: debug-file-should-use-detached-symbols debug-file-with-no-debug-symbols library-in-debug-or-profile-should-not-be-stripped + statically-linked-binary unstripped-binary-or-object diff --git a/t/tests/binaries-general/tags b/t/tests/binaries-general/tags index ab2e298..75c0aae 100644 --- a/t/tests/binaries-general/tags +++ b/t/tests/binaries-general/tags @@ -4,8 +4,10 @@ E: binaries-general: binary-or-shlib-defines-rpath usr/lib/foo/basiclibrpath /us 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 +E: binaries-general: statically-linked-binary usr/bin/static E: binaries-general: unstripped-binary-or-object usr/bin/unstripped W: binaries-general: binary-compiled-with-profiling-enabled usr/share/foo/basic +W: binaries-general: binary-without-manpage usr/bin/static W: binaries-general: binary-without-manpage usr/bin/unstripped 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 -- 1.7.10.4

