Fix quoted argument in emacsclient-mail.desktop Exec key

Apparently the emacsclient-mail.desktop file doesn't conform to the
Desktop Entry Specification at
https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#exec-variables
which says about the Exec key:

| Field codes must not be used inside a quoted argument, the result of
| field code expansion inside a quoted argument is undefined.

However, the %u field code is used inside a quoted argument of the
Exec key in both the [Desktop Entry] and [Desktop Action new-window]
sections.
* etc/emacsclient-mail.desktop (Exec): The Desktop Entry
Specification does not allow field codes like %u inside a quoted
argument. Work around it by passing %u as first parameter ($1)
to the shell wrapper.
* etc/emacsclient.desktop (Exec): Use `sh` rather than `placeholder`
as the command name of the shell wrapper.  (Bug#60204)
This commit is contained in:
Ulrich Müller 2022-12-19 16:51:20 +01:00 committed by Eli Zaretskii
parent 286c48137f
commit d32091199a
2 changed files with 3 additions and 3 deletions

View file

@ -1,7 +1,7 @@
[Desktop Entry] [Desktop Entry]
Categories=Network;Email; Categories=Network;Email;
Comment=GNU Emacs is an extensible, customizable text editor - and more Comment=GNU Emacs is an extensible, customizable text editor - and more
Exec=sh -c "exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\\\(message-mailto\\\\ \\\\\\"%u\\\\\\"\\\\)" Exec=sh -c "exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\"(message-mailto \\\\\\"\\$1\\\\\\")\\"" sh %u
Icon=emacs Icon=emacs
Name=Emacs (Mail, Client) Name=Emacs (Mail, Client)
MimeType=x-scheme-handler/mailto; MimeType=x-scheme-handler/mailto;
@ -13,7 +13,7 @@ Actions=new-window;new-instance;
[Desktop Action new-window] [Desktop Action new-window]
Name=New Window Name=New Window
Exec=emacsclient --alternate-editor= --create-frame --eval "(message-mailto \\"%u\\")" Exec=sh -c "exec emacsclient --alternate-editor= --create-frame --eval \\"(message-mailto \\\\\\"\\$1\\\\\\")\\"" sh %u
[Desktop Action new-instance] [Desktop Action new-instance]
Name=New Instance Name=New Instance

View file

@ -3,7 +3,7 @@ Name=Emacs (Client)
GenericName=Text Editor GenericName=Text Editor
Comment=Edit text 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++; 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++;
Exec=sh -c "if [ -n \\"\\$*\\" ]; then exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" \\"\\$@\\"; else exec emacsclient --alternate-editor= --create-frame; fi" placeholder %F Exec=sh -c "if [ -n \\"\\$*\\" ]; then exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" \\"\\$@\\"; else exec emacsclient --alternate-editor= --create-frame; fi" sh %F
Icon=emacs Icon=emacs
Type=Application Type=Application
Terminal=false Terminal=false