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

[lintian] 01/01: c/binaries: Make a separat unneeded sections tag for static libs



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit 56029753f11c2db7fa2df75045c126b24d4d358c
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Jun 20 12:40:51 2015 +0200

    c/binaries: Make a separat unneeded sections tag for static libs
    
    Apparently, OCaml (and others?) is storing bytecode in the .comment
    section of its binaries.  To avoid blind "shoot yourself in the
    foot"-behaviour, make the tag experimental and rewrite the
    description.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 checks/binaries.desc             | 10 ++++++++++
 checks/binaries.pm               | 10 ++++++----
 t/tests/binaries-static-lib/desc |  2 +-
 t/tests/binaries-static-lib/tags |  6 +++---
 t/tests/legacy-libbaz/tags       | 12 ++++++------
 5 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/checks/binaries.desc b/checks/binaries.desc
index 280aee4..a44a561 100644
--- a/checks/binaries.desc
+++ b/checks/binaries.desc
@@ -97,6 +97,16 @@ Info: The binary or shared library is stripped, but still contains a
  <tt>dh_strip</tt> will do this automatically for you, but
  <tt>install -s</tt> not because it calls strip without any arguments.
 
+Tag: static-library-has-unneeded-section
+Severity: wishlist
+Certainty: certain
+Experimental: yes
+Info: Tag for tallying static libraries ".comment" sections.
+ .
+ Be advised that some languages (e.g. OCaml) stores bytecode in the
+ ".comment" section and you should therefore <i>not</i> blindly
+ strip this section.
+
 Tag: missing-depends-line
 Severity: normal
 Certainty: certain
diff --git a/checks/binaries.pm b/checks/binaries.pm
index aa7578e..8134475 100644
--- a/checks/binaries.pm
+++ b/checks/binaries.pm
@@ -306,7 +306,8 @@ sub run {
                 # Shouldn't happen, but...
                 fail("object ($file $obj) in static lib is missing!?")
                   unless defined $libobj;
-                tag_unneeded_sections("${file}(${obj})", $libobj);
+                tag_unneeded_sections('static-library-has-unneeded-section',
+                    "${file}(${obj})", $libobj);
             }
         }
 
@@ -378,7 +379,8 @@ sub run {
                 tag 'library-in-debug-or-profile-should-not-be-stripped',$file;
             } else {
                 # appropriately stripped, but is it stripped enough?
-                tag_unneeded_sections($file, $objdump);
+                tag_unneeded_sections('binary-has-unneeded-section', $file,
+                    $objdump);
             }
         }
 
@@ -611,10 +613,10 @@ sub run {
 }
 
 sub tag_unneeded_sections {
-    my ($file, $objdump) = @_;
+    my ($tag, $file, $objdump) = @_;
     foreach my $sect ('.note', '.comment') {
         if (exists $objdump->{'SH'}->{$sect}) {
-            tag 'binary-has-unneeded-section', "$file $sect";
+            tag $tag, "$file $sect";
         }
     }
     return;
diff --git a/t/tests/binaries-static-lib/desc b/t/tests/binaries-static-lib/desc
index c2a69b6..0e4ed29 100644
--- a/t/tests/binaries-static-lib/desc
+++ b/t/tests/binaries-static-lib/desc
@@ -3,4 +3,4 @@ Sequence: 6000
 Version: 1.0-1
 Type: non-native
 Description: Test checks related to static libs
-Test-For: binary-has-unneeded-section
+Test-For: static-library-has-unneeded-section
diff --git a/t/tests/binaries-static-lib/tags b/t/tests/binaries-static-lib/tags
index abea104..85c413f 100644
--- a/t/tests/binaries-static-lib/tags
+++ b/t/tests/binaries-static-lib/tags
@@ -1,3 +1,3 @@
-I: libfoo-dev: binary-has-unneeded-section usr/lib/libbar.a(pstripped.o) .comment
-I: libfoo-dev: binary-has-unneeded-section usr/lib/libfoo.a(code.o) .comment
-I: libfoo-dev: binary-has-unneeded-section usr/lib/libfoo.a(other.o) .comment
+X: libfoo-dev: static-library-has-unneeded-section usr/lib/libbar.a(pstripped.o) .comment
+X: libfoo-dev: static-library-has-unneeded-section usr/lib/libfoo.a(code.o) .comment
+X: libfoo-dev: static-library-has-unneeded-section usr/lib/libfoo.a(other.o) .comment
diff --git a/t/tests/legacy-libbaz/tags b/t/tests/legacy-libbaz/tags
index fe143e8..95dba83 100644
--- a/t/tests/legacy-libbaz/tags
+++ b/t/tests/legacy-libbaz/tags
@@ -27,15 +27,9 @@ E: libbaz2: debian-changelog-file-missing-or-wrong-name
 I: libbaz1-dev: binary-has-unneeded-section usr/lib/ma-dir/perl/version/auto/Foo/Foo.so .comment
 I: libbaz1-dev: no-md5sums-control-file
 I: libbaz1-dev: package-contains-empty-directory usr/include/
-I: libbaz1: binary-has-unneeded-section usr/lib/libbaz1.a(baz.sho) .comment
-I: libbaz1: binary-has-unneeded-section usr/lib/libbaz1.a(extra.sho) .comment
-I: libbaz1: binary-has-unneeded-section usr/lib/libbaz2.a(baz.o) .comment
-I: libbaz1: binary-has-unneeded-section usr/lib/libbaz2.a(extra.o) .comment
 I: libbaz1: binary-has-unneeded-section usr/lib/ma-dir/perl/version/auto/Foo/Foo.so .comment
 I: libbaz1: no-md5sums-control-file
 I: libbaz2-dbg: no-md5sums-control-file
-I: libbaz2-dev: binary-has-unneeded-section usr/lib/libbaz2.a(baz.o) .comment
-I: libbaz2-dev: binary-has-unneeded-section usr/lib/libbaz2.a(extra.o) .comment
 I: libbaz2-dev: no-md5sums-control-file
 I: libbaz2: no-md5sums-control-file
 I: libbaz2: no-symbols-control-file usr/lib/libbaz2.so.1.0.3b
@@ -83,4 +77,10 @@ W: libbaz2: package-name-doesnt-match-sonames libbaz2-1.0
 W: libbaz2: symlink-should-be-relative usr/share/doc/libbaz2/changelog.gz /usr/share/doc/lintian/changelog.gz
 X: libbaz1: package-contains-broken-symlink usr/lib/libfoo.so.0.9 libfoo.so.0.9.1
 X: libbaz1: package-contains-broken-symlink usr/lib/libfoo3.so libfoo3.so.0.9
+X: libbaz1: static-library-has-unneeded-section usr/lib/libbaz1.a(baz.sho) .comment
+X: libbaz1: static-library-has-unneeded-section usr/lib/libbaz1.a(extra.sho) .comment
+X: libbaz1: static-library-has-unneeded-section usr/lib/libbaz2.a(baz.o) .comment
+X: libbaz1: static-library-has-unneeded-section usr/lib/libbaz2.a(extra.o) .comment
+X: libbaz2-dev: static-library-has-unneeded-section usr/lib/libbaz2.a(baz.o) .comment
+X: libbaz2-dev: static-library-has-unneeded-section usr/lib/libbaz2.a(extra.o) .comment
 X: libbaz2: package-contains-broken-symlink usr/share/doc/libbaz2/changelog.gz usr/share/doc/lintian/changelog.gz

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: