Bug#930674: automatically generated menus prevent some applications from running

E. Serradilla eserradi at gmx.com
Wed Jun 19 10:25:33 BST 2019

On 6/19/19 10:20 AM, Jeremy Sowden wrote:
> On 2019-06-18, at 12:26:19 +0200, E. Serradilla wrote:
>> Package: wmaker
>> Version: 0.95.8-3
>> automatically generated menus prevent some applications from running,
>> e.g. libreoffice will not run complaining that file "%U does not
>> exist" and others will open an empty file, e.g. %F.
>> Looking at the code the XDG menu parser does not strip "%X" arguments
>> from Exec entries, I attached a sample patch as a workaround to this
>> problem.
> Your patch truncates any string value at the first %.  I don't think
> that's the right way to go.

yes this is only a workaround to the problem, but without it the current
generated menus do not work well in most of the cases

> The comments at the top of the source file read as follows:
>    * We will only deal with Type == "Application" entries in [Desktop
>    * Entry] groups. Since there is no passing of file name arguments or
>    * anything of the sort to applications from the menu, execname is
>    * determined as follows:
>    * - If `TryExec' is present, use that;
>    * - else use `Exec' with any switches stripped
> Clearly this is not what the code actually does.  The quick hack would
> be to change xdg_to_wm() to truncate the command-line at the first
> instance of white-space (which is what is done to derive (*wm)->Name
> from (*xdg)->Exec or (*xdg)->TryExec); the right thing to do would be to
> implement the FDO quoting rules first:
>    https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.1.html#exec-variables
> Doesn't look too hard.  I'll put something together.
> J.

that would be very good, however you need to take into account that some
applications need some arguments at the command-line to run e.g. in my
/usr/share/applications/libreoffice-writer.desktop I have the following

Exec=libreoffice --writer %U

that's why I truncated the command at the first % and remove the
trailing whitespace to have

libreoffice --writer

truncating at the first whitespace would have not worked...

More information about the Pkg-wmaker-devel mailing list