desktop entry spec 0.9.7 Exec key parsing

Dan Winship danw at
Mon Oct 30 23:10:10 EET 2006

On Mon, 2006-10-30 at 10:41 -0800, Bastian, Waldo wrote:
> >    * It says "arguments may be quoted in whole", but both GNOME and KDE
> >      also allow quoting arguments in part. Eg

> That's great, the spec doesn't allow these constructions though.

OK, I missed the fact that the reserved character list made some of my
examples illegal. Great.

> >    * It says that backslashes only escape text within double quotes,
> >      but GNOME and KDE both parse
> >
> >          one\ word
> >
> >      as one word and
> >
> >          \"two words\"
> >
> >      as two.
> Yes, so although these constructions are supported by GNOME and KDE, the
> spec doesn't allow them and you shouldn't use that.

The spec *does* allow those strings though, it just thinks they should
be split up differently from how GNOME and KDE do it. Adding backslash
to the reserved characters list would fix this.

> The single quote character is one of the reserved characters and as such
> you must use double quotes around an argument that contains a single
> quote. Using single quotes in any other way is not allowed by the spec,
> although GNOME and KDE might very well support that.

Well, this means some existing .desktop files that were considered
well-formed according to earlier versions of the spec are now considered
invalid, and future .desktop file parsers might not parse them as their
authors intended. (Google codesearch turns up a handful of .desktop
files using single quotes, but only a handful, so maybe it's not that

There are also a bunch of .desktop files that use "=" unquoted, which is
now considered wrong. Eg:

    Exec=nautilus-cd-burner --source-iso=%f

Maybe make "=" only be reserved in argv[0]? (I assume you put it there
so that attempts to set environment variables would be marked as

-- Dan

More information about the xdg mailing list