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

[SCM] Debian package checker branch, master, updated. 2.5.5-17-g31cb349



The following commit has been merged in the master branch:
commit 31cb349ea325195aff34c5d6e78deaabe3689280
Author: Niels Thykier <niels@thykier.net>
Date:   Fri Mar 9 17:23:51 2012 +0100

    checks/*: Simplified some bit operations on permissions
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/checks/files b/checks/files
index 90b6ec9..f898f95 100644
--- a/checks/files
+++ b/checks/files
@@ -403,7 +403,7 @@ foreach my $file (@{$info->sorted_index}) {
                 # executable in /usr/share/doc ?
                 if ($index_info->{type} =~ m/^[-h]/ and
                     $file !~ m,^usr/share/doc/(?:[^/]+/)?examples/, and
-                    ($operm & 01 or $operm & 010 or $operm & 0100)) {
+                    ($operm & 0111)) {
                     if ($script{$file}) {
                         tag 'script-in-usr-share-doc', $file;
                     } else {
@@ -537,8 +537,7 @@ foreach my $file (@{$info->sorted_index}) {
             if ($index_info->{type} =~ m/^d/) {
                 tag 'stray-directory-in-manpage-directory', $file
                     if ($file !~ m,^usr/(?:X11R6|share)/man/(?:[^/]+/)?(?:man\d/)?$,);
-            } elsif ($index_info->{type} =~ m,^[-h], and
-                ($operm & 01 or $operm & 010 or $operm & 0100)) {
+            } elsif ($index_info->{type} =~ m,^[-h], and ($operm & 0111)) {
                 tag 'executable-manpage', $file;
             }
         }
@@ -1091,7 +1090,7 @@ foreach my $file (@{$info->sorted_index}) {
         }
 
         # ---------------- general: setuid/setgid files!
-        if ($operm & 04000 or $operm & 02000) {
+        if ($operm & 06000) {
             my ($setuid, $setgid) = ('','');
             # get more info:
             $setuid = $index_info->{owner} if ($operm & 04000);
@@ -1137,7 +1136,7 @@ foreach my $file (@{$info->sorted_index}) {
             }
         }
         # ---------------- general: executable files
-        elsif ($operm & 01 or $operm & 010 or $operm & 0100) {
+        elsif ($operm & 0111) {
             # executable
             if ($owner eq 'root/games') {
                 if ($operm != 2755) {
diff --git a/checks/menu-format b/checks/menu-format
index 23ad9d7..b67c1a2 100644
--- a/checks/menu-format
+++ b/checks/menu-format
@@ -406,7 +406,7 @@ foreach my $file (@{$info->sorted_index}) {
     if ($index_info->{type} =~ m/[-h]/ &&
         $file =~ m,^usr/share/applications/.*\.desktop$,) {
 
-        if ($operm & 0100 or $operm & 010 or $operm & 01) {
+        if ($operm & 0111) {
            tag 'executable-desktop-file', sprintf('%s %04o',$file,$operm);
         }
         unless ($file =~ m,template,o) {
diff --git a/checks/menus b/checks/menus
index b0ae559..b2b73b0 100644
--- a/checks/menus
+++ b/checks/menus
@@ -96,7 +96,7 @@ for my $file (@{$info->sorted_index}) {
     if ($index_info->{type} =~ m,^[-h],) { # file checks
         # menu file?
         if ($file =~ m,^usr/(lib|share)/menu/\S,o) { # correct permissions?
-            if ($operm & 01 or $operm & 010 or $operm & 0100) {
+            if ($operm & 0111) {
                 tag 'executable-menu-file', sprintf("%s %04o",$file,$operm);
             }
 
@@ -114,7 +114,7 @@ for my $file (@{$info->sorted_index}) {
         }
         # doc-base file?
         elsif ($file =~ m,^usr/share/doc-base/\S,o) { # correct permissions?
-            if ($operm & 01 or $operm & 010 or $operm & 0100) {
+            if ($operm & 0111) {
                 tag 'executable-in-usr-share-docbase', $file, sprintf("%04o",$operm);
             }
             $docbase_file = $file;
diff --git a/checks/scripts b/checks/scripts
index ea8de88..f8ed5dc 100644
--- a/checks/scripts
+++ b/checks/scripts
@@ -256,8 +256,7 @@ foreach (@{$info->sorted_index}) {
     next if $_ eq '';
     my $index_info = $info->index->{$_};
     my $operm = $index_info->{operm};
-    next unless ($index_info->{type} =~ m,^[-h], and ($operm & 01 or
-        $operm & 010 or $operm & 0100));
+    next unless $index_info->{type} =~ m,^[-h], and ($operm & 0111);
     my $is_suid = $operm & 04000;
     $executable{$_} = 1;
 }
diff --git a/checks/shared-libs b/checks/shared-libs
index 07cb811..ebf24f1 100644
--- a/checks/shared-libs
+++ b/checks/shared-libs
@@ -119,7 +119,7 @@ for my $cur_file (@{$info->sorted_index}) {
         if ($cur_file eq $real_file) {
             # executable?
             my $perms = sprintf('%04o', $real_perm);
-            if ($real_perm & 0100 or $real_perm & 010 or $real_perm & 01) {
+            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
diff --git a/debian/changelog b/debian/changelog
index 05bc927..f41e2bf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,7 @@
 lintian (2.5.6) UNRELEASED; urgency=low
 
+  * checks/*:
+    + [NT] Simplified some bit operations done on file permissions.
   * checks/changelog-file:
     + [NT] Do not emit "no-upstream-changelog" for transitional
       packages.  Thanks to Paul Wise for the report.

-- 
Debian package checker


Reply to: