anyrun icon indicating copy to clipboard operation
anyrun copied to clipboard

Applications: Properly parse desktop exec keys and stop shelling out

Open sents opened this issue 11 months ago • 1 comments

https://specifications.freedesktop.org/desktop-entry-spec/latest/exec-variables.html describes how commands and their arguments are stored in the exec key. As the exec key is a string type as defined in https://specifications.freedesktop.org/desktop-entry-spec/latest/value-types.html escapes code for certain characters have to be respected. After this there are rules which characters necessitate a quoted string and which characters need to be escaped in a quoted string. To use the exec key for executing we then need to unescape these characters and can collect the args in a vector. This enables us to stop shelling out when executing desktop files and instead call Command directly with the specified program and arguments.

sents avatar Jan 16 '25 20:01 sents

I just want to +1 this, as it's been sitting here a while. I have run into cases where the error in parsing means that .desktop files don't work.

pope avatar Feb 26 '25 00:02 pope