Subject: bug#74467: 31.0.50; org-protocol emacsclient.desktop change is not fully functional

From: Björn Bidar <[email-masked]>
Date: Sun, 05 Jan 2025 20:13:09 +0200

Ihor Radchenko <[email-masked]> writes:

> Eli Zaretskii <[email-masked]> writes:
>
>> ...  Ihor
>> seemed to say that if this can be supported, there could be an
>> alternative patch for fixing this issue, and I'd like to see that
>> alternative patch to decide which one is simpler and/or more elegant.
>
> See the attached.
> If Emacs can handle file URIs, we can simply use %U field code.
>
> diff --git a/etc/emacsclient.desktop b/etc/emacsclient.desktop
> index 4395d3b02bc..c339ac93687 100644
> --- a/etc/emacsclient.desktop
> +++ b/etc/emacsclient.desktop
> @@ -3,7 +3,7 @@ Name=Emacs (Client)
>  GenericName=Text Editor
>  Comment=Edit text
>  MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;x-scheme-handler/org-protocol;
> -Exec=sh -c "if [ -n \\"\\$*\\" ]; then exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" \\"\\$@\\"; else exec emacsclient --alternate-editor= --create-frame; fi" sh %F
> +Exec=sh -c "if [ -n \\"\\$*\\" ]; then exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" \\"\\$@\\"; else exec emacsclient --alternate-editor= --create-frame; fi" sh %U

Do we need the shell code here? if DISPLAY is defined emacsclient could
shurely forward it to Emacs.

Shellcode is part of the issue.