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

From: Eli Zaretskii <[email-masked]>
Date: Sun, 10 Dec 2023 08:17:37 +0200

> From: Mekeor Melire <[email-masked]>
> Date: Sun, 10 Dec 2023 00:13:33 +0000
> 
> In GNU+Linux, in Xorg, with xdg-utils installed, and with
> emacsclient.desktop[1] from Emacs repository installed, configure the
> mapping from mime-types to applications by creating a file
> ~/.config/mimeapps.list with contents:
> 
>     [Default Applications]
>     text/plain=emacsclient.desktop
> 
> Create a plain-text file and open it with the XDG default application:
> 
>     echo hello > example.txt
>     xdg-open example.txt
> 
> I expect Emacsclient to start and open the file. Instead, I get the
> following error messages which point to quoting-related problems.
> 
>     $ xdg-open example.txt
>     egrep: warning: egrep is obsolescent; using grep -E
>     [: -c: line 1: unexpected EOF while looking for matching `"'
>     [: -c: line 2: syntax error: unexpected end of file
>     [: -c: line 1: unexpected EOF while looking for matching `"'
>     [: -c: line 2: syntax error: unexpected end of file
>     [: -c: line 1: unexpected EOF while looking for matching `"'
>     [: -c: line 2: syntax error: unexpected end of file
> 
> Apparently, since the default application Emacsclient exits with
> failure, xdg-open then proceeds by trying out other applications that
> have an installed .desktop-file. Thus another program opens the file.

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.

> It seems like it is a problem introduced with bug#49195 / commit
> cbf220bc31c0a00c45b22c140eda7854d81d991b [2]. All versions of the Exec=
> line of emacsclient.desktop result in the same erroneous behavior for me
> since this commit. I.e. the last version that works is just:
> 
>     Exec=emacsclient -c %F

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