Desktop Entry Specification needs clarification

Oswald Buddenhagen ossi at kde.org
Fri Oct 8 06:04:04 PDT 2010


On Fri, Oct 08, 2010 at 01:53:24PM +0200, Karl Mikaelsson wrote:
> > Values of type string may contain all ASCII characters except for
> > control characters.
> 
> What's the definition of control characters? < 0x20? <= 0x20?
> 
per ascii, it is < 0x20.

> How should unknown escape sequences be handled? I.e. does "\k" mean
> "\k" or "k"?
> 
whatever. it's invalid.

about the quoting in general, you are confusing things. there are two
distinct layers of quoting: the .ini file quoting and the shell quoting.
the spec concerns the .ini file quoting, with escaping of control chars
and leading/trailing spaces (yes, only these *need* escaping). what
comes out of that for the Exec key is a shell command and is subject to
the shell's quoting rules, and this is what determines how empty
arguments are represented, etc.
that's how kde implemented it long before the spec was written, and
anyone who thinks something different is meant should be shot. ;)

consequently, the %f, etc. expandos appear in shell command context, so
the expanded strings need to be properly quoted for shell consumption.
this poses interesting challenges if the user already quoted the
expando, etc. - our answer is expandMacrosShellQuote() in
http://api.kde.org/4.5-api/kdelibs-apidocs/kdecore/html/namespaceKMacroExpander.html
(and
http://websvn.kde.org/trunk/KDE/kdelibs/kdecore/util/kmacroexpander.h?view=markup
for some more details).


More information about the xdg mailing list