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

[SCM] Debian package checker branch, master, updated. 2.5.6-103-gf17fccd



The following commit has been merged in the master branch:
commit f17fccd274fa623e0d9a4479599cdb8bdc9e391e
Author: Niels Thykier <niels@thykier.net>
Date:   Mon Apr 16 09:26:09 2012 +0200

    c/shared-libs: Break out of SONAME branch earlier for symlinks
    
    Re-order to checking if a symlink or file "needs ldconfig" to be run.
    Once this has been determined, symlinks only causes duplicate warnings
    and is therefore skipped.
    
    The checking of symlinks was added in commit ae2ef04a to avoid
    false-positive "*-useless-call-to-ldconfig".
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/checks/shared-libs b/checks/shared-libs
index aab7d4f..6730b55 100644
--- a/checks/shared-libs
+++ b/checks/shared-libs
@@ -90,18 +90,28 @@ for my $cur_file (@{$info->sorted_index}) {
     if (exists $SONAME{$cur_file} or
         (defined $cur_file_data->{link} and exists $SONAME{abs_path(dirname($cur_file).'/'.$cur_file_data->{link})})) {
         # yes!!
-        my ($real_file, $real_perm);
-        if ($SONAME{$cur_file}) {
+        my ($real_file, $perm);
+        if (exists $SONAME{$cur_file}) {
             $real_file = $cur_file;
-            $real_perm = $cur_file_data->{operm};
+            $perm = $cur_file_data->{operm};
         } else {
             $real_file = abs_path(dirname($cur_file).'/'.$cur_file_data->{link});
-            $real_perm = $info->index->{$real_file}->{operm} || $cur_file_data->{operm};
+            # perm not needed for this branch
         }
 
+        # Installed in a directory controlled by the dynamic linker?  We have
+        # to strip off directories named for hardware capabilities.
+        if (needs_ldconfig ($cur_file)) {
+            # yes! so postinst must call ldconfig
+            $must_call_ldconfig = $real_file;
+        }
+        # At this point, we do not want to process symlinks as they will only
+        # lead to duplicate warnings.
+        next unless $cur_file eq $real_file;
+
         # Now that we're sure this is really a shared library, report on
         # non-PIC problems.
-        if ($cur_file eq $real_file and $objdump->{$cur_file}->{TEXTREL}) {
+        if ($objdump->{$cur_file}->{TEXTREL}) {
             tag 'shlib-with-non-pic-code', $cur_file;
         }
 
@@ -111,55 +121,34 @@ for my $cur_file (@{$info->sorted_index}) {
             # a SONAME (hi openjdk-6, see #614305).  Also see the comment
             # for "shlib-with-executable-bit" below.
             tag 'shlib-calls-exit', $cur_file
-                unless ($objdump->{$real_file}->{INTERP});
-        }
-
-        # Don't apply the permission checks to links since this only results
-        # in doubled messages.
-        if ($cur_file eq $real_file) {
-            # executable?
-            my $perms = sprintf('%04o', $real_perm);
-            if ($real_perm & 0111) {
-                # Yes.  But if the library has an INTERP section, it's
-                # designed to do something useful when executed, so don't
-                # report an error.  Also give ld.so a pass, since it's
-                # special.
-                tag 'shlib-with-executable-bit', $cur_file, $perms
-                    unless ($objdump->{$real_file}->{INTERP}
-                            or $real_file =~ m,^lib(|32|64)/ld-[\d.]+\.so$,);
-            } elsif ($real_perm != 0644) {
-                tag 'shlib-with-bad-permissions', $cur_file, $perms;
-            }
+                unless $objdump->{$cur_file}->{INTERP};
         }
 
-        # Installed in a directory controlled by the dynamic linker?  We have
-        # to strip off directories named for hardware capabilities.
-        my $dirname = dirname($cur_file);
-        my $last;
-        do {
-            $dirname =~ s%/([^/]+)$%%;
-            $last = $1;
-        } while ($last && $HWCAP_DIRS->known ($last));
-        $dirname .= "/$last" if $last;
-        if ($ldconfig_dirs->known($dirname)) {
-            # yes! so postinst must call ldconfig
-            $must_call_ldconfig = $real_file;
+        # executable?
+        my $perms = sprintf ('%04o', $perm);
+        if ($perm & 0111) {
+            # Yes.  But if the library has an INTERP section, it's
+            # designed to do something useful when executed, so don't
+            # report an error.  Also give ld.so a pass, since it's
+            # special.
+            tag 'shlib-with-executable-bit', $cur_file, $perms
+                unless ($objdump->{$cur_file}->{INTERP}
+                        or $cur_file =~ m,^lib(?:32|64)?/ld-[\d.]+\.so$,);
+        } elsif ($perm != 0644) {
+            tag 'shlib-with-bad-permissions', $cur_file, $perms;
         }
 
         # executable stack.  We can only warn about a missing section on some
         # architectures.  Only warn if there's an Architecture field; if
         # that's missing, we'll already be complaining elsewhere.
-        #  - exists $objdump->{$cur_file}->{name} implies it is an "object" file
-        if (exists $objdump->{$cur_file}->{name}) {
-            if (not defined $objdump->{$cur_file}->{STACK}) {
-                if (defined $info->field('architecture')) {
-                    my $arch = $info->field('architecture');
-                    tag 'shlib-without-PT_GNU_STACK-section', $cur_file
-                        if $stack_arches{$arch};
-                }
-            } elsif ($objdump->{$cur_file}->{STACK} ne 'rw-') {
-                tag 'shlib-with-executable-stack', $cur_file;
+        if (not defined $objdump->{$cur_file}->{STACK}) {
+            if (defined $info->field('architecture')) {
+                my $arch = $info->field('architecture');
+                tag 'shlib-without-PT_GNU_STACK-section', $cur_file
+                    if $stack_arches{$arch};
             }
+        } elsif ($objdump->{$cur_file}->{STACK} ne 'rw-') {
+            tag 'shlib-with-executable-stack', $cur_file;
         }
     } elsif ($ldconfig_dirs->known(dirname($cur_file))
              && exists $sharedobject{$cur_file}) {
@@ -656,6 +645,20 @@ sub is_nss_plugin {
     return 0;
 }
 
+sub needs_ldconfig {
+    my ($file) = @_;
+    my $dirname = dirname($file);
+    my $last;
+    do {
+        $dirname =~ s%/([^/]+)$%%;
+        $last = $1;
+    } while ($last && $HWCAP_DIRS->known ($last));
+    $dirname .= "/$last" if $last;
+    # yes! so postinst must call ldconfig
+    return 1 if $ldconfig_dirs->known ($dirname);
+    return;
+}
+
 1;
 
 # Local Variables:

-- 
Debian package checker


Reply to: