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

lintian: r942 - in trunk: checks testset testset/binary/debian



Author: rra
Date: 2007-08-05 20:02:39 +0200 (Sun, 05 Aug 2007)
New Revision: 942

Added:
   trunk/testset/binary/debian/goodbye.desktop
   trunk/testset/binary/debian/hello.desktop
Modified:
   trunk/checks/menu-format
   trunk/checks/menu-format.desc
   trunk/testset/binary/debian/menu
   trunk/testset/binary/debian/rules
   trunk/testset/tags.binary
Log:
Add tests for the new desktop file checks and clean up a variety of bugs
discovered by the test suite.


Modified: trunk/checks/menu-format
===================================================================
--- trunk/checks/menu-format	2007-08-01 10:36:47 UTC (rev 941)
+++ trunk/checks/menu-format	2007-08-05 18:02:39 UTC (rev 942)
@@ -373,7 +373,6 @@
 while (<IN>) {
     chomp;
     my ($perm, $owner, $size, $date, $time, $file) = split(' ', $_, 6);
-    $file =~ s,^(\./),,;
     $file =~ s/ link to .*//;
     $file =~ s/ -> .*//;
     my $operm = perm2oct($perm);
@@ -585,9 +584,10 @@
     $section =~ s:/$::;		# remove trailing slash.
 
     # Be sure the command is provided by the package.
-    my ($okay, $command) = VerifyCmd ($fullname, $vals{'command'});
+    my ($okay, $command) = VerifyCmd ($fullname, $linecount, $vals{'command'});
     tag "menu-command-not-in-package", "$fullname:$linecount $command"
         unless ($okay
+                or not $command
                 or ($tested_packages >= 2)
                 or ($section =~ m:^(WindowManagers/Modules|FVWM Modules|Window Maker):));
 
@@ -761,7 +761,7 @@
     # TODO:  Should check quoting and the check special field codes in Exec
     # for desktiop files.
     if (defined $vals{'Exec'}) {
-        my ($okay, $command) = VerifyCmd ($file, $vals{'Exec'});
+        my ($okay, $command) = VerifyCmd ($file, undef, $vals{'Exec'});
         tag "desktop-command-not-in-package", "$file $command"
             unless $okay;
     }
@@ -789,7 +789,8 @@
 # false otherwise, and whose second member is the command (minus any leading
 # su-to-root wrapper).  Shared between the desktop and menu code.
 sub VerifyCmd {
-    my ($file, $exec) = @_;
+    my ($file, $line, $exec) = @_;
+    my $location = ($line ? "$file:$line" : $file);
 
     # This routine handles su wrappers.  The option parsing here is ugly and
     # dead-simple, but it's hopefully good enough for what will show up in
@@ -798,8 +799,9 @@
     my @com = split (' ', $exec);
     my $cmd;
     if ($com[0] eq "/usr/sbin/su-to-root") {
-        tag 'su-to-root-with-usr-sbin', $file;
-    } elsif ($com[0] =~ m,^(?:/usr/bin/)?(su-to-root|gksu|kdesu|sux)$,) {
+        tag 'su-to-root-with-usr-sbin', $location;
+    }
+    if ($com[0] =~ m,^(?:/usr/s?bin/)?(su-to-root|gksu|kdesu|sux)$,) {
         my $wrapper = $1;
         shift @com;
         while (@com) {
@@ -820,14 +822,17 @@
             }
         }
         if (!$cmd && $wrapper =~ /^(gk|kde)su$/) {
-            $cmd = $com[0];
-        } elsif (!$cmd) {
-            tag 'su-wrapper-without--c', "$file $wrapper";
+            if (@com) {
+                $cmd = $com[0];
+            } else {
+                $cmd = $wrapper;
+            }
         }
+        tag 'su-wrapper-without--c', "$location $wrapper" unless $cmd;
     } else {
         $cmd = $com[0];
     }
-    my $okay = $cmd and ($file_index{".$cmd"} or grep { $file_index{'.' . $_ . $cmd} } @path);
+    my $okay = $cmd && ($file_index{".$cmd"} || grep { $file_index{'.' . $_ . $cmd} } @path);
     return ($okay, $cmd);
 }
 

Modified: trunk/checks/menu-format.desc
===================================================================
--- trunk/checks/menu-format.desc	2007-08-01 10:36:47 UTC (rev 941)
+++ trunk/checks/menu-format.desc	2007-08-05 18:02:39 UTC (rev 942)
@@ -187,6 +187,11 @@
  In most cases this is a typo or after you moved a binary around, but forgot
  to update the menu file.
 
+Tag: executable-desktop-file
+Type: error
+Info: The desktop entry file is marked executable.  Desktop entries are
+ regular files and should be installed mode 0644.
+
 Tag: duplicated-key-in-desktop-entry
 Type: warning
 Info: The desktop entry contains two instances of the same key.  The

Added: trunk/testset/binary/debian/goodbye.desktop
===================================================================
--- trunk/testset/binary/debian/goodbye.desktop	2007-08-01 10:36:47 UTC (rev 941)
+++ trunk/testset/binary/debian/goodbye.desktop	2007-08-05 18:02:39 UTC (rev 942)
@@ -0,0 +1,13 @@
+[Desktop Entry]
+Name:Goodbye
+# Name=Goodbye
+Comment=Say hello!
+SpecialTag=This doesn't exist!
+Exec=goodbye
+icon=hello
+Terminal=true
+Type=Application
+Categories=WeirdStuff;
+Encoding=ISO-10646-1
+[Other Entry]
+Name=Goodbye

Added: trunk/testset/binary/debian/hello.desktop
===================================================================
--- trunk/testset/binary/debian/hello.desktop	2007-08-01 10:36:47 UTC (rev 941)
+++ trunk/testset/binary/debian/hello.desktop	2007-08-05 18:02:39 UTC (rev 942)
@@ -0,0 +1,13 @@
+# some random comment
+
+# [Foo Bar]
+[Desktop Entry]
+Name=Hello
+Name[en_US]=Hello
+Comment=Say hello!
+Exec=hello
+Icon=hello
+Terminal=true
+Type=Application
+Categories=GNOME;GTK;System;Settings;
+Encoding=UTF-8

Modified: trunk/testset/binary/debian/menu
===================================================================
--- trunk/testset/binary/debian/menu	2007-08-01 10:36:47 UTC (rev 941)
+++ trunk/testset/binary/debian/menu	2007-08-05 18:02:39 UTC (rev 942)
@@ -16,3 +16,5 @@
 ?package(binary):needs="text"\
  section="Applications/System/Administration"\
  title="I'm not root!" command="su-to-root -c imnothere"
+?package(binary):needs="text" section="Applications/System/Administration"\
+ title="Run cfdisk (0)" command="cfdisk"

Modified: trunk/testset/binary/debian/rules
===================================================================
--- trunk/testset/binary/debian/rules	2007-08-01 10:36:47 UTC (rev 941)
+++ trunk/testset/binary/debian/rules	2007-08-05 18:02:39 UTC (rev 942)
@@ -47,6 +47,12 @@
 	install -d $(tmp)/DEBIAN
 	install -m 755 debian/postinst $(tmp)/DEBIAN
 
+	install -d $(tmp)/usr/share/applications
+	install -m 644 debian/hello.desktop \
+	    $(tmp)/usr/share/applications/hello.desktop
+	install -m 755 debian/goodbye.desktop \
+	    $(tmp)/usr/share/applications/goodbye.desktop
+
 	# should be ok...
 	echo boe > $(tmp)/usr/bar
 	ln $(tmp)/usr/bar $(tmp)/usr/foo 

Modified: trunk/testset/tags.binary
===================================================================
--- trunk/testset/tags.binary	2007-08-01 10:36:47 UTC (rev 941)
+++ trunk/testset/tags.binary	2007-08-05 18:02:39 UTC (rev 942)
@@ -2,6 +2,7 @@
 E: binary-data: md5sums-control-file-is-empty
 E: binary: debian-changelog-file-missing-or-wrong-name
 E: binary: depends-on-x-metapackage depends: xorg
+E: binary: desktop-entry-missing-required-key ./usr/share/applications/goodbye.desktop Name
 E: binary: doc-base-file-no-format binary:22
 E: binary: doc-base-file-no-index binary:31
 E: binary: doc-base-file-references-missing-file binary:13 /usr/share/doc/binary/binary.sgml.gz
@@ -10,6 +11,7 @@
 E: binary: doc-base-file-references-missing-file binary:27 /usr/share/doc/binary/hml/*.html
 E: binary: doc-base-file-references-missing-file binary:30 /usr/share/info/binary.info.gz
 E: binary: doc-base-index-references-multiple-files binary:21
+E: binary: executable-desktop-file ./usr/share/applications/goodbye.desktop 0755
 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
@@ -33,6 +35,8 @@
 E: binary: unstripped-binary-or-object ./usr/bin/hello
 I: binary: arch-dep-package-has-big-usr-share
 I: binary: binary-has-unneeded-section ./usr/bin/hello-static .comment
+I: binary: desktop-entry-contains-encoding-key ./usr/share/applications/goodbye.desktop:11 Encoding
+I: binary: desktop-entry-contains-encoding-key ./usr/share/applications/hello.desktop:13 Encoding
 I: binary: no-md5sums-control-file
 W: binary source: ancient-standards-version 3.2.1 (current is 3.7.2)
 W: binary source: debian-rules-uses-pwd line 9
@@ -48,14 +52,24 @@
 W: binary: binary-without-manpage usr/bin/iminusrbin
 W: binary: binary-without-manpage usr/bin/static-hello
 W: binary: changelog-file-not-compressed changelog
+W: binary: desktop-command-not-in-package ./usr/share/applications/goodbye.desktop goodbye
+W: binary: desktop-entry-contains-unknown-key ./usr/share/applications/goodbye.desktop:5 SpecialTag
+W: binary: desktop-entry-contains-unknown-key ./usr/share/applications/goodbye.desktop:7 icon
+W: binary: desktop-entry-invalid-category WeirdStuff ./usr/share/applications/goodbye.desktop
+W: binary: desktop-entry-lacks-main-category ./usr/share/applications/goodbye.desktop
 W: binary: doc-base-file-unknown-format binary:16 esp
 W: binary: executable-not-elf-or-script ./usr/bin/iminusrbin
+W: binary: executable-not-elf-or-script ./usr/share/applications/goodbye.desktop
 W: binary: file-in-unusual-dir usr/bar
 W: binary: file-in-unusual-dir usr/bar2
 W: binary: file-in-unusual-dir usr/foo
 W: binary: menu-command-not-in-package /usr/lib/menu/binary:18 imnothere
+W: binary: menu-command-not-in-package /usr/lib/menu/binary:20 cfdisk
+W: binary: menu-command-not-in-package /usr/lib/menu/binary:4 xfdisk
 W: binary: menu-command-not-in-package /usr/lib/menu/binary:7 /imnothere
 W: binary: menu-command-not-in-package /usr/share/menu/binary:18 imnothere
+W: binary: menu-command-not-in-package /usr/share/menu/binary:20 cfdisk
+W: binary: menu-command-not-in-package /usr/share/menu/binary:4 xfdisk
 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-creates-new-section Applications/System /usr/lib/menu/binary:2



Reply to: