--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: lintian: perm2oct() can't handle --S--S--T
- From: Justin B Rye <jbr@edlug.org.uk>
- Date: Fri, 30 Jun 2006 12:08:50 +0100
- Message-id: <20060630110849.GA26670@xibalba.demon.co.uk>
Package: lintian
Version: 1.23.21
Severity: wishlist
Tags: patch
*** Please type your report below this line ***
The lintian check-scripts:
/usr/share/lintian/checks/{control-files,files,menus,shared-libs}
...each define a "perm2oct" function to allow them to convert a
ls-style string like drwxr-xr-x into a numeric value like 0755.
However, the logic used in each case is incapable of coping with
pathological strings like drwSr-Sr-T (=07644), and would read that
as equivalent to the inoffensive drwxr-xr-x.
Now, you could fix this by simple-mindedly extending the existing
logic, or you could use something a bit fancier. Below are buggy,
plain-fixed and fancy-fixed versions of the function; attached is a
patch using the plain version.
######################################################################
BUGGY
######################################################################
# 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;
}
######################################################################
PLAIN-FIXED
######################################################################
# 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;
}
######################################################################
FANCY-FIXED
######################################################################
# translate permission strings like `-rwxrwxrwx' into an octal number
sub perm2oct {
my ($t) = @_;
my $o = 0;
$t =~ /^.(...)(...)(...)/o;
my @ugo = ($1, $2, $3);
my @rwx = ('[xst]', 'w', 'r');
for my $i (0..8) {
unless ($i%3) {
$_ = pop @ugo;
/[stST]/ and $o += 1<<(9+$i/3);
}
/$rwx[$i%3]/ and $o += 1<<$i;
}
return $o; # though this isn't oct-shaped!
}
######################################################################
-- System Information:
Debian Release: testing/unstable
APT prefers testing
APT policy: (500, 'testing'), (50, 'unstable')
Architecture: i386 (i586)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17.hurakan
Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=ISO-8859-1)
Versions of packages lintian depends on:
ii binutils 2.16.1cvs20060413-1 The GNU assembler, linker and bina
ii diffstat 1.41-1 produces graph of changes introduc
ii dpkg-dev 1.13.21 package building tools for Debian
ii file 4.17-2 Determines file type using "magic"
ii gettext 0.14.5-4 GNU Internationalization utilities
ii intltool-debian 0.34.2+20060512 Help i18n of RFC822 compliant conf
ii libparse-debianchang 1.0-1 parse Debian changelogs and output
ii man-db 2.4.3-3 The on-line manual pager
ii perl [libdigest-md5- 5.8.8-4 Larry Wall's Practical Extraction
lintian recommends no packages.
-- no debconf information
--
JBR
Ankh kak! (Ancient Egyptian blessing)
diff -ru lintian-1.23.22.pristine/checks/control-files lintian-1.23.22/checks/control-files
--- lintian-1.23.22.pristine/checks/control-files 2006-01-02 09:19:16.000000000 +0000
+++ lintian-1.23.22/checks/control-files 2006-06-29 20:34:16.000000000 +0100
@@ -112,18 +112,21 @@
$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
+ $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;
}
diff -ru lintian-1.23.22.pristine/checks/files lintian-1.23.22/checks/files
--- lintian-1.23.22.pristine/checks/files 2006-05-04 04:37:21.000000000 +0100
+++ lintian-1.23.22/checks/files 2006-06-29 20:42:21.000000000 +0100
@@ -769,20 +769,23 @@
my $o = 0;
- $t =~ m/^.(.)(.)(.)(.)(.)(.)(.)(.)(.)/;
+ $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
+ $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;
}
diff -ru lintian-1.23.22.pristine/checks/menus lintian-1.23.22/checks/menus
--- lintian-1.23.22.pristine/checks/menus 2006-05-09 02:53:09.000000000 +0100
+++ lintian-1.23.22/checks/menus 2006-06-29 20:35:08.000000000 +0100
@@ -260,20 +260,23 @@
my $o = 0;
- $t =~ /^.(.)(.)(.)(.)(.)(.)(.)(.)(.)/o;
+ $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
+ $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;
}
diff -ru lintian-1.23.22.pristine/checks/shared-libs lintian-1.23.22/checks/shared-libs
--- lintian-1.23.22.pristine/checks/shared-libs 2006-04-04 21:20:47.000000000 +0100
+++ lintian-1.23.22/checks/shared-libs 2006-06-29 20:35:35.000000000 +0100
@@ -403,18 +403,21 @@
$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
+ $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;
}
--- End Message ---
--- Begin Message ---
Source: lintian
Source-Version: 1.23.24
We believe that the bug you reported is fixed in the latest version of
lintian, which is due to be installed in the Debian FTP archive:
lintian_1.23.24.dsc
to pool/main/l/lintian/lintian_1.23.24.dsc
lintian_1.23.24.tar.gz
to pool/main/l/lintian/lintian_1.23.24.tar.gz
lintian_1.23.24_all.deb
to pool/main/l/lintian/lintian_1.23.24_all.deb
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 376119@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Russ Allbery <rra@debian.org> (supplier of updated lintian package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Format: 1.7
Date: Mon, 4 Sep 2006 12:03:16 -0700
Source: lintian
Binary: lintian
Architecture: source all
Version: 1.23.24
Distribution: unstable
Urgency: low
Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
Changed-By: Russ Allbery <rra@debian.org>
Description:
lintian - Debian package checker
Closes: 376119 377740 384476 385178 386014
Changes:
lintian (1.23.24) unstable; urgency=low
.
The "LSB init script" release
.
* 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
that may be useful for people making modifications and it's quite
common to distribute them.
* checks/debconf{.desc,}:
+ [RA] Diagnose unknown priorities in db_input and db_text
invocations. Patch from Thomas Huriaux. (Closes: #386014)
* 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/init.d{.desc,}:
+ [RA] Added a warning for init scripts missing an LSB keyword
section, checks of the syntax of such a section if present, and
some basic semantic checks of the easiest fields. Based on initial
work by Carlos Villegas. (Closes: #377740)
* 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.
.
* 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)
Files:
d99a044f4bdd199c9b267c89cf3f5cbb 803 devel optional lintian_1.23.24.dsc
be2ff09babea1a73bb75c8508e2465f5 312666 devel optional lintian_1.23.24.tar.gz
c681e9f48104e3304cbfdccfd814b563 265882 devel optional lintian_1.23.24_all.deb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
iD8DBQFE/Hly+YXjQAr8dHYRApd/AJ9wSSrBO1DHUoNEj01P4qgeUjOggACfTxL9
HXfRImQB2t1Dn7cSv/eCepI=
=dM09
-----END PGP SIGNATURE-----
--- End Message ---