summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog113
-rw-r--r--Makefile.in2
-rw-r--r--NEWS17
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac2
-rw-r--r--src/mimeutils.c3
-rw-r--r--src/validate.c166
7 files changed, 204 insertions, 119 deletions
diff --git a/ChangeLog b/ChangeLog
index 1a69248..33d7a12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,118 @@
# Generated by Makefile. Do not edit.
+commit 56f879e9564b28886565115ea7528ec13db97759
+Author: Hans Petter Jansson <hpj@cl.no>
+Date: Sat Jun 18 19:46:47 2016 +0200
+
+ Release: 0.23
+
+M NEWS
+
+commit 9de5e8b2c29da6896663979189f758eca03c479b
+Author: Hans Petter Jansson <hpj@cl.no>
+Date: Sat Jun 18 19:01:08 2016 +0200
+
+ validate: Add LXQt to list of registered environments.
+
+ Patch from Jauhien Piatlicki.
+ https://github.com/lxde/lxqt
+
+ https://bugs.freedesktop.org/show_bug.cgi?id=79561
+
+M src/validate.c
+
+commit ccdf65853534b9f116ce6e38b0ad5375cf33820e
+Author: Matthias Clasen <mclasen@redhat.com>
+Date: Thu Dec 18 15:57:30 2014 -0500
+
+ Accept version 1.1
+
+ When the current spec version was updated to 1.1, we forgot
+ to ensure that we actually accept Version=1.1 in desktop files.
+
+M src/validate.c
+
+commit 5e8047d0d7a622dfd19dba0310ad58d8b4e2f16b
+Author: Hans Petter Jansson <hpj@cl.no>
+Date: Fri Jun 17 04:00:04 2016 +0200
+
+ validate: Ensure DBusActivatable filenames conform to reverse-DNS notation.
+
+ https://bugs.freedesktop.org/show_bug.cgi?id=66904
+
+M src/validate.c
+
+commit ec0949091f7a771c852c0314108f9aa4b2a25575
+Author: Hans Petter Jansson <hpj@cl.no>
+Date: Wed May 11 22:41:14 2016 +0200
+
+ mimeutils: Allow multipart/related MIME type.
+
+ It's implemented as an extension of RFC 822 and is used for MHTML.
+
+ https://bugs.freedesktop.org/show_bug.cgi?id=93376
+
+M src/mimeutils.c
+
+commit cddcd6612b66cb3963920b5f2734850a217d7020
+Author: Hans Petter Jansson <hpj@cl.no>
+Date: Mon Feb 29 01:50:14 2016 +0100
+
+ validate: Fix buffer over-read on incomplete escape sequence.
+
+ https://bugs.freedesktop.org/show_bug.cgi?id=94303
+
+M src/validate.c
+
+commit be0c630a19aa1788ef731def911770ce497d6ba3
+Author: David Faure <faure@kde.org>
+Date: Tue Apr 1 22:29:08 2014 +0200
+
+ Add EDE to the list of desktop environments
+
+ https://bugs.freedesktop.org/show_bug.cgi?id=56353
+
+M src/validate.c
+
+commit 848c82b2332d0556c22c10a9c64d1f39850271fe
+Author: Michael Webster <miketwebster@gmail.com>
+Date: Fri Mar 7 20:16:52 2014 -0500
+
+ Add Cinnamon to list of registered environments.
+
+ https://github.com/linuxmint/Cinnamon
+
+ https://bugs.freedesktop.org/show_bug.cgi?id=73497
+
+M src/validate.c
+
+commit 9e279cc3fac9a7e92bf426867fa83c0c7aec5711
+Author: Jerome Leclanche <jerome@leclan.ch>
+Date: Tue Apr 1 15:33:16 2014 +0200
+
+ desktop-file-validate: Trailing semicolons have been downgraded to optional
+
+ https://bugs.freedesktop.org/show_bug.cgi?id=76902
+ Approved by David Faure and Ryan Lortie
+
+M src/validate.c
+
+commit 08e0f4dc785be7d82ffe0aa5252dd6dbca648b3e
+Author: Vincent Untz <vuntz@gnome.org>
+Date: Thu Aug 29 09:57:11 2013 +0200
+
+ release: post-release bump to 0.23
+
+M configure.ac
+
+commit 4944725bddcf5821d53d7d648fc53347ce12cc03
+Author: Vincent Untz <vuntz@gnome.org>
+Date: Thu Aug 29 09:55:53 2013 +0200
+
+ release: 0.22
+
+M NEWS
+
commit a539c745051d7eeea6617a0512b71a649105de52
Author: Vincent Untz <vuntz@gnome.org>
Date: Thu Aug 29 09:53:31 2013 +0200
diff --git a/Makefile.in b/Makefile.in
index adf5493..6c769c7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -79,7 +79,7 @@ subdir = .
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
$(srcdir)/config.h.in AUTHORS COPYING ChangeLog NEWS README \
- depcomp install-sh missing
+ install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
diff --git a/NEWS b/NEWS
index f9980bd..65def2b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,21 @@
============
+Version 0.23
+============
+
+ desktop-file-validate
+ - Accept version 1.1 desktop files (Matthias Clasen).
+ - Add Cinnamon, EDE and LXQt to the list of registered desktop environments
+ (fdo#73497, fdo#56353, fdo#79561) (Michael Webster, David Faure,
+ Jauhien Piatlicki).
+ - Allow multipart/related MIME type; it's used for MHTML (fdo#93376)
+ (Hans Petter Jansson).
+ - Ensure DBusActivatable filenames conform to reverse-DNS notation
+ (fdo#66904) (Hans Petter Jansson).
+ - Downgrade trailing semicolons to optional (fdo#76902) (Jerome Leclanche).
+ - Fix buffer over-read (fdo#94303) (Hans Petter Jansson; reported by
+ Hanno Boeck and Agostino Sarubbo).
+
+============
Version 0.22
============
diff --git a/configure b/configure
index cd2a3c5..a89d990 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for desktop-file-utils 0.22.
+# Generated by GNU Autoconf 2.69 for desktop-file-utils 0.23.
#
# Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=desktop-file-utils>.
#
@@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='desktop-file-utils'
PACKAGE_TARNAME='desktop-file-utils'
-PACKAGE_VERSION='0.22'
-PACKAGE_STRING='desktop-file-utils 0.22'
+PACKAGE_VERSION='0.23'
+PACKAGE_STRING='desktop-file-utils 0.23'
PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=desktop-file-utils'
PACKAGE_URL=''
@@ -1243,7 +1243,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures desktop-file-utils 0.22 to adapt to many kinds of systems.
+\`configure' configures desktop-file-utils 0.23 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1310,7 +1310,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of desktop-file-utils 0.22:";;
+ short | recursive ) echo "Configuration of desktop-file-utils 0.23:";;
esac
cat <<\_ACEOF
@@ -1417,7 +1417,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-desktop-file-utils configure 0.22
+desktop-file-utils configure 0.23
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1472,7 +1472,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by desktop-file-utils $as_me 0.22, which was
+It was created by desktop-file-utils $as_me 0.23, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2337,7 +2337,7 @@ fi
# Define the identity of the package.
PACKAGE='desktop-file-utils'
- VERSION='0.22'
+ VERSION='0.23'
cat >>confdefs.h <<_ACEOF
@@ -4454,7 +4454,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by desktop-file-utils $as_me 0.22, which was
+This file was extended by desktop-file-utils $as_me 0.23, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -4520,7 +4520,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-desktop-file-utils config.status 0.22
+desktop-file-utils config.status 0.23
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 7ac134a..e949d82 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([desktop-file-utils], [0.22],
+AC_INIT([desktop-file-utils], [0.23],
[https://bugs.freedesktop.org/enter_bug.cgi?product=desktop-file-utils])
AC_CONFIG_SRCDIR(src/validate.h)
diff --git a/src/mimeutils.c b/src/mimeutils.c
index 44a83e9..0833fdb 100644
--- a/src/mimeutils.c
+++ b/src/mimeutils.c
@@ -71,6 +71,9 @@ static const char *registered_not_used_media_types[] = {
static const char *valid_exceptions_mime_types[] = {
/* mail: a mail saved in a file will have this mime type */
"message/rfc822",
+ /* Implemented as an extension of RFC 822; used for MHTML, in addition to
+ * application/x-mimearchive */
+ "multipart/related",
/* some multimedia mime type; it clearly doesn't respect the mime type rules,
* but it's widely deployed */
"misc/ultravox"
diff --git a/src/validate.c b/src/validate.c
index 68fd6f0..bd31fd5 100644
--- a/src/validate.c
+++ b/src/validate.c
@@ -211,6 +211,10 @@ handle_actions_key (kf_validator *kf,
const char *locale_key,
const char *value);
static gboolean
+handle_dbus_activatable_key (kf_validator *kf,
+ const char *locale_key,
+ const char *value);
+static gboolean
handle_dev_key (kf_validator *kf,
const char *locale_key,
const char *value);
@@ -313,7 +317,7 @@ static DesktopKeyDefinition registered_desktop_keys[] = {
* specified) */
{ DESKTOP_STRING_LIST_TYPE, "Actions", FALSE, FALSE, FALSE, handle_actions_key },
- { DESKTOP_BOOLEAN_TYPE, "DBusActivatable", FALSE, FALSE, FALSE, NULL },
+ { DESKTOP_BOOLEAN_TYPE, "DBusActivatable", FALSE, FALSE, FALSE, handle_dbus_activatable_key },
/* Keys reserved for KDE */
@@ -363,7 +367,7 @@ static DesktopKeyDefinition registered_action_keys[] = {
};
static const char *show_in_registered[] = {
- "GNOME", "KDE", "LXDE", "MATE", "Razor", "ROX", "TDE", "Unity", "XFCE", "Old"
+ "GNOME", "KDE", "LXDE", "LXQt", "MATE", "Razor", "ROX", "TDE", "Unity", "XFCE", "Cinnamon", "EDE", "Old"
};
static struct {
@@ -765,9 +769,6 @@ validate_numeric_key (kf_validator *kf,
/* + Values of type string may contain all ASCII characters except for control
* characters.
* Checked.
- * + The multiple values should be separated by a semicolon. Those keys which
- * have several values should have a semicolon as the trailing character.
- * Checked.
* + FIXME: how should an empty list be handled?
*/
static gboolean
@@ -799,24 +800,6 @@ validate_string_regexp_list_key (kf_validator *kf,
return FALSE;
}
- if (i > 0 && value[i - 1] != ';') {
- print_fatal (kf, "value \"%s\" for %s list key \"%s\" in group \"%s\" "
- "does not have a semicolon (';') as trailing "
- "character\n",
- value, type, key, kf->current_group);
-
- return FALSE;
- }
-
- if (i > 1 && value[i - 1] == ';' && value[i - 2] == '\\' &&
- (i < 3 || value[i - 3] != '\\')) {
- print_fatal (kf, "value \"%s\" for %s list key \"%s\" in group \"%s\" "
- "has an escaped semicolon (';') as trailing character\n",
- value, type, key, kf->current_group);
-
- return FALSE;
- }
-
return TRUE;
}
@@ -845,10 +828,6 @@ validate_regexp_list_key (kf_validator *kf,
* + If a postfixed key occurs, the same key must be also present without the
* postfix.
* Checked.
- * + The multiple values should be separated by a semicolon. Those keys which
- * have several values should have a semicolon as the trailing character.
- * FIXME: partly checked. We use checks that work for sure for ascii
- * characters, but that could possibly fail in some weird UTF-8 strings.
* + FIXME: how should an empty list be handled?
*/
static gboolean
@@ -858,7 +837,6 @@ validate_localestring_list_key (kf_validator *kf,
const char *value)
{
char *locale_key;
- int len;
if (locale)
locale_key = g_strdup_printf ("%s[%s]", key, locale);
@@ -876,27 +854,6 @@ validate_localestring_list_key (kf_validator *kf,
return FALSE;
}
- len = strlen (value);
-
- if (len > 0 && value[len - 1] != ';') {
- print_fatal (kf, "value \"%s\" for locale string list key \"%s\" in group "
- "\"%s\" does not have a semicolon (';') as trailing "
- "character\n",
- value, locale_key, kf->current_group);
-
- return FALSE;
- }
-
- if (len > 1 && value[len - 1] == ';' && value[len - 2] == '\\' &&
- (len < 3 || value[len - 3] != '\\')) {
- print_fatal (kf, "value \"%s\" for locale string list key \"%s\" in group "
- "\"%s\" has an escaped semicolon (';') as trailing "
- "character\n",
- value, locale_key, kf->current_group);
-
- return FALSE;
- }
-
if (!g_hash_table_lookup (kf->current_keys, key)) {
print_fatal (kf, "key \"%s\" in group \"%s\" is a localized key, but "
"there is no non-localized key \"%s\"\n",
@@ -969,6 +926,9 @@ handle_version_key (kf_validator *kf,
const char *locale_key,
const char *value)
{
+ if (!strcmp (value, "1.1"))
+ return TRUE;
+
if (!strcmp (value, "1.0"))
return TRUE;
@@ -1272,6 +1232,16 @@ handle_exec_key (kf_validator *kf,
break;
case '\\':
PRINT_INVALID_IF_FLAG;
+
+ /* Escape character immediately followed by \0? */
+ if (*(c + 1) == '\0') {
+ print_fatal (kf, "value \"%s\" for key \"%s\" in group \"%s\" "
+ "ends in an incomplete escape sequence\n",
+ value, locale_key, kf->current_group);
+ retval = FALSE;
+ break;
+ }
+
c++;
if (*c == '\\' && in_quote)
escaped = !escaped;
@@ -1827,6 +1797,46 @@ handle_actions_key (kf_validator *kf,
return retval;
}
+/* + If the file describes a D-Bus activatable service, the filename must be in
+ * reverse-DNS notation, i.e. contain at least two dots including the dot
+ * in ".desktop".
+ * Checked.
+ */
+static gboolean
+handle_dbus_activatable_key (kf_validator *kf,
+ const char *locale_key,
+ const char *value)
+{
+ gchar *basename_utf8;
+ gchar *basename;
+ const gchar *p = NULL;
+ gboolean retval = TRUE;
+
+ /* If DBusActivatable=false, don't check */
+ if (strcmp (value, "true") && strcmp (value, "1"))
+ return TRUE;
+
+ basename = g_path_get_basename (kf->filename);
+ basename_utf8 = g_filename_to_utf8 (basename, -1, NULL, NULL, NULL);
+ if (!basename_utf8)
+ goto out;
+
+ p = g_utf8_strchr (basename_utf8, -1, '.');
+ if (!p)
+ goto out;
+ p = g_utf8_strchr (p + 1, -1, '.');
+
+out:
+ if (!p) {
+ print_fatal (kf, "DBusActivatable filename must conform to reverse-DNS notation\n");
+ retval = FALSE;
+ }
+
+ g_free (basename_utf8);
+ g_free (basename);
+ return retval;
+}
+
/* + The device to mount. (probably implies an absolute path)
* Checked.
*/
@@ -3109,45 +3119,11 @@ desktop_file_validate (const char *filename,
return (!kf.fatal_error);
}
-static void
-fixup_list (GKeyFile *keyfile,
- const gchar *filename,
- const gchar *key)
-{
- char *value;
- int len;
-
- value = g_key_file_get_value (keyfile, GROUP_DESKTOP_ENTRY, key, NULL);
- if (!value)
- return;
-
- len = strlen (value);
-
- if (len > 0 && (value[len - 1] != ';' ||
- (len > 1 && value[len - 2] == '\\' &&
- (len < 3 || value[len - 3] != '\\')))) {
- char *str;
-
- g_printerr ("%s: warning: key \"%s\" is a list and does not have a "
- "semicolon as trailing character, fixing\n",
- filename, key);
-
- str = g_strconcat (value, ";", NULL);
- g_key_file_set_value (keyfile, GROUP_DESKTOP_ENTRY,
- key, str);
- g_free (str);
- }
-}
-
/* return FALSE if we were unable to fix the file */
gboolean
desktop_file_fixup (GKeyFile *keyfile,
const char *filename)
{
- gchar **keys;
- gsize keys_nb;
- unsigned int i;
-
if (g_key_file_has_group (keyfile, GROUP_KDE_DESKTOP_ENTRY)) {
g_printerr ("%s: warning: renaming deprecated \"%s\" group to \"%s\"\n",
filename, GROUP_KDE_DESKTOP_ENTRY, GROUP_DESKTOP_ENTRY);
@@ -3155,29 +3131,5 @@ desktop_file_fixup (GKeyFile *keyfile,
GROUP_KDE_DESKTOP_ENTRY, GROUP_DESKTOP_ENTRY);
}
- keys = g_key_file_get_keys (keyfile, GROUP_DESKTOP_ENTRY, &keys_nb, NULL);
-
- /* Fix lists to have a ';' at the end if they don't */
- for (i = 0; i < G_N_ELEMENTS (registered_desktop_keys); i++) {
- if (registered_desktop_keys[i].type == DESKTOP_STRING_LIST_TYPE ||
- registered_desktop_keys[i].type == DESKTOP_REGEXP_LIST_TYPE)
- fixup_list (keyfile, filename, registered_desktop_keys[i].name);
-
- if (registered_desktop_keys[i].type == DESKTOP_LOCALESTRING_LIST_TYPE) {
- gsize keylen;
- guint j;
-
- keylen = strlen (registered_desktop_keys[i].name);
- for (j = 0; j < keys_nb; j++) {
- if (g_str_has_prefix (keys[j], registered_desktop_keys[i].name) &&
- (keys[j][keylen] == '[' || keys[j][keylen] == '\0')) {
- fixup_list (keyfile, filename, keys[j]);
- }
- }
- }
- }
-
- g_strfreev (keys);
-
return TRUE;
}