Patch review for objdump fixes around debugging data
Hello folks,
I ran into #249435 while building a debugging package for one of my
packages and decided to take some time to fix it.
This is the largest patch I've written for lintian so far and it includes
a new test suite package, so I'd rather someone else look it over before I
just commit it. Could someone take a look when you get a chance and let
me know if it's sane?
Thanks!
Index: debian/changelog
===================================================================
--- debian/changelog (revision 561)
+++ debian/changelog (working copy)
@@ -1,5 +1,9 @@
lintian (1.23.16) UNRELEASED; urgency=low
+ * checks/binaries{.desc,}:
+ + [RA] Add a check for the new "Invalid operation" error from
+ objdump -T. Skip shared-lib-without-dependency-information for
+ files in /usr/lib/debug.
* checks/changelog-file:
+ [FL] Add line number to output of wrong-bug-number-in-closes.
Inspired by #349761 from Steinar H. Gunderson.
@@ -28,6 +32,10 @@
+ [JvW] Fix postinst-must-call-ldconfig to also get emitted when there is
no postinst at all, instead of just one lacking a ldconfig call
+ * collection/objdump-info:
+ + [RA] Pass "Invalid operation" errors from objdump -T on to the check
+ scripts instead of failing. (Closes: #249435)
+
* testset/runtests:
+ [RA] Filter out dpkg-source warnings about unsigned source packages.
Index: checks/binaries
===================================================================
--- checks/binaries (revision 560)
+++ checks/binaries (working copy)
@@ -106,6 +106,8 @@
fail("file format not recognized for $1\nif you are checking non-i386 binaries, you'll need to install binutils-multiarch\n");
} elsif (m/^objdump: \.(.*?): Packed with UPX$/) {
tag "binary-file-compressed-with-upx", "$1";
+ } elsif (m/^objdump: \.(.*?): Invalid operation$/) {
+ tag "binary-with-bad-dynamic-table", "$file" unless $file =~ m%^\./usr/lib/debug/%;
} elsif (m/CXXABI/) {
$CXXABI{$file} = 1;
}
@@ -219,7 +221,7 @@
my %libc5_binary;
my @needed;
if (!exists($NEEDED{$file}) && !defined($NEEDED{$file})) {
- if ($info =~ m/shared object/o) {
+ if ($info =~ m/shared object/o && $file !~ m#^\./usr/lib/debug/#) {
tag "shared-lib-without-dependency-information", "$file";
} else {
# Some exceptions: files in /boot, /usr/lib/debug/*, named *-static or
Index: checks/binaries.desc
===================================================================
--- checks/binaries.desc (revision 560)
+++ checks/binaries.desc (working copy)
@@ -139,3 +139,9 @@
.
$ objdump -p /path/to/libfoo-bar.so.1.2.3 | sed -n -e's/^[[:space:]]*SONAME[[:space:]]*//p' | sed -e's/\([0-9]\)\.so\./\1-/; s/\.so\.//'
Ref: Library Packaging guide 5
+
+Tag: binary-with-bad-dynamic-table
+Type: error
+Info: This appears to be an ELF file but objdump -T cannot parse it.
+ If it is external debugging symbols for another file, it should be
+ installed under /usr/lib/debug.
Index: collection/objdump-info
===================================================================
--- collection/objdump-info (revision 560)
+++ collection/objdump-info (working copy)
@@ -46,7 +46,19 @@
if head $bin | grep -q 'packed.*with.*UPX'; then
echo "objdump: $bin: Packed with UPX" >> ../objdump-info
else
- objdump --headers --private-headers -T $bin >> ../objdump-info 2>&1
+ if objdump --headers --private-headers -T $bin >> ../objdump-info 2>&1 ; then
+ # everything is ok
+ :
+ else
+ # If the objdump error is "Invalid operation", we handle it later
+ # in the check script, since this is the expected output (for now)
+ # on detached debugging information in /usr/lib/debug.
+ if objdump -T $bin 2>&1 | grep -q 'Invalid operation$' ; then
+ :
+ else
+ exit 1
+ fi
+ fi
fi
done
Index: testset/tags.debug
===================================================================
--- testset/tags.debug (revision 0)
+++ testset/tags.debug (revision 0)
@@ -0,0 +1,7 @@
+E: hello: statically-linked-binary ./usr/bin/hello.dbg
+E: hello: unstripped-binary-or-object ./usr/bin/hello.dbg
+E: libhello0-dbg: binary-with-bad-dynamic-table ./usr/lib/libhello.so.dbg
+E: libhello0-dbg: sharedobject-in-library-directory-not-actually-a-shlib usr/lib/libhello.so.dbg
+W: hello: binary-without-manpage hello
+W: hello: binary-without-manpage hello.dbg
+W: libhello0-dbg: shared-lib-without-dependency-information ./usr/lib/libhello.so.dbg
Index: testset/debug/libhello.h
===================================================================
--- testset/debug/libhello.h (revision 0)
+++ testset/debug/libhello.h (revision 0)
@@ -0,0 +1 @@
+void hello(void);
Index: testset/debug/debian/control
===================================================================
--- testset/debug/debian/control (revision 0)
+++ testset/debug/debian/control (revision 0)
@@ -0,0 +1,34 @@
+Source: debug
+Section: utils
+Priority: optional
+Maintainer: Russ Allbery <rra@debian.org>
+Build-Depends: debhelper (>= 5.0.0)
+Standards-Version: 3.6.2
+
+Package: hello
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Test for external debugging information
+ lintian regression test for external debugging file handling.
+
+Package: hello-dbg
+Priority: extra
+Architecture: any
+Depends: hello (= ${Source-Version}), ${shlibs:Depends}, ${misc:Depends}
+Description: Test for external debugging information
+ lintian regression test for external debugging file handling.
+
+Package: libhello0
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Test for external debugging information
+ lintian regression test for external debugging file handling.
+
+Package: libhello0-dbg
+Section: libdevel
+Priority: extra
+Architecture: any
+Depends: libhello (= ${Source-Version}), ${shlibs:Depends}, ${misc:Depends}
+Description: Test for external debugging information
+ lintian regression test for external debugging file handling.
Index: testset/debug/debian/changelog
===================================================================
--- testset/debug/debian/changelog (revision 0)
+++ testset/debug/debian/changelog (revision 0)
@@ -0,0 +1,6 @@
+debug (1.0) unstable; urgency=low
+
+ * Initial version.
+
+ -- Russ Allbery <rra@debian.org> Sat, 4 Mar 2006 21:31:06 -0800
+
Index: testset/debug/debian/copyright
===================================================================
--- testset/debug/debian/copyright (revision 0)
+++ testset/debug/debian/copyright (revision 0)
@@ -0,0 +1 @@
+Written Sat, 04 Mar 2006 21:30:01 -0800 by Russ Allbery <rra@debian.org>.
Index: testset/debug/debian/rules
===================================================================
--- testset/debug/debian/rules (revision 0)
+++ testset/debug/debian/rules (revision 0)
@@ -0,0 +1,62 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# This file is public domain software, originally written by Joey Hess.
+
+export DH_COMPAT := 5
+
+build: build-stamp
+build-stamp:
+ dh_testdir
+ gcc -D_REENTRANT -fPIC -c libhello.c
+ gcc -o libhello.so.0.0 -shared -Wl,-soname,libhello.so.0 libhello.o
+ ln -s libhello.so.0.0 libhello.so
+ gcc -o hello hello.c -L. -lhello
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp *.o libhello.so.0.0
+ dh_clean
+
+install: build-stamp
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ install -D hello $(CURDIR)/debian/hello/usr/bin/hello
+ install -D libhello.so.0.0 \
+ $(CURDIR)/debian/libhello0/usr/lib/libhello.so.0.0
+ ln -s libhello.so.0.0 \
+ $(CURDIR)/debian/libhello0/usr/lib/libhello.so.0
+
+# Build architecture-dependent files here.
+export DH_OPTIONS
+binary-arch: DH_OPTIONS=-a
+binary-arch: build-stamp install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs
+ dh_installdocs
+ DH_OPTIONS= dh_strip -phello --dbg-package=hello-dbg
+ DH_OPTIONS= dh_strip -plibhello0 --dbg-package=libhello0-dbg
+
+ # Now break a few things. Copy the debugging data into places it
+ # shouldn't be.
+ cp $(CURDIR)/debian/hello-dbg/usr/lib/debug/usr/bin/hello \
+ $(CURDIR)/debian/hello/usr/bin/hello.dbg
+ cp $(CURDIR)/debian/libhello0-dbg/usr/lib/debug/usr/lib/libhello.so.0.0 \
+ $(CURDIR)/debian/libhello0-dbg/usr/lib/libhello.so.dbg
+
+ dh_link
+ dh_compress
+ dh_fixperms
+ dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary-indep:
+binary: binary-indep binary-arch
+.PHONY: binary binary-indep binary-arch build clean install
Property changes on: testset/debug/debian/rules
___________________________________________________________________
Name: svn:executable
+ *
Index: testset/debug/hello.c
===================================================================
--- testset/debug/hello.c (revision 0)
+++ testset/debug/hello.c (revision 0)
@@ -0,0 +1,9 @@
+#include <stdlib.h>
+#include "libhello.h"
+
+int
+main(void)
+{
+ hello();
+ exit(0);
+}
Index: testset/debug/libhello.c
===================================================================
--- testset/debug/libhello.c (revision 0)
+++ testset/debug/libhello.c (revision 0)
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+void
+hello(void)
+{
+ printf("Hello, World!\n");
+}
--
Russ Allbery (rra@debian.org) <http://www.eyrie.org/~eagle/>
Reply to: