lintian: r777 - in trunk: checks debian testset testset/binary/debian
Author: rra
Date: 2006-11-11 10:06:05 +0100 (Sat, 11 Nov 2006)
New Revision: 777
Modified:
trunk/checks/menu-format
trunk/checks/menu-format.desc
trunk/debian/changelog
trunk/testset/binary/debian/menu
trunk/testset/tags.binary
Log:
* checks/menu-format{.desc,}:
+ [RA] Support the sux, gksu, and kdesu wrappers in menu commands as
well as su-to-root. (Closes: #360227)
Modified: trunk/checks/menu-format
===================================================================
--- trunk/checks/menu-format 2006-11-11 08:14:41 UTC (rev 776)
+++ trunk/checks/menu-format 2006-11-11 09:06:05 UTC (rev 777)
@@ -1,4 +1,4 @@
-# menu format -- lintian check script
+# menu format -- lintian check script -*- perl -*-
# Copyright (C) 1998 by Joey Hess
#
@@ -94,6 +94,9 @@
XShells
);
+# Path in which to search for binaries referenced in menu entries.
+my @path = qw(/usr/local/bin/ /usr/bin/ /bin/ /usr/X11R6/bin/ /usr/games/);
+
my %known_tags_hash;
my %needs_tag_vals_hash;
my %root_sections_hash;
@@ -316,8 +319,8 @@
# Sanitize the section tag
my $section = $vals{'section'};
- $section =~ tr:/:/:s; # eliminate duplicate slashes.
- $section =~ s:/$::; # remove trailing slash.
+ $section =~ tr:/:/:s; # eliminate duplicate slashes.
+ $section =~ s:/$::; # remove trailing slash.
# Read the file index:
my %file_index;
@@ -327,48 +330,47 @@
}
close FILE_INDEX;
- my @com=split(' ',$vals{'command'});
- if ($com[0] eq "/usr/sbin/su-to-root") {
- tag "su-to-root-with-usr-sbin", "$fullname:$linecount";
- } elsif ($com[0] =~ m,(/usr/bin/)?su-to-root,o) {
- shift @com;
-
- my $cmd;
- while (@com) {
- if ($com[0]) {
- if ($com[0] eq '-p') {
- shift @com;
- shift @com;
- } elsif ($com[0] eq '-X') {
- shift @com;
- } elsif ($com[0] eq '-c') {
- $cmd = $com[1];
- shift @com;
- shift @com;
- } else {
- shift @com;
- }
- } else {
- shift @com;
- }
- }
-
- unless ($cmd) {
- tag "su-to-root-without--c", "$fullname:$linecount";
- } else {
- tag "menu-command-not-in-package", "$fullname:$linecount $cmd"
- if (!($file_index{".$cmd"}
- || grep {$file_index{".".$_.$cmd}} qw(/usr/local/bin/ /usr/bin/ /bin/ /usr/X11R6/bin/ /usr/games/)) # Check for binary in PATH
- && ($tested_packages < 2)
- && ($section !~ m:^WindowManagers/Modules:));
+ # Handle su wrappers. The option parsing here is ugly and dead-simple,
+ # but it's hopefully good enough for what will show up in menu files.
+ # su-to-root and sux require -c options, kdesu optionally allows one, and
+ # gksu has the command at the end of its arguments.
+ my @com = split(' ',$vals{'command'});
+ my $cmd;
+ if ($com[0] eq "/usr/sbin/su-to-root") {
+ tag "su-to-root-with-usr-sbin", "$fullname:$linecount";
+ } elsif ($com[0] =~ m,^(?:/usr/bin/)?(su-to-root|gksu|kdesu|sux)$,) {
+ my $wrapper = $1;
+ shift @com;
+ while (@com) {
+ unless ($com[0]) {
+ shift @com;
+ next;
}
- } else {
- tag "menu-command-not-in-package", "$fullname:$linecount $com[0]"
- if ($com[0] && ! ($file_index{".$com[0]"}
- || grep {$file_index{".".$_.$com[0]}} qw(/usr/local/bin/ /usr/bin/ /bin/ /usr/X11R6/bin/ /usr/games/)) # Check for binary in PATH
- && ($tested_packages < 2)
- && ($section !~ m:^WindowManagers/Modules:));
+ if ($com[0] eq '-c') {
+ $cmd = $com[1];
+ last;
+ } elsif ($com[0] =~ /^-[Dfmupi]|^--(user|description|message)/) {
+ shift @com;
+ shift @com;
+ } elsif ($com[0] =~ /^-/) {
+ shift @com;
+ } else {
+ last;
+ }
}
+ if (!$cmd && $wrapper =~ /^(gk|kde)su$/) {
+ $cmd = $com[0];
+ } elsif (!$cmd) {
+ tag "su-wrapper-without--c", "$fullname:$linecount $wrapper";
+ }
+ } else {
+ $cmd = $com[0];
+ }
+ tag "menu-command-not-in-package", "$fullname:$linecount $cmd"
+ if ($cmd
+ && !($file_index{".$cmd"} || grep {$file_index{".".$_.$cmd}} @path)
+ && ($tested_packages < 2)
+ && ($section !~ m:^WindowManagers/Modules:));
if (exists($vals{'icon'})) {
VerifyIcon($menufile, $fullname, $linecount, $vals{'icon'}, 32);
Modified: trunk/checks/menu-format.desc
===================================================================
--- trunk/checks/menu-format.desc 2006-11-11 08:14:41 UTC (rev 776)
+++ trunk/checks/menu-format.desc 2006-11-11 09:06:05 UTC (rev 777)
@@ -125,10 +125,11 @@
window managers and standard tools accept the file then probably it's the
latter; please file a bug on lintian then.
-Tag: su-to-root-without--c
+Tag: su-wrapper-without--c
Type: error
-Info: The menu item command uses su-to-root without the -c flag. This is
- a syntax error, see su-to-root(1) for more information.
+Info: The menu item command uses an su wrapper such as su-to-root without
+ the -c flag. This is a syntax error.
+Ref: su-to-root(1)
Tag: su-to-root-with-usr-sbin
Type: warning
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2006-11-11 08:14:41 UTC (rev 776)
+++ trunk/debian/changelog 2006-11-11 09:06:05 UTC (rev 777)
@@ -62,6 +62,9 @@
* checks/menu.desc:
+ [RA] Remove stray commas in Ref strings since the reporting code
considers commas to be separating two different references.
+ * checks/menu-format{.desc,}:
+ + [RA] Support the sux, gksu, and kdesu wrappers in menu commands as
+ well as su-to-root. (Closes: #360227)
* checks/po-debconf{.desc,}:
+ [RA] Check for misnamed PO files in debian/po, which cause
translations to be merged into the template with the wrong names and
@@ -71,7 +74,7 @@
various subdirectories of its standard search path based on hardware
capabilities. Reported by Aurelien Jarno. (Closes: #396278)
- -- Russ Allbery <rra@debian.org> Sat, 11 Nov 2006 00:10:16 -0800
+ -- Russ Allbery <rra@debian.org> Sat, 11 Nov 2006 01:06:00 -0800
lintian (1.23.25) unstable; urgency=low
Modified: trunk/testset/binary/debian/menu
===================================================================
--- trunk/testset/binary/debian/menu 2006-11-11 08:14:41 UTC (rev 776)
+++ trunk/testset/binary/debian/menu 2006-11-11 09:06:05 UTC (rev 777)
@@ -1,9 +1,11 @@
?package(binary):needs=text title="Hello World" command="/usr/bin/hello"
?package(binary):needs=text section="Apps/System" title="Run cfdisk (0)" command="/usr/bin/su-to-root cfdisk"
-?package(binary):needs="text" section="Apps/System" title="Run cfdisk (1)" command="su-to-root -p cfdisk"
+?package(binary):needs="text" section="Apps/System" title="Run cfdisk (1)" command="sux -p cfdisk"
?package(binary):needs="x11" section="WindowManagers" title="Run xfdisk" command="/usr/sbin/su-to-root -c xfdisk"
?package(binary):needs="wm" section="Apps/System" title="Run fdisk-wm" command="su-to-root -c hello"
+?package(binary):section="Apps/System" title="I'm not root!" command="su-to-root -c imnothere"
?package(binary):needs="text" section="Apps/System" title="I'm not here!" command="/imnothere"
?package(binary,other-binary):needs="text" section="Apps/System" title="more than one required" command="other-bin -s omething"
?package(binary):needs="wmmodule" section="WindowManagers/Modules" title="somemodule" command="ModuleCmd"
?package(binary):needs="text" section="Apps/System" title="I'm not in /usr/bin!" command="iminusrbin"
+?package(binary):needs="text" section="Apps/System" title="I'm not root!" command="su-to-root -c imnothere"
Modified: trunk/testset/tags.binary
===================================================================
--- trunk/testset/tags.binary 2006-11-11 08:14:41 UTC (rev 776)
+++ trunk/testset/tags.binary 2006-11-11 09:06:05 UTC (rev 777)
@@ -9,6 +9,8 @@
E: binary: doc-base-index-references-multiple-files binary:19
E: binary: file-directly-in-usr-share usr/share/baz
E: binary: lengthy-symlink usr/share/doc/binary/html/ch2.html ../html/./ch1.html
+E: binary: menu-item-missing-required-tag needs /usr/lib/menu/binary:6
+E: binary: menu-item-missing-required-tag needs /usr/share/menu/binary:6
E: binary: menu-item-missing-required-tag section /usr/lib/menu/binary:1
E: binary: menu-item-missing-required-tag section /usr/share/menu/binary:1
E: binary: non-wm-in-windowmanager-menu-section x11 /usr/lib/menu/binary:4
@@ -18,10 +20,10 @@
E: binary: postrm-does-not-call-updatemenus usr/lib/menu/binary
E: binary: prerm-does-not-call-installdocs usr/share/doc-base/binary
E: binary: statically-linked-binary ./usr/bin/static-hello
-E: binary: su-to-root-without--c /usr/lib/menu/binary:2
-E: binary: su-to-root-without--c /usr/lib/menu/binary:3
-E: binary: su-to-root-without--c /usr/share/menu/binary:2
-E: binary: su-to-root-without--c /usr/share/menu/binary:3
+E: binary: su-wrapper-without--c /usr/lib/menu/binary:2 su-to-root
+E: binary: su-wrapper-without--c /usr/lib/menu/binary:3 sux
+E: binary: su-wrapper-without--c /usr/share/menu/binary:2 su-to-root
+E: binary: su-wrapper-without--c /usr/share/menu/binary:3 sux
E: binary: suidregister-used-in-maintainer-script postinst
E: binary: symlink-contains-spurious-segments usr/share/doc/binary/html/ch2.html ../html/./ch1.html
E: binary: symlink-should-be-relative usr/share/doc/binary/html/ch3.html /usr/share/doc/binary/htm/ch1.html
@@ -43,8 +45,10 @@
W: binary: doc-base-file-unknown-format binary:14 esp
W: binary: executable-not-elf-or-script ./usr/bin/iminusrbin
W: binary: file-in-unusual-dir usr/bar
-W: binary: menu-command-not-in-package /usr/lib/menu/binary:6 /imnothere
-W: binary: menu-command-not-in-package /usr/share/menu/binary:6 /imnothere
+W: binary: menu-command-not-in-package /usr/lib/menu/binary:11 imnothere
+W: binary: menu-command-not-in-package /usr/lib/menu/binary:7 /imnothere
+W: binary: menu-command-not-in-package /usr/share/menu/binary:11 imnothere
+W: binary: menu-command-not-in-package /usr/share/menu/binary:7 /imnothere
W: binary: menu-file-in-usr-lib usr/lib/menu/binary
W: binary: menu-item-needs-tag-has-unknown-value wm /usr/lib/menu/binary:5
W: binary: menu-item-needs-tag-has-unknown-value wm /usr/share/menu/binary:5
Reply to: