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

lintian: r1312 - in trunk: checks debian



Author: djpig
Date: 2008-05-20 03:11:59 +0200 (Tue, 20 May 2008)
New Revision: 1312

Modified:
   trunk/checks/binaries
   trunk/debian/changelog
Log:
* checks/binaries:
  + Ignore rpaths to directories present in the same binary
    package.  Also ignore $ORIGIN since that obviously fulfills
    that criterion.  (Closes: #480636)


Modified: trunk/checks/binaries
===================================================================
--- trunk/checks/binaries	2008-05-20 00:07:17 UTC (rev 1311)
+++ trunk/checks/binaries	2008-05-20 01:11:59 UTC (rev 1312)
@@ -23,6 +23,8 @@
 use Tags;
 use Util;
 
+use File::Basename;
+
 sub run {
 
 my $pkg = shift;
@@ -88,7 +90,9 @@
 	if (m/^\s*NEEDED\s*(\S+)/o) {
 	    push @{$NEEDED{$file}}, $1;
 	} elsif (m/^\s*RPATH\s*(\S+)/o) {
-	    $RPATH{$file} = $1;
+	    foreach (split m/:/, $1) {
+		$RPATH{$file}{$_}++;
+	    }
 	} elsif (m/^\s*SONAME\s*(\S+)/o) {
 	    $SONAME{$1} ||= [];
 	    push @{$SONAME{$1}}, $file;
@@ -158,6 +162,24 @@
 tag "package-name-doesnt-match-sonames", "@sonames"
     if @sonames && !$match_found;
 
+my %directories;
+open(IN, '<', "index") or fail("cannot open index file index: $!");
+while (<IN>) {
+    chomp;
+    next unless /^[dl]/;
+    my $dir = (split(' ', $_, 6))[-1];
+    $dir =~ s,^\./,/,;
+    $dir =~ s,/+$,,;
+    $dir =~ s/ link to .*//;
+    $dir =~ s/ -> .*//;
+
+    $directories{$dir}++;
+}
+close IN;
+
+#use Data::Dumper;
+#warn Dumper(\%directories);
+
 # process all files in package
 open(IN,, '<', "file-info")
     or fail("cannot find file-info for $type package $pkg");
@@ -217,10 +239,13 @@
     }
 
     # rpath is disallowed, except in private directories
-    if (exists $RPATH{$file} &&
-        grep { !m,^/usr/lib/(games/)?\Q$pkg\E(?:/|\z), } split(/:/, $RPATH{$file})
-       ) {
-	tag "binary-or-shlib-defines-rpath", "$file $RPATH{$file}";
+    if (exists $RPATH{$file}) {
+	foreach my $rpath (keys %{$RPATH{$file}}) {
+	    next if $rpath =~ m,^/usr/lib/(games/)?\Q$pkg\E(?:/|\z),;
+	    next if $rpath =~ m,^\$ORIGIN$,;
+	    next if $directories{$rpath};
+	    tag "binary-or-shlib-defines-rpath", "$file $rpath";
+	}
     }
 
     # binary or shared object?

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2008-05-20 00:07:17 UTC (rev 1311)
+++ trunk/debian/changelog	2008-05-20 01:11:59 UTC (rev 1312)
@@ -1,5 +1,9 @@
 lintian (1.23.49) UNRELEASED; urgency=low
 
+  * checks/binaries:
+    + [FL] Ignore rpaths to directories present in the same binary
+      package.  Also ignore $ORIGIN since that obviously fulfills
+      that criterion.  (Closes: #480636)
   * checks/copyright-file{,.desc}:
     + [FL] Implement new check for dh-make-perl boilerplate.
   * checks/debhelper:


Reply to: