Package: lintian Version: 2.2.13 Severity: wishlist Tags: patch As discussed in the ‘debian-desktop’ forum (thread starting at <URL:http://lists.debian.org/msgid-search/877hxekgo4.fsf@benfinney.id.au>), I think there is a class of desktop entry keys which, while not required by the specification, are usually a problem if omitted. The attached patch implements a check for recommended keys (and only defines one, the ‘StartupNotify’ key) and if they are omitted issues the ‘desktop-entry-missing-recommended-key’ tag. -- \ “Writing a book is like washing an elephant: there no good | `\ place to begin or end, and it's hard to keep track of what | _o__) you've already covered.” —anonymous | Ben Finney <ben@benfinney.id.au>
diff --git a/checks/menu-format b/checks/menu-format
index 981e5d5..0a36ca8 100644
--- a/checks/menu-format
+++ b/checks/menu-format
@@ -133,7 +133,7 @@ my @sections = ('Applications/Accessibility',
# Authorative source of desktop keys:
# http://standards.freedesktop.org/desktop-entry-spec/1.0/
#
-# This is a list of all keys that should be in every desktop entry.
+# This is a list of all keys that must be in every desktop entry.
my @req_desktop_keys = qw(Type Name);
# This is a list of all known keys.
@@ -797,13 +797,20 @@ sub VerifyDesktopFile {
tag @$pending;
}
- # Test for important keys.
+ # Test for required keys.
for my $tag (@req_desktop_keys) {
unless (defined $vals{$tag}) {
tag "desktop-entry-missing-required-key", "/$file $tag";
}
}
+ # Test for recommended keys.
+ for my $tag (@recommended_desktop_keys) {
+ unless (defined $vals{$tag}) {
+ tag "desktop-entry-missing-recommended-key", "/$file $tag";
+ }
+ }
+
# 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.
diff --git a/checks/menu-format.desc b/checks/menu-format.desc
index 416123f..5b534de 100644
--- a/checks/menu-format.desc
+++ b/checks/menu-format.desc
@@ -248,6 +248,20 @@ Certainty: certain
Info: Desktop entries must contain, at a minimum, the keys Type and Name.
Ref: http://standards.freedesktop.org/desktop-entry-spec/1.0/ar01s05.html
+Tag: desktop-entry-missing-recommended-key
+Severity: normal
+Certainty: certain
+Info: The desktop entry omits a key that, while not strictly required,
+ is recommended to be present in each entry with an explicitly
+ specified value.
+ .
+ For backward compatibility with very old desktop entries, the absence
+ of a StartupNotify key is not an error, but the default behaviour in
+ its absence is implementation-defined according to the FreeDesktop
+ specification. The desktop entry for any currently-maintained program
+ should specify an appropriate value for the StartupEntry key.
+Ref: http://standards.freedesktop.org/desktop-entry-spec/1.0/ar01s05.html
+
Tag: desktop-entry-contains-unknown-key
Severity: minor
Certainty: certain
diff --git a/testset/binary/debian/goodbye.desktop b/testset/binary/debian/goodbye.desktop
index f6ce8e3..857d8af 100644
--- a/testset/binary/debian/goodbye.desktop
+++ b/testset/binary/debian/goodbye.desktop
@@ -7,7 +7,9 @@ Exec=goodbye
icon=hello
Terminal=true
Type=Application
+# StartupNotify=true
Categories=WeirdStuff;Screensaver;
Encoding=ISO-10646-1
[Other Entry]
Name=Goodbye
+StartupNotify=false
diff --git a/testset/binary/debian/hello.desktop b/testset/binary/debian/hello.desktop
index f795468..4757fa2 100644
--- a/testset/binary/debian/hello.desktop
+++ b/testset/binary/debian/hello.desktop
@@ -9,6 +9,7 @@ Exec=kdesu hello
Icon=hello
Terminal=true
Type=Application
+StartupNotify=true
Categories=GNOME;GTK;System;Applet;X-Foo;Settings;
Encoding=UTF-8
OnlyShowIn=GNOME;
diff --git a/testset/tags.binary b/testset/tags.binary
index 7be45d7..89b39a6 100644
--- a/testset/tags.binary
+++ b/testset/tags.binary
@@ -80,6 +80,7 @@ W: binary: desktop-entry-contains-unknown-key /usr/share/applications/goodbye.de
W: binary: desktop-entry-contains-unknown-key /usr/share/applications/goodbye.desktop:7 icon
W: binary: desktop-entry-file-has-crs /usr/share/applications/hello.desktop:7
W: binary: desktop-entry-invalid-category WeirdStuff /usr/share/applications/goodbye.desktop
+W: binary: desktop-entry-missing-recommended-key /usr/share/applications/goodbye.desktop StartupNotify
W: binary: desktop-entry-uses-reserved-category Screensaver /usr/share/applications/goodbye.desktop
W: binary: doc-base-abstract-field-separator-extra-whitespaces binary:7
W: binary: doc-base-file-unknown-format binary:20 esp
Attachment:
signature.asc
Description: Digital signature