desktop entry spec 0.9.7 Exec key parsing

Bastian, Waldo waldo.bastian at
Mon Oct 30 20:41:41 EET 2006

>The Exec key parsing text got rewritten to not refer vaguely to a
>13-year-old RFC, which is nice, but now that it's explicit, it's also
>totally wrong ;-)

It describes a limited set of functionality that an implementation must
support. Existing implementations support all kinds of additional
functionality which is great, but not covered by the spec.

>    * 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.

>    * It talks about double quotes, but not single quotes (implying
>      single quotes would be passed through to the application
>      unchanged). GNOME and KDE both allow arguments to be single
>      quoted, and backslashes have no effect inside single quotes.

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.

>    * It says "arguments may be quoted in whole", but both GNOME and
>      also allow quoting arguments in part. Eg
>          foo" bar"
>      is the same as
>          "foo bar"

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

>    * There are two explicit lists of reserved characters that are
>      assumed to be treated specially, but neither GNOME nor KDE
>      actually treats *exactly* that set of characters specially.

The reserved characters define how a well formed Exec line must look
like. GNOME and KDE must treat such a well-formed Exec line correctly.
How they treat these reserved characters outside of a well-formed Exec
line is really not very interesting.

>If you want to specify the syntax and semantics rigorously, then you
>either need to look at what the existing implementations actually do,
>declare that the existing implementations are wrong (in which case bye
>bye 1.0).

The Exec line spec isn't a reflection of (everything) what GNOME and KDE
do, it is a recipe for how to create an Exec line that is supported by
GNOME and KDE and other conforming implementations and it provides
conforming implementations with a limited set of syntactical
constructions that they must be able to deal with.

>The simplest solution is probably to just handwave and say
>things like "you should quote arguments that use special characters
>might be interpreted specially by shells".

That doesn't really help anyone.


More information about the xdg mailing list