From: Ulrich Müller Date: Wed, 8 Mar 2023 18:37:27 +0000 (+0100) Subject: Avoid using bash in the emacsclient desktop file X-Git-Tag: emacs-29.0.90~221 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c8ec0017cb9;p=emacs.git Avoid using bash in the emacsclient desktop file * etc/emacsclient-mail.desktop (Exec): Use sh and sed instead of bash, because the latter may not be available everywhere. --- diff --git a/etc/emacsclient-mail.desktop b/etc/emacsclient-mail.desktop index 49c6f99f317..0a2420ddead 100644 --- a/etc/emacsclient-mail.desktop +++ b/etc/emacsclient-mail.desktop @@ -2,9 +2,9 @@ Categories=Network;Email; Comment=GNU Emacs is an extensible, customizable text editor - and more # We want to pass the following commands to the shell wrapper: -# u=${1//\\/\\\\}; u=${u//\"/\\\"}; exec emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"$u\")" +# u=$(echo "$1" | sed 's/[\"]/\\&/g'); exec emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"$u\")" # Special chars '"', '$', and '\' must be escaped as '\\"', '\\$', and '\\\\'. -Exec=bash -c "u=\\${1//\\\\\\\\/\\\\\\\\\\\\\\\\}; u=\\${u//\\\\\\"/\\\\\\\\\\\\\\"}; exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" bash %u +Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u Icon=emacs Name=Emacs (Mail, Client) MimeType=x-scheme-handler/mailto; @@ -16,7 +16,7 @@ Actions=new-window;new-instance; [Desktop Action new-window] Name=New Window -Exec=bash -c "u=\\${1//\\\\\\\\/\\\\\\\\\\\\\\\\}; u=\\${u//\\\\\\"/\\\\\\\\\\\\\\"}; exec emacsclient --alternate-editor= --create-frame --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" bash %u +Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --create-frame --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u [Desktop Action new-instance] Name=New Instance