Added some code to peer into a data structure in Maemian/Schedule.pm. Also added the
[maemian] / nokia-lintian / debian / patches / 500-backport-1.23.22-checks-binaries.dpatch
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 500-backport-1.23.22-checks-binaries.dpatch by Eero Häkkinen <eero.hakkinen@nokia.com>
3 ##
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: Backported checks from lintian 1.23.22.
6
7 @DPATCH@
8 diff -urNad lintian-1.23.8~/checks/binaries lintian-1.23.8/checks/binaries
9 --- lintian-1.23.8~/checks/binaries     2004-07-07 20:17:54.000000000 +0000
10 +++ lintian-1.23.8/checks/binaries      2006-07-18 13:33:57.000000000 +0000
11 @@ -1,4 +1,4 @@
12 -# binaries -- lintian check script
13 +# binaries -- lintian check script -*- perl -*-
14  
15  # Copyright (C) 1998 Christian Schwarz and Richard Braakman
16  #
17 @@ -15,8 +15,8 @@
18  # You should have received a copy of the GNU General Public License
19  # along with this program.  If not, you can find it on the World Wide
20  # Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
21 -# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 -# MA 02111-1307, USA.
23 +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
24 +# MA 02110-1301, USA.
25  
26  package Lintian::binaries;
27  use strict;
28 @@ -38,6 +38,8 @@
29  my %NEEDED;
30  my %CXXABI;
31  my %OCAML;
32 +my %SONAME;
33 +my %KLIBC;
34  
35  # read architecture file
36  if (open(IN,"fields/architecture")) {
37 @@ -92,6 +94,9 @@
38             push @{$NEEDED{$file}}, $1;
39         } elsif (m/^\s*RPATH\s*(\S+)/o) {
40             $RPATH{$file} = $1;
41 +       } elsif (m/^\s*SONAME\s*(\S+)/o) {
42 +           $SONAME{$1} ||= [];
43 +           push @{$SONAME{$1}}, $file;
44         } elsif (m/^\s*\d+\s+\.comment\s+/o) {
45             $COMMENT{$file} = 1;
46         } elsif (m/^\s*\d+\s+\.note\s+/o) {
47 @@ -102,13 +107,57 @@
48             fail("file format not recognized for $1\nif you are checking non-i386 binaries, you'll need to install binutils-multiarch\n");
49         } elsif (m/^objdump: \.(.*?): Packed with UPX$/) {
50             tag "binary-file-compressed-with-upx", "$1";
51 +       } elsif (m/^objdump: \.(.*?): Invalid operation$/) {
52 +           tag "binary-with-bad-dynamic-table", "$file" unless $file =~ m%^\./usr/lib/debug/%;
53         } elsif (m/CXXABI/) {
54             $CXXABI{$file} = 1;
55 +       } elsif (m%Requesting program interpreter:\s+/lib/klibc-\S+\.so%) {
56 +           $KLIBC{$file} = 1;
57         }
58      }
59  }
60  close(IN);
61  
62 +# For the package naming check, filter out SONAMEs where all the files are
63 +# at paths other than /lib, /usr/lib, or /usr/X11R6/lib.  This avoids false
64 +# positives with plugins like Apache modules, which may have their own
65 +# SONAMEs but which don't matter for the purposes of this check.
66 +sub lib_soname_path {
67 +    my (@paths) = @_;
68 +    foreach my $path (@paths) {
69 +       return 1 if $path =~ m%^(\.?/)?lib/[^/]+$%;
70 +       return 1 if $path =~ m%^(\.?/)?usr/lib/[^/]+$%;
71 +       return 1 if $path =~ m%^(\.?/)?usr/X11R6/lib/[^/]+$%;
72 +    }
73 +    return 0;
74 +}
75 +my @sonames = grep { lib_soname_path (@{$SONAME{$_}}) } keys %SONAME;
76 +tag "several-sonames-in-same-package", "@sonames" if @sonames > 1;
77 +
78 +# try to identify transition strings
79 +my $base_pkg = $pkg;
80 +$base_pkg =~ s/c102\b//o;
81 +$base_pkg =~ s/c2a?\b//o;
82 +$base_pkg =~ s/\dg$//o;
83 +$base_pkg =~ s/-udeb$//o;
84 +$base_pkg =~ s/^lib64/lib/o;
85 +
86 +my $match_found = 0;
87 +foreach my $expected_name (@sonames) {
88 +    $expected_name =~ s/([0-9])\.so\./$1-/;
89 +    $expected_name =~ s/\.so(\.|$)//o;
90 +    $expected_name =~ s/_/-/o;
91 +
92 +    if ((lc($expected_name) eq $pkg)
93 +       || (lc($expected_name) eq $base_pkg)) {
94 +       $match_found = 1;
95 +       last;
96 +    }
97 +}
98 +
99 +tag "package-name-doesnt-match-sonames", "@sonames"
100 +    if @sonames && !$match_found;
101 +
102  # process all files in package
103  open(IN,"file-info") or fail("cannot find file-info for $type package $pkg");
104  while (<IN>) {
105 @@ -175,13 +224,14 @@
106      my %libc5_binary;
107      my @needed;
108      if (!exists($NEEDED{$file}) && !defined($NEEDED{$file})) {
109 -       if ($info =~ m/shared object/o) {
110 +       if ($info =~ m/shared object/o && $file !~ m#^\./usr/lib/debug/#) {
111             tag "shared-lib-without-dependency-information", "$file";
112         } else {
113             # Some exceptions: files in /boot, /usr/lib/debug/*, named *-static or
114             # *.static, or *-static as package-name.
115 -           use File::Basename;
116 -           next if (dirname($file) eq './boot');
117 +           next if ($file =~ m#^./boot/#);
118 +           # klibc binaries appear to be static.
119 +           next if ($KLIBC{$file});
120             # Location of debugging symbols:
121             next if ($file =~ m#^./usr/lib/debug/#);
122             next if ($file =~ /(\.|-)static$/);