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

lintian: r975 - in trunk: checks debian



Author: rra
Date: 2007-10-15 07:18:47 +0200 (Mon, 15 Oct 2007)
New Revision: 975

Modified:
   trunk/checks/menu-format
   trunk/debian/changelog
Log:
  + [RA] Ignore desktop files not for one of the known types.  This
    should significantly reduce the noise for KDE packages.
  + [RA] Only check whether a program referenced by Exec is in the
    package if the desktop file is in /usr/share/applications.  Too many
    applications use Exec for desktop files elsewhere without the
    standard PATH.
  + [RA] Ignore Exec fields pointing to kcmshell.
  + [RA] Ignore desktop files in /usr/share/doc or that appear to be
    templates.
  + [RA] Avoid uninitialized warnings on all-whitespace commands.

Modified: trunk/checks/menu-format
===================================================================
--- trunk/checks/menu-format	2007-10-15 04:35:45 UTC (rev 974)
+++ trunk/checks/menu-format	2007-10-15 05:18:47 UTC (rev 975)
@@ -194,6 +194,15 @@
        UnmountIcon
       );
 
+# Known types of desktop entries.
+# http://standards.freedesktop.org/desktop-entry-spec/1.0/ar01s05.html
+my %known_desktop_types = map { $_ => 1 }
+    qw(
+       Application
+       Link
+       Directory
+      );
+
 # Authorative source of desktop categories:
 # http://standards.freedesktop.org/menu-spec/1.0/apa.html
 
@@ -386,6 +395,7 @@
 while (<IN>) {
     chomp;
     my ($perm, $owner, $size, $date, $time, $file) = split(' ', $_, 6);
+    $file =~ s,^\./,,;
     $file =~ s/ link to .*//;
     $file =~ s/ -> .*//;
     my $operm = perm2oct($perm);
@@ -395,7 +405,9 @@
         if ($perm =~ m,x,o) {
             tag "executable-desktop-file", sprintf("$file %04o",$operm);
         }
-        push (@desktop_files, $file);
+        unless (m,template, or m,^usr/share/doc/,) {
+            push (@desktop_files, $file);
+        }
     }
 }
 close IN;
@@ -762,7 +774,8 @@
     }
     close DESKTOP;
 
-    # Now validate the data in the desktop file.
+    # Now validate the data in the desktop file, but only if it's a known type.
+    next unless ($vals{'Type'} and $known_desktop_types{$vals{'Type'}});
 
     # Test for important keys.
     for my $tag (@req_desktop_keys) {
@@ -771,12 +784,16 @@
         }
     }
 
-    # TODO:  Should check quoting and the check special field codes in Exec
-    # for desktiop files.
-    if (defined $vals{'Exec'}) {
+    # Only test whether the binary is in the package if the desktop file is
+    # directly under /usr/share/applications.  Too many applications use
+    # desktop files for other purposes with custom paths.
+    #
+    # TODO:  Should check quoting and the check special field
+    # codes in Exec for desktop files.
+    if ($file =~ ,usr/share/applications/[^/]+$, and $vals{'Exec'} =~ /\S/) {
         my ($okay, $command) = VerifyCmd ($file, undef, $vals{'Exec'});
         tag "desktop-command-not-in-package", "$file $command"
-            unless $okay;
+            unless $okay or $command eq 'kcmshell';
     }
 
     # Check the Category tag.
@@ -816,10 +833,10 @@
     # allows one, and gksu has the command at the end of its arguments.
     my @com = split (' ', $exec);
     my $cmd;
-    if ($com[0] eq "/usr/sbin/su-to-root") {
+    if ($com[0] and $com[0] eq "/usr/sbin/su-to-root") {
         tag 'su-to-root-with-usr-sbin', $location;
     }
-    if ($com[0] =~ m,^(?:/usr/s?bin/)?(su-to-root|gksu|kdesu|sux)$,) {
+    if ($com[0] and $com[0] =~ m,^(?:/usr/s?bin/)?(su-to-root|gksu|kdesu|sux)$,) {
         my $wrapper = $1;
         shift @com;
         while (@com) {

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2007-10-15 04:35:45 UTC (rev 974)
+++ trunk/debian/changelog	2007-10-15 05:18:47 UTC (rev 975)
@@ -56,6 +56,16 @@
       extensions.  Thanks, Josselin Mouette.  (Closes: #443827)
     + [RA] Allow Actions keys.  This isn't in the desktop standard but
       is widely used.  Thanks, Raphael Geissert.  (Closes: #444651)
+    + [RA] Ignore desktop files not for one of the known types.  This
+      should significantly reduce the noise for KDE packages.
+    + [RA] Only check whether a program referenced by Exec is in the
+      package if the desktop file is in /usr/share/applications.  Too many
+      applications use Exec for desktop files elsewhere without the
+      standard PATH.
+    + [RA] Ignore Exec fields pointing to kcmshell.
+    + [RA] Ignore desktop files in /usr/share/doc or that appear to be
+      templates.
+    + [RA] Avoid uninitialized warnings on all-whitespace commands.
   * checks/menus:
     + [RA] Find the targets of hard links correctly.  (Closes: #444355)
     + [RA] Use the three-argument form of open to not fail on doc-base
@@ -76,7 +86,7 @@
   * collection/changelog-file{.desc,}:
     + [RA] Collect NEWS.Debian as well as changelog.
 
- -- Russ Allbery <rra@debian.org>  Sun, 14 Oct 2007 21:19:01 -0700
+ -- Russ Allbery <rra@debian.org>  Sun, 14 Oct 2007 22:18:41 -0700
 
 lintian (1.23.34) unstable; urgency=low
 



Reply to: