Relative `Path=` entries in .desktop files
Matthias Klumpp
matthias at tenstral.net
Sat Apr 15 20:44:53 UTC 2017
2017-04-15 22:05 GMT+02:00 Sod.Almighty <sod.almighty at gmail.com>:
> Hi everyone,
>
> [Apparently formatted email is not acceptable on this mailing list. So here
> is a plain text version.]
The list probably had an allergy against Comic Sans... (and I can't
blame it ;-) )
> What happens if the Path= line of a *.desktop file is set to a relative
> path? For example:
>
> Path=mydir
>
> Or:
>
> Path=.
Nobody knows. Relative paths in .desktop files are not allowed by the
specification, so the implementations can straight out refuse to
launch anything, or do an arbitrary amount of undefined stuff, which
may include taking the .desktop file path as the basename and taking a
relative path from that, taking a relative path from $HOME, one from
the directory the desktop file was launched from, or doing something
completely different.
So: Don't do it.
=> https://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables
> The Exec key must contain a command line. A command line consists of an executable program optionally followed by one or more arguments. The executable program can either be specified with its full path or with the name of the executable only. If no full path is provided the executable is looked up in the $PATH environment variable used by the desktop environment. The name or path of the executable program may not contain the equal sign ("="). Arguments are separated by a space.
> We at the AppImage project (https://github.com/probonopd/AppImageKit) are
> wanting to use relative paths in *.desktop files to refer to locations
> relative to the root of the application mount point. Please see the github
> issue at
> (https://github.com/probonopd/AppImageKit/pull/384#issuecomment-294278492)
> for details.
>
> What do you guys think? Would this create some kind of conflict with
> existing path rules?
Yes. Aside from that, I am not sure whether it's a good idea to allow
relative paths for security reasons. Changing the definition of Exec=
will take a really long time until all implementations follow the
changed spec, so that might not be practical.
>From skimming through the bug report, I don't have any idea on what
actual problem you want to solve.
Can't AppImageKit use bindmount tricks to confine an application in an
environment with known paths? Or just rewrite the path at install time
to point to the right location?
Cheers,
Matthias
--
Debian Developer | Freedesktop-Developer
I welcome VSRE emails. See http://vsre.info/
More information about the xdg
mailing list