diff options
author | Ulrich Müller <ulm@gentoo.org> | 2023-03-07 18:26:48 +0100 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2023-03-07 18:26:48 +0100 |
commit | 0f29d9f2912573e696b9cb6019cb036246d7d21e (patch) | |
tree | 99d2b13cbfb30ab443cade1bc041a5a04bd11f52 /x11-misc | |
parent | net-misc/bird: Make the compilation and test phases verbose (diff) | |
download | gentoo-0f29d9f2912573e696b9cb6019cb036246d7d21e.tar.gz gentoo-0f29d9f2912573e696b9cb6019cb036246d7d21e.tar.bz2 gentoo-0f29d9f2912573e696b9cb6019cb036246d7d21e.zip |
x11-misc/emacs-desktop-mail: Backslash-escape '\' and '"'
Escape any backslash and double quote characters, before passing the URI
to emacsclient.
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
Diffstat (limited to 'x11-misc')
-rw-r--r-- | x11-misc/emacs-desktop-mail/emacs-desktop-mail-1.2.ebuild (renamed from x11-misc/emacs-desktop-mail/emacs-desktop-mail-1.1.ebuild) | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/x11-misc/emacs-desktop-mail/emacs-desktop-mail-1.1.ebuild b/x11-misc/emacs-desktop-mail/emacs-desktop-mail-1.2.ebuild index 92d93860fb2f..aa83394f2032 100644 --- a/x11-misc/emacs-desktop-mail/emacs-desktop-mail-1.1.ebuild +++ b/x11-misc/emacs-desktop-mail/emacs-desktop-mail-1.2.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2022 Gentoo Authors +# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -29,8 +29,12 @@ src_install() { # The Desktop Entry Specification does not allow field codes like %u # inside a quoted argument, therefore we need a shell wrapper. - # We want to pass a literal '"(message-mailto \"$1\")"' in the -c - # command, but in the desktop entry '"', '\', and '$' must be escaped + # We pass the following commands to it, in order to backslash-escape + # any special characters '\' and '"' that occur in %u: + # u=${1//\\/\\\\} + # u=${u//\"/\\\"} + # exec emacsclient --eval "(message-mailto \"$u\")" + # However, in the desktop entry '"', '\', and '$' must be escaped # as '\\"', '\\\\', and '\\$', respectively. Yet another level of # backslash escapes is needed for '\' and '$' in the here-document. newmenu - emacsclient-mail.desktop <<-EOF @@ -38,8 +42,11 @@ src_install() { Type=Application Name=Emacsclient (mail) NoDisplay=true - Exec=${EPREFIX}/bin/bash -c "exec ${EPREFIX}/usr/bin/emacsclient \ ---eval \\\\"(message-mailto \\\\\\\\\\\\"\\\\\$1\\\\\\\\\\\\")\\\\"" bash %u + Exec=${EPREFIX}/bin/bash -c \ +"u=\\\\\${1//\\\\\\\\\\\\\\\\/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\}; \ +u=\\\\\${u//\\\\\\\\\\\\"/\\\\\\\\\\\\\\\\\\\\\\\\\\\\"}; \ +exec ${EPREFIX}/usr/bin/emacsclient \ +--eval \\\\"(message-mailto \\\\\\\\\\\\"\\\\\$u\\\\\\\\\\\\")\\\\"" bash %u Terminal=false MimeType=x-scheme-handler/mailto; EOF |