Subject: Re: bug#67736: 30.0.50; emacsclient.desktop fails with quoting-related error

From: Mekeor Melire <[email-masked]>
Date: Sun, 10 Dec 2023 11:14:25 +0000

2023-12-10 08:17 [email-masked]:

> Why does emacsclient exit with a failure in that case?  When I try
> invoking emacsclient from the shell prompt, it exits with a zero exit
> status, not with a failure.

Invoking emacsclient from shell prompt directly, works just fine for me
too. Supposedly, it's not emacsclient that exists with failure but the
sh command mentioned below.

> What is the command that is run with the current emacsclient.desktop
> file?

Unfortunately, I don't know which command xdg-open tries to execute
exactly. But the configuration (in Emacs' emacsclient.desktop) is this:

    Exec=sh -c "if [ -n \\"\\$*\\" ]; then exec emacsclient
    --alternate-editor= --display=\\"\\$DISPLAY\\" \\"\\$@\\"; else exec
    emacsclient --alternate-editor= --create-frame; fi" sh %F

    https://git.sv.gnu.org/cgit/emacs.git/tree/etc/emacsclient.desktop?h=cf11fdfd8e460d966ba279f00633ab378038de68#n6

Note that the Exec key of .desktop files has very complicated quoting
rules:

    https://specifications.freedesktop.org/desktop-entry-spec/1.1/ar01s06.html

By the way, I found a recent bug report on the Github website of the
Telegram-Desktop repository that mentions the same problem that I'm
experiencing:

    https://github.com/telegramdesktop/tdesktop/issues/27100

Actually, I have the feeling that this is a bug in xdg-utils. I will
file a bug report there.

In the mean time, should we work-around this bug by just using this or
something similar?:

    Exec=emacsclient --alternate-editor= --create-frame %F