Bug#372581: libgnomevfs2-common [libvfolder-desktop]: keywords in comment break *.desktop parser

Nikolaus Schulz microschulz at web.de
Sat Jun 10 11:43:33 UTC 2006


Package: libgnomevfs2-common
Version: 2.8.4-4
Severity: normal
Tags: patch

Hi!

This is probably sarge-only, see below.  If you take a *.desktop file
and put the 'Categories' keyword into a comment *before* the real
'Categories' keyword, this program disappears from the GNOME menu.
Here's a little shell script demonstrating the problem.

<script>
#!/bin/sh

PROG=mozilla-firefox

ed -s /usr/share/applications/$PROG.desktop <<EOF
/Categories/i
# BUG triggered by 'Categories' keyword in comment
.
wq
EOF

echo "Magic! $PROG's gone from the menu!"
echo "Hit a key to restore it."
read -n 1 DUMMY 

ed -s /usr/share/applications/$PROG.desktop <<EOF
/^# BUG trigg/d
wq
EOF
echo "Pheew! It's back."
</script>

    I've attached a patch fixing this for Sarge, ready to be dropped
into debian/patches.  I'd say the breaking code generally looks bad, but
at least the patch fixes this particular problem. 

    AFAIUI libvfolder-desktop has been dropped in favour of
libgnome-desktop as of Gnome 2.10.  I haven't tested Gnome in
testing/unstable, but the problem didn't appear in Ubuntu Breezy, that
is Gnome 2.12.

HAND,
Nikolaus


-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.4.27-deb.240306
Locale: LANG=de_DE at euro, LC_CTYPE=de_DE at euro (charmap=ISO-8859-15)

Versions of packages libgnomevfs2-common depends on:
ii  desktop-file-utils    0.10-1             Utilities for .desktop files
ii  gconf2                2.8.1-6            GNOME configuration database syste
ii  gnome-mime-data       2.4.2-1            base MIME and Application database
ii  libbonobo2-0          2.8.1-2            Bonobo CORBA interfaces library
ii  libbz2-1.0            1.0.2-7            high-quality block-sorting file co
ii  libc6                 2.3.2.ds1-22sarge3 GNU C Library: Shared libraries an
ii  libfam0c102           2.7.0-6sarge1      client library to control the FAM 
ii  libgconf2-4           2.8.1-6            GNOME configuration database syste
ii  libgcrypt11           1.2.0-11.1         LGPL Crypto library - runtime libr
ii  libglib2.0-0          2.6.4-1            The GLib library of C routines
ii  libgnomevfs2-0        2.8.4-4            The GNOME virtual file-system libr
ii  libgnutls11           1.0.16-13.2        GNU TLS library - runtime library
ii  libgpg-error0         1.0-1              library for common error values an
ii  liborbit2             1:2.12.2-1         libraries for ORBit2 - a CORBA ORB
ii  libpopt0              1.7-5              lib for parsing cmdline parameters
ii  libsmbclient          3.0.14a-3sarge1    shared library that allows applica
ii  libtasn1-2            0.2.10-3sarge1     Manage ASN.1 structures (runtime)
ii  libxml2               2.6.16-7           GNOME XML library
ii  shared-mime-info      0.16-3             FreeDesktop.org shared MIME databa
ii  zlib1g                1:1.2.2-4.sarge.2  compression library - runtime

-- no debconf information
-------------- next part --------------
diff -pur modules/vfolder/vfolder-common.c modules.new/vfolder/vfolder-common.c
--- modules/vfolder/vfolder-common.c	2006-06-10 11:43:59.000000000 +0200
+++ modules.new/vfolder/vfolder-common.c	2006-06-10 11:45:09.000000000 +0200
@@ -358,20 +358,26 @@ entry_add_implicit_keyword (Entry *entry
 static void
 entry_key_val_from_string (gchar *src, const gchar *key, gchar **result)
 {
-	gchar *start;
+	gchar *start, *cur;
 	gint keylen = strlen (key), end;
 
 	*result = NULL;
 
-	start = strstr (src, key);
-	if (start && 
-	    (start == src || (*(start-1) == '\r') || (*(start-1) == '\n')) &&
-	    ((*(start+keylen) == ' ') || (*(start+keylen) == '='))) {
-		start += keylen;
-		start += strspn (start, "= ");
-		end = strcspn (start, "\r\n");
-		if (end > 0)
-			*result = g_strndup (start, end);
+        cur = src; 
+        while (TRUE) {
+		start = strstr (cur, key);
+		if (!start) 
+			break;
+		if ((start == src || (*(start-1) == '\r') || (*(start-1) == '\n')) &&
+		    ((*(start+keylen) == ' ') || (*(start+keylen) == '='))) {
+			start += keylen;
+			start += strspn (start, "= ");
+			end = strcspn (start, "\r\n");
+			if (end > 0) 
+				*result = g_strndup (start, end);
+			break;
+		}
+		cur = start+keylen;
 	}
 }
 


More information about the Pkg-gnome-maintainers mailing list