Author: rra
Date: 2006-09-03 23:56:29 +0200 (Sun, 03 Sep 2006)
New Revision: 737

Modified:
   trunk/checks/control-files
   trunk/checks/files
   trunk/checks/menus
   trunk/checks/shared-libs
   trunk/debian/changelog
   trunk/lib/Util.pm
Log:
* checks/control-files:
  + [RA] perm2oct definition moved to Util.pm.
* checks/files:
  + [RA] perm2oct definition moved to Util.pm.
* checks/menus:
  + [RA] perm2oct definition moved to Util.pm.
* checks/shared-libs:
  + [RA] perm2oct definition moved to Util.pm.
* lib/Util.pm:
  + [RA] Move perm2oct to here and improve recognition of s, S, t, and T
    characters.  Thanks to Justin B. Rye for patch.  (Closes: #376119)

Modified: trunk/checks/control-files
===================================================================
--- trunk/checks/control-files  2006-09-03 20:17:46 UTC (rev 736)
+++ trunk/checks/control-files  2006-09-03 21:56:29 UTC (rev 737)
@@ -21,6 +21,7 @@
 package Lintian::control_files;
 use strict;
 use Tags;
+use Util;
 
 sub run {
 
@@ -104,30 +105,6 @@
 
 } # </run>
 
-# translate permission strings like `-rwxrwxrwx' into an octal number
-sub perm2oct {
-    my ($t) = @_;
-
-    my $o = 0;
-
-    $t =~ m/^.(.)(.)(.)(.)(.)(.)(.)(.)(.)/o;
-
-    $o += 04000 if $3 eq 's';  # set-uid
-    $o += 02000 if $6 eq 's';  # set-gid
-    $o += 01000 if $9 eq 't';  # sticky bit
-    $o += 00400 if $1 ne '-';  # owner read
-    $o += 00200 if $2 ne '-';  # owner write
-    $o += 00100 if $3 ne '-';  # owner execute
-    $o += 00040 if $4 ne '-';  # owner read
-    $o += 00020 if $5 ne '-';  # owner write
-    $o += 00010 if $6 ne '-';  # owner execute
-    $o += 00004 if $7 ne '-';  # owner read
-    $o += 00002 if $8 ne '-';  # owner write
-    $o += 00001 if $9 ne '-';  # owner execute
-
-    return $o;
-}
-
 1;
 
 # vim: syntax=perl sw=4 ts=8

Modified: trunk/checks/files
===================================================================
--- trunk/checks/files  2006-09-03 20:17:46 UTC (rev 736)
+++ trunk/checks/files  2006-09-03 21:56:29 UTC (rev 737)
@@ -777,30 +777,6 @@
 
 }
 
-# translate permission strings like `-rwxrwxrwx' into an octal number
-sub perm2oct {
-    my ($t) = @_;
-
-    my $o = 0;
-
-    $t =~ m/^.(.)(.)(.)(.)(.)(.)(.)(.)(.)/;
-
-    $o += 04000 if $3 eq 's';  # set-uid
-    $o += 02000 if $6 eq 's';  # set-gid
-    $o += 01000 if $9 eq 't';  # sticky bit
-    $o += 00400 if $1 ne '-';  # owner read
-    $o += 00200 if $2 ne '-';  # owner write
-    $o += 00100 if $3 ne '-';  # owner execute
-    $o += 00040 if $4 ne '-';  # owner read
-    $o += 00020 if $5 ne '-';  # owner write
-    $o += 00010 if $6 ne '-';  # owner execute
-    $o += 00004 if $7 ne '-';  # owner read
-    $o += 00002 if $8 ne '-';  # owner write
-    $o += 00001 if $9 ne '-';  # owner execute
-
-    return $o;
-}
-
 1;
 
 # vim: syntax=perl ts=8 sw=4

Modified: trunk/checks/menus
===================================================================
--- trunk/checks/menus  2006-09-03 20:17:46 UTC (rev 736)
+++ trunk/checks/menus  2006-09-03 21:56:29 UTC (rev 737)
@@ -254,30 +254,6 @@
 
 # -----------------------------------
 
-# translate permission strings like `-rwxrwxrwx' into an octal number
-sub perm2oct {
-    my ($t) = @_;
-
-    my $o = 0;
-
-    $t =~ /^.(.)(.)(.)(.)(.)(.)(.)(.)(.)/o;
-
-    $o += 04000 if $3 eq 's';  # set-uid
-    $o += 02000 if $6 eq 's';  # set-gid
-    $o += 01000 if $9 eq 't';  # sticky bit
-    $o += 00400 if $1 ne '-';  # owner read
-    $o += 00200 if $2 ne '-';  # owner write
-    $o += 00100 if $3 ne '-';  # owner execute
-    $o += 00040 if $4 ne '-';  # owner read
-    $o += 00020 if $5 ne '-';  # owner write
-    $o += 00010 if $6 ne '-';  # owner execute
-    $o += 00004 if $7 ne '-';  # owner read
-    $o += 00002 if $8 ne '-';  # owner write
-    $o += 00001 if $9 ne '-';  # owner execute
-
-    return $o;
-}
-
 # Add file and link to %all_files and %all_links.  Note that both files and
 # links have to include a leading /.
 sub add_file_link_info {

Modified: trunk/checks/shared-libs
===================================================================
--- trunk/checks/shared-libs    2006-09-03 20:17:46 UTC (rev 736)
+++ trunk/checks/shared-libs    2006-09-03 21:56:29 UTC (rev 737)
@@ -395,30 +395,6 @@
 
 }
 
-# translate permission strings like `-rwxrwxrwx' into an octal number
-sub perm2oct {
-    my ($t) = @_;
-
-    my $o = 0;
-
-    $t =~ m/^.(.)(.)(.)(.)(.)(.)(.)(.)(.)/o;
-
-    $o += 04000 if $3 eq 's';  # set-uid
-    $o += 02000 if $6 eq 's';  # set-gid
-    $o += 01000 if $9 eq 't';  # sticky bit
-    $o += 00400 if $1 ne '-';  # owner read
-    $o += 00200 if $2 ne '-';  # owner write
-    $o += 00100 if $3 ne '-';  # owner execute
-    $o += 00040 if $4 ne '-';  # owner read
-    $o += 00020 if $5 ne '-';  # owner write
-    $o += 00010 if $6 ne '-';  # owner execute
-    $o += 00004 if $7 ne '-';  # owner read
-    $o += 00002 if $8 ne '-';  # owner write
-    $o += 00001 if $9 ne '-';  # owner execute
-
-    return $o;
-}
-
 # make /tmp/baz/baz.txt from /tmp/foo/../bar/../baz/baz.txt
 sub abs_path {
     my $path = shift;

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2006-09-03 20:17:46 UTC (rev 736)
+++ trunk/debian/changelog      2006-09-03 21:56:29 UTC (rev 737)
@@ -1,5 +1,7 @@
 lintian (1.23.24) UNRELEASED; urgency=low
 
+  * checks/control-files:
+    + [RA] perm2oct definition moved to Util.pm.
   * checks/cruft{.desc,}:
     + [RA] Remove the (info-level) check for .cvsignore files in the
       source tarball.  This isn't an error; those files contain metadata
@@ -8,13 +10,23 @@
   * checks/fields{.desc,}:
     + [RA] Depending on versioned variants of python-minimal is also an
       error.  Thanks, Adeodato Simó.  (Closes: #384476)
+  * checks/files:
+    + [RA] perm2oct definition moved to Util.pm.
+  * checks/menus:
+    + [RA] perm2oct definition moved to Util.pm.
   * checks/scripts:
     + [RA] Properly concatenate the dependencies for a package when
       checking whether the dependency for an interpreter is included.
       Thanks, Vincent Danjean.  (Closes: #385178)
+  * checks/shared-libs:
+    + [RA] perm2oct definition moved to Util.pm.
 
- -- Russ Allbery <[EMAIL PROTECTED]>  Sun,  3 Sep 2006 13:01:15 -0700
+  * lib/Util.pm:
+    + [RA] Move perm2oct to here and improve recognition of s, S, t, and T
+      characters.  Thanks to Justin B. Rye for patch.  (Closes: #376119)
 
+ -- Russ Allbery <[EMAIL PROTECTED]>  Sun,  3 Sep 2006 14:55:54 -0700
+
 lintian (1.23.23) unstable; urgency=low
 
   The "new Python policy" release

Modified: trunk/lib/Util.pm
===================================================================
--- trunk/lib/Util.pm   2006-09-03 20:17:46 UTC (rev 736)
+++ trunk/lib/Util.pm   2006-09-03 21:56:29 UTC (rev 737)
@@ -32,7 +32,8 @@
        get_file_md5
        file_is_encoded_in_non_utf8
        fail
-       system_env);
+       system_env
+       perm2oct);
 
 use FileHandle;
 use Pipeline;
@@ -225,6 +226,33 @@
     }
 }
 
+# Translate permission strings like `-rwxrwxrwx' into an octal number.
+sub perm2oct {
+    my ($t) = @_;
+
+    my $o = 0;
+
+    $t =~ m/^.(.)(.)(.)(.)(.)(.)(.)(.)(.)/o;
+
+    $o += 00400 if $1 eq 'r';  # owner read
+    $o += 00200 if $2 eq 'w';  # owner write
+    $o += 00100 if $3 eq 'x';  # owner execute
+    $o += 04000 if $3 eq 'S';  # setuid
+    $o += 04100 if $3 eq 's';  # setuid + owner execute
+    $o += 00040 if $4 eq 'r';  # group read
+    $o += 00020 if $5 eq 'w';  # group write
+    $o += 00010 if $6 eq 'x';  # group execute
+    $o += 02000 if $6 eq 'S';  # setgid
+    $o += 02010 if $6 eq 's';  # setgid + group execute
+    $o += 00004 if $7 eq 'r';  # other read
+    $o += 00002 if $8 eq 'w';  # other write
+    $o += 00001 if $9 eq 'x';  # other execute
+    $o += 01000 if $9 eq 'T';  # stickybit
+    $o += 01001 if $9 eq 't';  # stickybit + other execute
+
+    return $o;
+}
+
 # ------------------------
 
 sub fail {


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to