From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 12 22:24:42 2023 Received: (at submit) by debbugs.gnu.org; 13 Sep 2023 02:24:42 +0000 Received: from localhost ([127.0.0.1]:60395 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgFYX-0008As-C0 for submit@debbugs.gnu.org; Tue, 12 Sep 2023 22:24:42 -0400 Received: from lists.gnu.org ([2001:470:142::17]:58296) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgFYS-0008Ae-OA for submit@debbugs.gnu.org; Tue, 12 Sep 2023 22:24:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qgFYI-0004bd-E7 for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 22:24:26 -0400 Received: from s.wrqvtzvf.outbound-mail.sendgrid.net ([149.72.126.143]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qgFYF-0002eF-Gj for bug-gnu-emacs@gnu.org; Tue, 12 Sep 2023 22:24:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=from:subject:mime-version:to:content-type:content-transfer-encoding: cc:content-type:from:subject:to; s=s1; bh=7+nMK057e/Bq9DoDE7uv4qRUxuDi4QuAP1EKfGEJEBY=; b=WbzBa6s8GPcWwIK3WL+yZASMkXz8P1gD7ZnEqJKkjeYYF5mHORzwuahZZ2Yt61IaUF2C shhRNX14pAH4YWM0+yXrEnn9acQ/P96PSDttOcFsk+1LTv1Ayng5Egge9QJZEKRcfPFjdT N4GqOoGQlgREMJ5GZQ4V750vjSC2bT2hTidhq88HjejEsDoJHWAneHYbQDDf4InTkNlM9P lI53ksir7qKLIWrlIgaTYhk13hCUDdoY6pVmT9b8t7wl5Y6To2GtXOUjhz19ZokR80qyPh Up4PCOg1vpP9wL93ZRtUvgWppY+pDRnTTrzXJnn2IkgokLrHghna/W9+l4anWvSQ== Received: by filterdrecv-canary-6695df9f56-dwxq4 with SMTP id filterdrecv-canary-6695df9f56-dwxq4-1-65011D54-10 2023-09-13 02:24:20.809477446 +0000 UTC m=+10809956.203441843 Received: from earth.catern.com (unknown) by geopod-ismtpd-4 (SG) with ESMTP id FYxEy5YXQdK2EVpQC7TMQg for ; Wed, 13 Sep 2023 02:24:20.584 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost; envelope-from=sbaugh@catern.com; receiver=gnu.org Received: from localhost (localhost [IPv6:::1]) by earth.catern.com (Postfix) with ESMTPSA id C46C560129 for ; Tue, 12 Sep 2023 22:24:19 -0400 (EDT) From: sbaugh@catern.com Subject: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping Date: Wed, 13 Sep 2023 02:24:20 +0000 (UTC) Message-ID: <871qf2vmi4.fsf@catern.com> MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbIq2yG8CYjCabLjQokKWv?= =?us-ascii?Q?045nHdOWLJcBTnKe+KbokBe022QH+hTboOlE1l7?= =?us-ascii?Q?KXXuVRtQec8TFwMzmxiCj9IV8OHTHT1JsoC1Tdd?= =?us-ascii?Q?D7gyXTXF92Y9KU9X=2FCr6=2FMYy+qZyRSUxmNzhZGC?= =?us-ascii?Q?t5cbV+SFhXpS03ROthy2FDWlFYjIvTrks0kWQ55?= =?us-ascii?Q?IakBTA4fULNrutXFI=3D?= To: bug-gnu-emacs@gnu.org X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=149.72.126.143; envelope-from=bounces+21787432-3678-bug-gnu-emacs=gnu.org@em8926.catern.com; helo=s.wrqvtzvf.outbound-mail.sendgrid.net X-Spam_score_int: -7 X-Spam_score: -0.8 X-Spam_bar: / X-Spam_report: (-0.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_BL_SPAMCOP_NET=1.347, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 2.2 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The emacsclient-mail.desktop file fails on my system with the following error: "$1": -c: line 2: unexpected EOF while looking for matching `)' My subsequent mail will fix this also vastly simplify emacsclient-mail.desktop by adding a new feature to emacsclient to avoid the need for complex escaping. Content analysis details: (2.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The emacsclient-mail.desktop file fails on my system with the following error: "$1": -c: line 2: unexpected EOF while looking for matching `)' My subsequent mail will fix this also vastly simplify emacsclient-mail.desktop by adding a new feature to emacsclient to avoid the need for complex escaping. Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager The emacsclient-mail.desktop file fails on my system with the following error: "$1": -c: line 2: unexpected EOF while looking for matching `)' My subsequent mail will fix this also vastly simplify emacsclient-mail.desktop by adding a new feature to emacsclient to avoid the need for complex escaping. In GNU Emacs 29.0.92 (build 68, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw3d scroll bars) of 2023-07-15 built on earth Repository revision: 36d3460f9f6064c03fd88e0c969c8e4f4d645235 Repository branch: emacs-29 Windowing system distributor 'The X.Org Foundation', version 11.0.12101008 System Description: NixOS 23.05 (Stoat) Configured using: 'configure --cache-file=3Dconfig.cache --with-x-toolkit=3Dlucid --with-tree-sitter --with-xinput2 CC=3Dgcc PKG_CONFIG=3Dpkg-config PKG_CONFIG_PATH=3D/nix/store/s3r15m8wbl4wqk4khqlf41ikryhjm1bi-file-5.44-de= v/lib/pkgconfig:/nix/store/f9jbn419h46c78z1pi49yn9a8742b0ql-gnutls-3.8.0-de= v/lib/pkgconfig:/nix/store/knq0pv08wm4dins7m4jh0n7cv7pjvdjr-nettle-3.9.1-de= v/lib/pkgconfig:/nix/store/dy8p07vrrhdgpnl45xz9c0k0didbikdh-gmp-with-cxx-6.= 2.1-dev/lib/pkgconfig:/nix/store/6hkdabzyqhyq5ypq4c9b2cibr1d1zg1s-harfbuzz-= 7.3.0-dev/lib/pkgconfig:/nix/store/hyns944pqgblw4icskylvlpm5krmfvcr-graphit= e2-1.3.14-dev/lib/pkgconfig:/nix/store/08cdp9vgvy023ysfa2y01gzsm2jv6phx-jan= sson-2.14/lib/pkgconfig:/nix/store/nqlbk40lh7igs61l77dwgdkn8dc2akcm-libxml2= -2.10.4-dev/lib/pkgconfig:/nix/store/b3axl73v3yvqqx7g47njqb5wzxvm280p-zlib-= 1.2.13-dev/lib/pkgconfig:/nix/store/3f2rc4inlcxmq11718qmz94v2rpybw70-ncurse= s-6.4-dev/lib/pkgconfig:/nix/store/bxy745kyb1fwhpfkiaaz3wgvpkpvwcpq-dbus-1.= 14.8-dev/lib/pkgconfig:/nix/store/9714v7c4cgpm4yqcyqk6n9xw9iq3a1bs-expat-2.= 5.0-dev/lib/pkgconfig:/nix/store/zzi7pcadidqh798yddxv6pwdbwpkikma-libselinu= x-3.3-dev/lib/pkgconfig:/nix/store/w14j7y5nl14vy4ikcivss35jmrqq3fxj-libotf-= 0.9.16-dev/lib/pkgconfig:/nix/store/arhk7hsch4scyv6m24fw03yq6wq5wbbx-m17n-l= ib-1.8.2/lib/pkgconfig:/nix/store/1jbbrny8xcjb68lb5m30cvxycfkyhvsv-sqlite-3= .42.0-dev/lib/pkgconfig:/nix/store/5vx779yqkxaysv48gicwlgv0ippbrhc4-systemd= -253.5-dev/lib/pkgconfig:/nix/store/5vx779yqkxaysv48gicwlgv0ippbrhc4-system= d-253.5-dev/share/pkgconfig:/nix/store/djifahvk3qp06ssqxv6gy1ixdnnypr9s-tre= e-sitter-0.20.8/lib/pkgconfig:/nix/store/74aasy1d2r5y27zn68cs1rxwy1llzn05-l= ibwebp-1.3.0/lib/pkgconfig:/nix/store/8sk7bp89iwb4gw96fq6xakb6lcy2x52n-Xaw3= d-1.6.3/lib/pkgconfig:/nix/store/ppvb3ha8148am3ajnzxnm6i3ri38c01n-libXmu-1.= 1.3-dev/lib/pkgconfig:/nix/store/jyxf8cjbj3nzh00x48nfram79i63chdi-libX11-1.= 8.6-dev/lib/pkgconfig:/nix/store/zk9v0nr5zdfi1ybkhcfifmxsng7hfl23-xorgproto= -2021.5/share/pkgconfig:/nix/store/3q1k18v8aa6mxs538bha4ry0mp3m321l-libxcb-= 1.14-dev/lib/pkgconfig:/nix/store/hcscz68zvfk1skyb25wrnha959f6hhrc-libXt-1.= 2.1-dev/lib/pkgconfig:/nix/store/kl55wj6qc3v481jsgvzm5w2csnhm84zf-libSM-1.2= .3-dev/lib/pkgconfig:/nix/store/s3f67kvsn55rxp2rc98xv0hkq364yci1-libICE-1.0= .10-dev/lib/pkgconfig:/nix/store/rsw4ri8025jgln8vpsrmg82bzgbcw3zr-cairo-1.1= 6.0-dev/lib/pkgconfig:/nix/store/jir0rqbcy0d9qr9kf5cwf2yphql4ykyw-fontconfi= g-2.14.2-dev/lib/pkgconfig:/nix/store/n2g3xblaz1k4civv1z6hhm1nsmp3m17p-free= type-2.13.0-dev/lib/pkgconfig:/nix/store/isbmyzm2shmp0wsjr4cy45v2i58h2zvw-b= zip2-1.0.8-dev/lib/pkgconfig:/nix/store/bl2qwy78jr2sqm260imgxmd5dzhjqvag-br= otli-1.0.9-dev/lib/pkgconfig:/nix/store/z96jh9ag5b3565lwwb5chjb9bfp5i2qv-li= bpng-apng-1.6.39-dev/lib/pkgconfig:/nix/store/jjd4z18grhky6lh8n463v648nnf56= 28b-pixman-0.42.2/lib/pkgconfig:/nix/store/qd14wrazwcspjv3q65vgh35pl7b8nifq= -libXext-1.3.4-dev/lib/pkgconfig:/nix/store/gj8i21xx87ip9b971j2d1m0rmrzyhbi= r-libXau-1.0.9-dev/lib/pkgconfig:/nix/store/4gpinwwdqhi927xkrfpr1hvdd56baxg= k-libXrender-0.9.10-dev/lib/pkgconfig:/nix/store/d1jbygs6hcn6dysk706i9zf07y= d18wmr-xcb-util-0.4.1-dev/lib/pkgconfig:/nix/store/hdc4ika0mb1cv0cf6dchwxbr= 004rc50i-glib-2.76.3-dev/lib/pkgconfig:/nix/store/wxyh848a6xcqy2v8727vcwspr= i53pqwi-libffi-3.4.4-dev/lib/pkgconfig:/nix/store/42jx72681qzliic0xsjhvx24c= il2gapk-libGL-1.6.0-dev/lib/pkgconfig:/nix/store/b9lmdkxpvgkj6zc956fvhshzis= qpi767-libglvnd-1.6.0-dev/lib/pkgconfig:/nix/store/gff29sbhg1gcw969mpm5rb69= 3kj5v18w-libXaw-1.0.14-dev/lib/pkgconfig:/nix/store/776xijk8rsb1b4c0dsxwq0k= 82bvm7mm9-libXpm-3.5.15-dev/lib/pkgconfig:/nix/store/qizdmm43xi65mdngal8bpb= pqcdc8290d-libjpeg-turbo-2.1.5.1-dev/lib/pkgconfig:/nix/store/db7ix62fx4nvr= 9j1fjdvnznl2npff4pr-librsvg-2.55.1-dev/lib/pkgconfig:/nix/store/q0hg0951w1d= v9y40m9ggln8phwil6lxc-gdk-pixbuf-2.42.10-dev/lib/pkgconfig:/nix/store/34rr5= nvgljsc4bi3mxjxg8abmjr1f7hn-libtiff-4.5.0-dev/lib/pkgconfig:/nix/store/zwkr= 4kjcjs213pw9mhzi46bzlw6qwxzq-libdeflate-1.18/lib/pkgconfig:/nix/store/6na55= 2yzwml88j8g5vqf5h9ir3vw8myi-xz-5.4.3-dev/lib/pkgconfig CXX=3Dg++' Configured features: CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XAW3D XDBE XIM XPM LUCID ZLIB Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Diff Minor modes in effect: whitespace-mode: t envrc-global-mode: t envrc-mode: t global-git-commit-mode: t magit-auto-revert-mode: t shell-dirtrack-mode: t server-mode: t windmove-mode: t pixel-scroll-precision-mode: t savehist-mode: t save-place-mode: t tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tab-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t context-menu-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t buffer-read-only: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: /home/sbaugh/.emacs.d/elpa/transient-0.3.7/transient hides /home/sbaugh/src= /emacs/emacs-29/lisp/transient Features: (shadow sort emacsbug mpv tq org-timer org-clock org org-macro org-pcomplete org-list org-footnote org-faces org-entities ob-python python compat ob ob-tangle org-src ob-ref ob-lob ob-table ob-exp ob-comint ob-emacs-lisp ob-core ob-eval org-cycle org-table ol org-fold org-fold-core org-keys oc org-loaddefs cal-menu calendar cal-loaddefs org-version org-compat org-macs vc-src vc-sccs vc-svn vc-cvs vc-rcs gud noutline outline debug backtrace shortdoc pcmpl-unix pcmpl-gnu misc pulse color compile etags fileloop generator xref cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs bug-reference find-func cl-print help-fns radix-tree mail-extr rng-xsd xsd-regexp rng-cmpct rng-nxml rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap sgml-mode facemenu dom nxml-util nxml-enc xmltok whitespace log-view vc conf-mode dabbrev tabify man mule-util jka-compr tramp-cmds misearch multi-isearch vc-hg vc-bzr nix-mode nix-repl nix-shell nix-store nix-log nix-instantiate nix-shebang nix-format nix tramp-cache time-stamp tramp-sh tramp tramp-loaddefs trampver tramp-integration tramp-compat parse-time iso8601 cus-start vc-git vc-dispatcher dired-aux dired-x ffap sh-script smie treesit executable project files-x face-remap exwm-randr xcb-randr exwm exwm-input xcb-keysyms xcb-xkb exwm-manage exwm-floating xcb-cursor xcb-render exwm-layout exwm-workspace exwm-core xcb-ewmh xcb-icccm xcb xcb-xproto xcb-types xcb-debug lui-autopaste circe advice lui-irc-colors irc gnutls lcs lui-logging lui-format lui tracking shorten thingatpt flyspell ispell circe-compat agda2 envrc inheritenv page-ext magit-extras magit-submodule magit-obsolete magit-blame magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit magit-sequence magit-notes magit-worktree magit-tag magit-merge magit-branch magit-reset magit-files magit-refs magit-status magit magit-repos magit-apply magit-wip magit-log which-func imenu magit-diff smerge-mode diff diff-mode git-commit rx log-edit message sendmail yank-media puny dired desktop frameset dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log magit-core magit-autorevert autorevert filenotify magit-margin magit-transient magit-process with-editor shell pcomplete comint ansi-osc server ansi-color magit-mode transient cl-extra edmacro kmacro help-mode format-spec magit-git magit-section magit-utils crm dash windmove easy-mmode pixel-scroll cua-base ring modus-vivendi-theme modus-themes pcase cus-edit pp cus-load icons wid-edit savehist saveplace finder-inf ace-window-autoloads auctex-autoloads tex-site avy-autoloads circe-autoloads corfu-autoloads compat-autoloads csv-mode-autoloads cyberpunk-theme-autoloads debbugs-autoloads eat-autoloads envrc-autoloads exwm-autoloads ggtags-autoloads graphviz-dot-mode-autoloads htmlize-autoloads inheritenv-autoloads magit-autoloads git-commit-autoloads markdown-mode-autoloads mastodon-autoloads mentor-autoloads async-autoloads mpv-autoloads nix-mode-autoloads magit-section-autoloads dash-autoloads notmuch-autoloads persist-autoloads request-autoloads rust-mode-autoloads transient-autoloads url-scgi-autoloads vundo-autoloads which-key-autoloads info with-editor-autoloads xelb-autoloads xml-rpc-autoloads package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify dynamic-setting system-font-setting font-render-setting cairo x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 793112 58580) (symbols 48 42890 0) (strings 32 165901 6428) (string-bytes 1 8295556) (vectors 16 90751) (vector-slots 8 2007121 64111) (floats 8 418 578) (intervals 56 43463 2379) (buffers 984 111)) From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 12 22:30:26 2023 Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 02:30:26 +0000 Received: from localhost ([127.0.0.1]:60417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgFe5-0008LY-Dw for submit@debbugs.gnu.org; Tue, 12 Sep 2023 22:30:25 -0400 Received: from s.wfbtzhsv.outbound-mail.sendgrid.net ([159.183.224.104]:28810) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgFe0-0008L2-Pd for 65902@debbugs.gnu.org; Tue, 12 Sep 2023 22:30:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=from:subject:in-reply-to:references:mime-version:to:content-type:cc: content-type:from:subject:to; s=s1; bh=ezrooZthfeKLIZmlQWNKH3PwgULf5uR0Ly6cTSrcCwo=; b=ouySX6E9PvVrLS2RbwEvDz4t5aRRv65Yr/WyFPiZw/xQeSiNjxhRrOI4b95BTHLXYSD5 iRrdGBgcbV3cSXis+lxTUhRsy8AjC0vCHRAxzMXAfJCK8pkMYEU75ND0xX9du2mRni5wGc tJGA0FcZjgnyLDiMw0+IbhRaMavu29WpV2dfs8mjKV/lMqFcj6mNwBsBLMxDldMTHdX0yH +x/v2RyAe1eS8At9YzlS+3msu0zBF0qbQ6TX0nd54yFBfS0glcvwfERN68fAV5b2FZbvGD +rPZc6nZr019l69qpndijFruNnTNOdFMs3S/z9KQqX6lG8+W10oAOXvFvjo4023g== Received: by filterdrecv-7765c6879f-k58xv with SMTP id filterdrecv-7765c6879f-k58xv-1-65011EB0-6 2023-09-13 02:30:08.059200673 +0000 UTC m=+2892946.207112839 Received: from earth.catern.com (unknown) by geopod-ismtpd-28 (SG) with ESMTP id 2L1baOyrSvu-Pq0rNjY-Ig Wed, 13 Sep 2023 02:30:07.855 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost; envelope-from=sbaugh@catern.com; receiver=debbugs.gnu.org Received: from localhost (localhost [IPv6:::1]) by earth.catern.com (Postfix) with ESMTPSA id 686B460105; Tue, 12 Sep 2023 22:30:07 -0400 (EDT) From: sbaugh@catern.com Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <871qf2vmi4.fsf@catern.com> (sbaugh@catern.com's message of "Wed, 13 Sep 2023 02:24:20 +0000 (UTC)") References: <871qf2vmi4.fsf@catern.com> Date: Wed, 13 Sep 2023 02:30:08 +0000 (UTC) Message-ID: <87v8ceu7o0.fsf@catern.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbKxr19SAD9NJYU1Ku8aAG?= =?us-ascii?Q?CFUMWKaDOWr+YZ9dhHmLDMgTtXKW3akTp2WNkZ0?= =?us-ascii?Q?aunVw0DB3I7wGVUA4jPyisIsPVyMe7plinQlroK?= =?us-ascii?Q?ybsT9ftJmWFZ+rulY6nO7jaTGBD=2FGVx7atB7Yb9?= =?us-ascii?Q?3yp=2FANnuCemkcOJTPkoDDSP13r09GqBajkg=3D=3D?= To: 65902@debbugs.gnu.org X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65902 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit tags 65902 + patch quit This patch avoids the complicated scripting needed for emacsclient-mail.desktop by adding a new flag to emacsclient, --funcall, which mirrors emacs --funcall and allows emacsclient-mail.desktop to be basically the same as emacs-mail.desktop. I expect this to also be useful in other places; the need to escape arbitrary inputs before passing them to emacsclient is frequently annoying. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Add-funcall-to-emacsclient-to-avoid-escaping-argumen.patch >From 6c9dbda3aa5e3f1e3a5003bc0a15cf662b880d99 Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Tue, 12 Sep 2023 22:20:15 -0400 Subject: [PATCH] Add --funcall to emacsclient to avoid escaping arguments Passing arguments to functions through emacsclient --eval requires complicated escaping (as seen in emacsclient-mail.desktop before this change). The new --funcall argument behaves like emacs -f, and just passes the arguments as uninterpreted strings to the specified function. This simplifies use cases where arbitrary input needs to be passed to emacsclient. * etc/emacsclient-mail.desktop: Use --funcall. (bug#65902) * lib-src/emacsclient.c (longopts, decode_options, main): Add support for --funcall. * lisp/server.el (server-funcall-and-print): Add. (server-process-filter): Add support for -funcall and -funcallargs --- etc/emacsclient-mail.desktop | 7 ++----- lib-src/emacsclient.c | 36 ++++++++++++++++++++++++++++++++++-- lisp/server.el | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 7 deletions(-) diff --git a/etc/emacsclient-mail.desktop b/etc/emacsclient-mail.desktop index 0a2420ddead..fc6773a963b 100644 --- a/etc/emacsclient-mail.desktop +++ b/etc/emacsclient-mail.desktop @@ -1,10 +1,7 @@ [Desktop Entry] 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=$(echo "$1" | sed 's/[\"]/\\&/g'); exec emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"$u\")" -# Special chars '"', '$', and '\' must be escaped as '\\"', '\\$', and '\\\\'. -Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u +Exec=emacsclient --alternate-editor= --funcall message-mailto %u Icon=emacs Name=Emacs (Mail, Client) MimeType=x-scheme-handler/mailto; @@ -16,7 +13,7 @@ Actions=new-window;new-instance; [Desktop Action new-window] Name=New Window -Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --create-frame --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u +Exec=emacsclient --alternate-editor= --create-frame --funcall message-mailto %u [Desktop Action new-instance] Name=New Instance diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 698bf9b50ae..5bf6c05ef37 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -116,6 +116,9 @@ #define DEFAULT_TIMEOUT (30) /* True means args are expressions to be evaluated. --eval. */ static bool eval; +/* The function to call. Other arguments are passed as strings. --funcall. */ +static char *funcall; + /* True means open a new frame. --create-frame etc. */ static bool create_frame; @@ -169,6 +172,7 @@ #define DEFAULT_TIMEOUT (30) { "quiet", no_argument, NULL, 'q' }, { "suppress-output", no_argument, NULL, 'u' }, { "eval", no_argument, NULL, 'e' }, + { "funcall", required_argument, NULL, 'l' }, { "help", no_argument, NULL, 'H' }, { "version", no_argument, NULL, 'V' }, { "tty", no_argument, NULL, 't' }, @@ -552,6 +556,10 @@ decode_options (int argc, char **argv) eval = true; break; + case 'l': + funcall = optarg; + break; + case 'q': quiet = true; break; @@ -690,6 +698,7 @@ print_help_and_exit (void) -F ALIST, --frame-parameters=ALIST\n\ Set the parameters of a new frame\n\ -e, --eval Evaluate the FILE arguments as ELisp expressions\n\ +-l, --funcall FUNC Call ELisp FUNC, passing FILE arguments as strings\n\ -n, --no-wait Don't wait for the server to return\n\ -w, --timeout=SECONDS Seconds to wait before timing out\n\ -q, --quiet Don't display messages on success\n\ @@ -1953,7 +1962,7 @@ main (int argc, char **argv) /* Process options. */ decode_options (argc, argv); - if (! (optind < argc || eval || create_frame)) + if (! (optind < argc || eval || funcall || create_frame)) { message (true, ("%s: file name or argument required\n" "Try '%s --help' for more information\n"), @@ -1961,6 +1970,14 @@ main (int argc, char **argv) exit (EXIT_FAILURE); } + if (eval && funcall) + { + message (true, ("%s: can't pass both --eval and --funcall\n" + "Try '%s --help' for more information\n"), + progname, progname); + exit (EXIT_FAILURE); + } + #ifdef SOCKETS_IN_FILE_SYSTEM if (tty) { @@ -2080,6 +2097,13 @@ main (int argc, char **argv) send_to_emacs (emacs_socket, " "); continue; } + else if (funcall) + { + send_to_emacs (emacs_socket, "-funcallarg "); + quote_argument (emacs_socket, argv[i]); + send_to_emacs (emacs_socket, " "); + continue; + } char *p = argv[i]; if (*p == '+') @@ -2136,10 +2160,18 @@ main (int argc, char **argv) send_to_emacs (emacs_socket, " "); } + if (funcall) + { + send_to_emacs (emacs_socket, "-funcall "); + quote_argument (emacs_socket, funcall); + send_to_emacs (emacs_socket, " "); + } + + send_to_emacs (emacs_socket, "\n"); /* Wait for an answer. */ - if (!eval && !tty && !nowait && !quiet && 0 <= process_grouping ()) + if (!eval && !funcall && !tty && !nowait && !quiet && 0 <= process_grouping ()) { printf ("Waiting for Emacs..."); skiplf = false; diff --git a/lisp/server.el b/lisp/server.el index c3325e5a24c..da3319581ea 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -873,6 +873,17 @@ server-eval-and-print (point-min) (point-max)))) (server-reply-print (server-quote-arg text) proc))))))) +(defun server-funcall-and-print (func args proc) + "Call FUNC on ARGS and send the result back to client PROC." + (let ((v (with-local-quit (eval (apply (intern func) args) t)))) + (when proc + (with-temp-buffer + (let ((standard-output (current-buffer))) + (pp v) + (let ((text (buffer-substring-no-properties + (point-min) (point-max)))) + (server-reply-print (server-quote-arg text) proc))))))) + (defconst server-msg-size 1024 "Maximum size of a message sent to a client.") @@ -1196,6 +1207,7 @@ server-process-filter tty-type ; string. files filepos + funcallargs args-left) ;; Remove this line from STRING. (setq string (substring string (match-end 0))) @@ -1323,6 +1335,28 @@ server-process-filter commands) (setq filepos nil))) + ;; -funcall FUNC: Call a function on arguments. + ("-funcall" + (if use-current-frame + (setq use-current-frame 'always)) + (let ((func (pop args-left))) + (if coding-system + (setq func (decode-coding-string func coding-system))) + (push (lambda () (server-funcall-and-print func funcallargs proc)) + commands) + (setq funcallargs nil) + (setq filepos nil))) + + ;; -funcallarg ARG: Add an argument for later -funcall. + ("-funcallarg" + (if use-current-frame + (setq use-current-frame 'always)) + (let ((arg (pop args-left))) + (if coding-system + (setq arg (decode-coding-string arg coding-system))) + (push arg funcallargs) + (setq filepos nil))) + ;; -env NAME=VALUE: An environment variable. ("-env" (let ((var (pop args-left))) -- 2.41.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Tue Sep 12 23:47:26 2023 Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 03:47:26 +0000 Received: from localhost ([127.0.0.1]:60447 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgGqN-0004a2-56 for submit@debbugs.gnu.org; Tue, 12 Sep 2023 23:47:26 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]:48531) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgGqJ-0004ZZ-8j for 65902@debbugs.gnu.org; Tue, 12 Sep 2023 23:47:08 -0400 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-68a3ced3ec6so5609887b3a.1 for <65902@debbugs.gnu.org>; Tue, 12 Sep 2023 20:47:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694576816; x=1695181616; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=8r0h3+iKa5ZcKRXM0yIotnlWhK6cEFFjVVZcJASXtGg=; b=HFLe2tFm7CoWXa7PbrCt/ubJ2N14aPg9iic8C6CH+9wvfjxJcl4kVNqDt/p7m+qwZD 7Qn9wuoIuQkC0fmZXoUknSnqxqRu/f1fz9IjaJzwWsRygm9Zqn89pDas9somGMq1iCbt gVIyfBNgIXlfXJ56+sUCeQf6GVGnoDlIYJ9VsNQfcf5LM40EgPuNge3vUMMrtOwaKqEa x1Q+/hUoOC4YZa78bz/CXg3qmgvzxnz8iW3BehtRu4J9jPd5/lZGN6DwIWPlgVQtpD+G pZf+h72dkyxK28i9bHTtPPn9isztLLVJS659SFX92dUjGvSSpXFHXs82VqBJBSef35n0 Ul1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694576816; x=1695181616; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8r0h3+iKa5ZcKRXM0yIotnlWhK6cEFFjVVZcJASXtGg=; b=qBH4tjzZnCCsEGJ6ScU6qqVk+DQt4+1jxFzRBCYb9GEOTrBZP/SBTya0Ta7hfO+suD 8iclti31+VVZRM2rT6aT8a79WLlgKJgwMBUIkB0/qVuj/ZENF5e8aW8/D2dXNJqRm6ha 8paTG2wvwl/cGUAcRiKqZQXFsn/4MzxLDvddIQ3rOgmkMOd7U4Lqqx39nmXHknSfWElg V6HvR6Sd2Pc8D6mwA9HPN5ismgFZAX6UyEnplvKJf9cZIBm1/9UL7yG5epUPrAfsmueC KZMIInT+R4+vUtJgf+qt8ihredhgJwMP72/KNFiW0E1B0Y7bOC3IAe4BdHymJJiOdBfA bhlw== X-Gm-Message-State: AOJu0YyMdtTDefCFs1IMoYR6psahXHxvtYLhF7iCFl7OxSTKcwXHPjKd GNG3BCrArL7KnN/cnqhHIGk= X-Google-Smtp-Source: AGHT+IFS4ncrJyQIrNY64Bevs6dCWQb2hRfpvvmjR5Av2VV2rCckw6iy1wKqtzuA7T2EaAhK0FtwNg== X-Received: by 2002:a05:6a20:4324:b0:156:9c45:bf30 with SMTP id h36-20020a056a20432400b001569c45bf30mr1475120pzk.53.1694576816171; Tue, 12 Sep 2023 20:46:56 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id h4-20020a170902f54400b001b8c689060dsm9285425plf.28.2023.09.12.20.46.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 Sep 2023 20:46:55 -0700 (PDT) Message-ID: Date: Tue, 12 Sep 2023 20:46:54 -0700 MIME-Version: 1.0 Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping To: sbaugh@catern.com, 65902@debbugs.gnu.org References: <871qf2vmi4.fsf@catern.com> <87v8ceu7o0.fsf@catern.com> Content-Language: en-US From: Jim Porter In-Reply-To: <87v8ceu7o0.fsf@catern.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65902 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 9/12/2023 7:30 PM, sbaugh@catern.com wrote: > tags 65902 + patch > quit > > This patch avoids the complicated scripting needed for > emacsclient-mail.desktop by adding a new flag to emacsclient, --funcall, > which mirrors emacs --funcall and allows emacsclient-mail.desktop to be > basically the same as emacs-mail.desktop. I think this is actually the same as the (very long) bug#57752, so thanks for working on this. (It was on my list of things to get to, but I just haven't had time.) Over there, we agreed that something like your patch is wanted, albeit with two caveats: 1. Since "--funcall" for the regular "emacs" binary doesn't pass arguments to the function, how about we call this option "--apply" instead? 2. It would be great if we could get "--apply" for the regular "emacs" binary too, so that both programs work the same way (at least in this regard). Even better, if you could forward "--apply" from "emacsclient" to the alternate editor (which would be "emacs" 99% of the time) automatically. That works, in a roundabout way, for the Emacs daemon, but not if the alternate editor is "emacs". From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 13 04:00:27 2023 Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 08:00:27 +0000 Received: from localhost ([127.0.0.1]:60666 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgKnT-0002eb-1o for submit@debbugs.gnu.org; Wed, 13 Sep 2023 04:00:27 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:46178) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgKnG-0002eB-Me for 65902@debbugs.gnu.org; Wed, 13 Sep 2023 04:00:25 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-31fc91d5ca6so265454f8f.0 for <65902@debbugs.gnu.org>; Wed, 13 Sep 2023 01:00:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694592003; x=1695196803; darn=debbugs.gnu.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Dd9slT/Rl/0RXRos/fgAxJbltRwpjIojAYJfY5xTTBY=; b=YOjpiqQkYL5LOMrJBmyPPd7hkn+7jI52LLSuLVi9NpFH+v/3uaNTSxXjTaX+FSGE6Q wJA2uQNadGm8sX+6bXtIbrXJ6zd/wCRlgRjyO3FDqTZTesiX2WFDp6oa44g4vKb0DmEt Cw3/qCjegUcxjoqzjY06dHZ6Ksa0lf2ZFRBLLA27/3RIUBTV1fJjO6q8aLbsHykh7m+A SMNzqaU8O8Ui0NXNhi09TUMHBOdYQFG4gGuA3nX/cIztDYXTd7LKlmusXlwXWNZZ6V5p vp75cuMqgALfpXxjXKDJfJhl1O0Yw8uUEMryk57F61AKUzmIk87ZuQ6DBD58B0HWa2Js S0Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694592003; x=1695196803; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Dd9slT/Rl/0RXRos/fgAxJbltRwpjIojAYJfY5xTTBY=; b=mnL1lh3uXylEEzxqq+NTmTGOicsKEpTxaSQpXwWWI0lXKkrkSvEIsvb2ob0Kcu0agH /bk1el5vxf7x1U5kC2ts8tT8e5TjolGrXX3ibTSvoWQytpNvH5L5GZH0QpDh/W6gkj2F pLwiXbdKL8k1QWcn5D0zBXenDYKh8TIAKXUIsDIg2WkV4nVjKKb8SVhZk4Yv41bGwZxx ZiZ2E0L7D16Mc5oN+69+GykYP2vVjlJgi5elPcFOon9NC/FMspKj27vQiRgEjkjShesQ ZT9ocIZ0O4EWQOG6M0O3utJ+QTVrxuXjNGEV0Mo+TKmhzw9l4Eb85wpRIzBZm42AkmpY XvBQ== X-Gm-Message-State: AOJu0Yy19y5cpzwA/rrfN3OfMazny4Zq5m+T6ISleDK295RybkXa9Xzi TXFgX5SVKrieZ9O3mMvRvvOodCTuBpdkqQ== X-Google-Smtp-Source: AGHT+IHZL3XTK391ekYMzD+n9huGsp8yF51rdX2nkr3SW/kkT0poBGyzSnTlyTsxiZw7Mellz7lCig== X-Received: by 2002:adf:fe8c:0:b0:31f:9bdb:79fc with SMTP id l12-20020adffe8c000000b0031f9bdb79fcmr1350639wrr.31.1694592002914; Wed, 13 Sep 2023 01:00:02 -0700 (PDT) Received: from rltb ([2a01:e0a:3f3:fb50:9eeb:e8ff:fe1b:1ad8]) by smtp.gmail.com with ESMTPSA id u4-20020a5d6da4000000b0031fb91f23e9sm3874504wrs.43.2023.09.13.01.00.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 01:00:01 -0700 (PDT) From: Robert Pluim To: Jim Porter Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: (Jim Porter's message of "Tue, 12 Sep 2023 20:46:54 -0700") References: <871qf2vmi4.fsf@catern.com> <87v8ceu7o0.fsf@catern.com> Date: Wed, 13 Sep 2023 10:00:00 +0200 Message-ID: <87edj2ec5b.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65902 Cc: sbaugh@catern.com, 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> On Tue, 12 Sep 2023 20:46:54 -0700, Jim Porter said: Jim> On 9/12/2023 7:30 PM, sbaugh@catern.com wrote: >> tags 65902 + patch >> quit >> This patch avoids the complicated scripting needed for >> emacsclient-mail.desktop by adding a new flag to emacsclient, --funcall, >> which mirrors emacs --funcall and allows emacsclient-mail.desktop to be >> basically the same as emacs-mail.desktop. Jim> I think this is actually the same as the (very long) bug#57752, so Jim> thanks for working on this. (It was on my list of things to get to, Jim> but I just haven't had time.) 57752 got bogged down in design paralysis :-) The idea looks good to me. Jim> Over there, we agreed that something like your patch is wanted, albeit Jim> with two caveats: Jim> 1. Since "--funcall" for the regular "emacs" binary doesn't pass Jim> arguments to the function, how about we call this option "--apply" Jim> instead? Yes, that sounds right. Jim> 2. It would be great if we could get "--apply" for the regular "emacs" Jim> binary too, so that both programs work the same way (at least in this Jim> regard). Even better, if you could forward "--apply" from Jim> "emacsclient" to the alternate editor (which would be "emacs" 99% of Jim> the time) automatically. That works, in a roundabout way, for the Jim> Emacs daemon, but not if the alternate editor is "emacs". Consistency would be good here. Robert -- From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 13 08:41:34 2023 Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 12:41:35 +0000 Received: from localhost ([127.0.0.1]:32866 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgPBW-00071S-IO for submit@debbugs.gnu.org; Wed, 13 Sep 2023 08:41:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49206) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgPBU-00071G-So for 65902@debbugs.gnu.org; Wed, 13 Sep 2023 08:41:34 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qgPBK-0007D0-2f; Wed, 13 Sep 2023 08:41:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=v4lN26fQLkJh8me+5Z3njqz9SrwklSYjbGCWvgj0aF8=; b=FPlIceSHgsbS jfthhY2VWirkZGoHsjFoVlwtRDQgx6Ecfcl5jfi5f8/XQX10ds6OnrYk3EQu6J1zKI/KSJPOc8RlH EIg0zYD30xE3kdgdqcJA88P4nzn2TE6aB0V8CpxIwreNicpiMYg4fVrfGk4D+6b9q6Jv5zRTGg7Iq FSYtGoDd6nDjuEamBAau6wXQqeUB8hdKwrwwHoozfDjt+kdb18/8c8hX+cMfdMylFdSP3ZdfqBGxf U2Wgzpdg4AyBc4LgaJB1wtIsguK9pBv/MIX1XK66pxHzpVkpgtkBbRwdkf6tlDgLoF8x4Z8G8eWZk uprisk7Tf7OvEs/JxpwFXA==; Date: Wed, 13 Sep 2023 15:41:10 +0300 Message-Id: <83fs3int3t.fsf@gnu.org> From: Eli Zaretskii To: sbaugh@catern.com In-Reply-To: <87v8ceu7o0.fsf@catern.com> (sbaugh@catern.com) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping References: <871qf2vmi4.fsf@catern.com> <87v8ceu7o0.fsf@catern.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: sbaugh@catern.com > Date: Wed, 13 Sep 2023 02:30:08 +0000 (UTC) > > This patch avoids the complicated scripting needed for > emacsclient-mail.desktop by adding a new flag to emacsclient, --funcall, > which mirrors emacs --funcall and allows emacsclient-mail.desktop to be > basically the same as emacs-mail.desktop. > > I expect this to also be useful in other places; the need to escape > arbitrary inputs before passing them to emacsclient is frequently > annoying. Is quoting the only issue with --eval? If so, why not have a variant of --eval that quotes the argument by itself, like you do in the patch, i.e. by using quote_argument, instead of inventing yet another weird option with its own small DSL and extra-special rules of how to write the command line with it? More generally, I cannot say I'm happy that we basically are reiterating everything that was said in bug#57752 instead of picking up where it left off. Why is it useful to have another discussion like that one (which will probably end up at the same impasse)? From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 13 08:42:13 2023 Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 12:42:13 +0000 Received: from localhost ([127.0.0.1]:32875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgPC8-00073A-UJ for submit@debbugs.gnu.org; Wed, 13 Sep 2023 08:42:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44542) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgPC7-00072w-EG for 65902@debbugs.gnu.org; Wed, 13 Sep 2023 08:42:11 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qgPBw-0007IP-Px; Wed, 13 Sep 2023 08:42:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=igVt/CkB7sj/V6HV3fzap9x6fsFrq6v3ogBh9bLEItc=; b=eiLTHhjqbbVQ Y6MpTnB/db5+8jd+rdzuhFE9SMFxcOiePEU9yfKQ4wp30ZOqyGYKjFD2SLNxYfaZ7R1dJwnH5Bw2U G+9MxFypceAEiqqq9tB+kzwgZI+ePVOJtNx34qPzXAnWZOYgYHQxL/w7bR1+QPwHDTWGMxdhDcVMX suq2rUaq8sbUz4J9OOG0+yVEoJuw8v9PrnuRykd7jkII2jLumEjdiOdqQ2NcMHX5PatR/ORbnIOzC C+oEVe7bpGqzbw7uidcr5wQKvPS86TN5FTggg5kYxcp4BOlN5JTfxJfmNiL+qXYyq6akNZ505MmUN Igny3fS/UQ6WWInSogalQQ==; Date: Wed, 13 Sep 2023 15:41:48 +0300 Message-Id: <83edj2nt2r.fsf@gnu.org> From: Eli Zaretskii To: Jim Porter In-Reply-To: (message from Jim Porter on Tue, 12 Sep 2023 20:46:54 -0700) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping References: <871qf2vmi4.fsf@catern.com> <87v8ceu7o0.fsf@catern.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902 Cc: sbaugh@catern.com, 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Tue, 12 Sep 2023 20:46:54 -0700 > From: Jim Porter > > On 9/12/2023 7:30 PM, sbaugh@catern.com wrote: > > tags 65902 + patch > > quit > > > > This patch avoids the complicated scripting needed for > > emacsclient-mail.desktop by adding a new flag to emacsclient, --funcall, > > which mirrors emacs --funcall and allows emacsclient-mail.desktop to be > > basically the same as emacs-mail.desktop. > > I think this is actually the same as the (very long) bug#57752, so > thanks for working on this. (It was on my list of things to get to, but > I just haven't had time.) > > Over there, we agreed that something like your patch is wanted, albeit > with two caveats: > > 1. Since "--funcall" for the regular "emacs" binary doesn't pass > arguments to the function, how about we call this option "--apply" instead? > > 2. It would be great if we could get "--apply" for the regular "emacs" > binary too, so that both programs work the same way (at least in this > regard). Even better, if you could forward "--apply" from "emacsclient" > to the alternate editor (which would be "emacs" 99% of the time) > automatically. That works, in a roundabout way, for the Emacs daemon, > but not if the alternate editor is "emacs". This is how that bug's discussion started. Are we going to have it all one more time? From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 13 08:57:55 2023 Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 12:57:56 +0000 Received: from localhost ([127.0.0.1]:32887 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgPRL-0001dD-3T for submit@debbugs.gnu.org; Wed, 13 Sep 2023 08:57:55 -0400 Received: from s.wrqvwxzv.outbound-mail.sendgrid.net ([149.72.154.232]:42678) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgPRH-0001cw-Jq for 65902@debbugs.gnu.org; Wed, 13 Sep 2023 08:57:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=from:subject:in-reply-to:references:mime-version:to:cc:content-type: cc:content-type:from:subject:to; s=s1; bh=IA/8zE8M8Z2Zq3Pn4wYU+nXEB9exsXj3Rl57w1CSpK0=; b=GDnambABtWZTPZ9e3eNGsazAV7y64tMwI9cHD5PfNgNa6O4gBvEiKYdpwvpqPLYeo/eH L5V/qqIUmF87OElxJZozd/3t/p1vPlhQw+7c5hyAKUcseB0vF45xzaNyp3pTCegrwnDtYz bJpX5R8SupspdDUPgzyAr11OvomQhLWHXZaeomhMJUM0+rpyAAStoIBXGuWMBH758e+ymG 2NB7do9K47Mmrl/O4FCLGPOf/RT6lgZUoa5TrMudcJ1t5SHPmy1Q58Daz6wrWeZ1er08bV lhqnfa3AY8KCJvEq87f7XgPqynE7CiAdgdMuETUxokgnLtVgxTSYrkPggogBlQUw== Received: by filterdrecv-8684c58db7-9pkkz with SMTP id filterdrecv-8684c58db7-9pkkz-1-6501B1C3-29 2023-09-13 12:57:39.95744995 +0000 UTC m=+10847949.848089376 Received: from earth.catern.com (unknown) by geopod-ismtpd-1 (SG) with ESMTP id 3uFHoXEbQjiCQb4LueyrPw Wed, 13 Sep 2023 12:57:39.685 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost; envelope-from=sbaugh@catern.com; receiver=gmail.com Received: from localhost (localhost [IPv6:::1]) by earth.catern.com (Postfix) with ESMTPSA id 3734F6566A; Wed, 13 Sep 2023 08:57:39 -0400 (EDT) From: sbaugh@catern.com Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: (Jim Porter's message of "Tue, 12 Sep 2023 20:46:54 -0700") References: <871qf2vmi4.fsf@catern.com> <87v8ceu7o0.fsf@catern.com> Date: Wed, 13 Sep 2023 12:57:40 +0000 (UTC) Message-ID: <87r0n2tem4.fsf@catern.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbK05RQBjAcJRehj6j96at?= =?us-ascii?Q?M0kLr7M+281RHp84Glohm29SWM2NtXD28eQ5+QH?= =?us-ascii?Q?KBJi=2FZCUFAj5htdyG8uwo2Zb+elErYm+hCJZra9?= =?us-ascii?Q?UDgxwDp8P0YBp1QaTR1=2FjcV2l44wKvqgRDzUxmh?= =?us-ascii?Q?pNZ4cIo2KQJ8cLSlYeHbpTuVbXaWT+Z=2FvKA=3D=3D?= To: Jim Porter X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 2.5 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Jim Porter writes: > On 9/12/2023 7:30 PM, sbaugh@catern.com wrote: >> tags 65902 + patch >> quit >> This patch avoids the complicated scripting needed for >> emacsclient-mail.desktop by adding a new flag to emacsclient [...] Content analysis details: (2.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RCVD_IN_VALIDITY_RPBL RBL: Relay in Validity RPBL, https://senderscore.org/blocklistlookup/ [149.72.154.232 listed in bl.score.senderscore.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [149.72.154.232 listed in wl.mailspike.net] 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.5 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Jim Porter writes: > On 9/12/2023 7:30 PM, sbaugh@catern.com wrote: >> tags 65902 + patch >> quit >> This patch avoids the complicated scripting needed for >> emacsclient-mail.desktop by adding a new flag to emacsclient [...] Content analysis details: (1.5 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [149.72.154.232 listed in wl.mailspike.net] 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] 1.3 RCVD_IN_VALIDITY_RPBL RBL: Relay in Validity RPBL, https://senderscore.org/blocklistlookup/ [149.72.154.232 listed in bl.score.senderscore.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager --=-=-= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Jim Porter writes: > On 9/12/2023 7:30 PM, sbaugh@catern.com wrote: >> tags 65902 + patch >> quit >> This patch avoids the complicated scripting needed for >> emacsclient-mail.desktop by adding a new flag to emacsclient, --funcall, >> which mirrors emacs --funcall and allows emacsclient-mail.desktop to be >> basically the same as emacs-mail.desktop. > > I think this is actually the same as the (very long) bug#57752, so > thanks for working on this. (It was on my list of things to get to, > but I just haven't had time.) > > Over there, we agreed that something like your patch is wanted, albeit > with two caveats: > > 1. Since "--funcall" for the regular "emacs" binary doesn't pass > arguments to the function, how about we call this option "--apply" > instead? Ah, for some reason I thought --funcall passed arguments. Done in attached patch. > 2. It would be great if we could get "--apply" for the regular "emacs" > binary too, so that both programs work the same way (at least in this > regard). Done. Although the behavior is slightly different: emacs --apply calls the function with subsequent FILE arguments, and emacsclient --apply calls the function with all FILE arguments. The "subsequent FILE arguments" behavior is probably better, but I don't know a way to do that with getopt (which emacsclient uses). > Even better, if you could forward "--apply" from > "emacsclient" to the alternate editor (which would be "emacs" 99% of > the time) automatically. That works, in a roundabout way, for the > Emacs daemon, but not if the alternate editor is "emacs". This happens automatically anyway: When emacsclient starts the daemon, it sends the --apply request. I think that's exactly what you'd want. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Add-apply-argument-to-avoid-escaping-arguments.patch >From 4881017055ea6831ee7fe2d722eb79856946d907 Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Tue, 12 Sep 2023 22:20:15 -0400 Subject: [PATCH] Add --apply argument to avoid escaping arguments Passing arguments to functions through emacs --eval or emacsclient --eval requires complicated escaping (as seen in emacsclient-mail.desktop before this change). The new --apply argument for both emacs and emacsclient passes command line arguments as uninterpreted strings to the specified function. This simplifies use cases where arbitrary input needs to be passed to Emacs. Note that there's a minor difference in behavior between emacs --apply and emacsclient --apply: emacs --apply func calls func with only command line arguments occuring after --apply, emacsclient --apply func calls func with all command line arguments, even those which occurred before --apply. This is hard to avoid since emacsclient uses getopt instead of fancier custom Lisp argument parsing in Emacs. * etc/emacsclient-mail.desktop: Use --apply. (bug#65902) * lib-src/emacsclient.c (longopts, decode_options, main): Add support for --apply. * lisp/server.el (server-apply-and-print): Add. (server-process-filter): Add support for -apply and -applyargs * lisp/startup.el (command-line-1): Add support for --apply. * src/emacs.c (usage_message, standard_args): Add support for --apply. --- etc/emacsclient-mail.desktop | 9 +++------ lib-src/emacsclient.c | 36 ++++++++++++++++++++++++++++++++++-- lisp/server.el | 34 ++++++++++++++++++++++++++++++++++ lisp/startup.el | 18 +++++++++++++++--- src/emacs.c | 3 +++ 5 files changed, 89 insertions(+), 11 deletions(-) diff --git a/etc/emacsclient-mail.desktop b/etc/emacsclient-mail.desktop index 0a2420ddead..750fcddacdc 100644 --- a/etc/emacsclient-mail.desktop +++ b/etc/emacsclient-mail.desktop @@ -1,10 +1,7 @@ [Desktop Entry] 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=$(echo "$1" | sed 's/[\"]/\\&/g'); exec emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"$u\")" -# Special chars '"', '$', and '\' must be escaped as '\\"', '\\$', and '\\\\'. -Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u +Exec=emacsclient --alternate-editor= --apply message-mailto -- %u Icon=emacs Name=Emacs (Mail, Client) MimeType=x-scheme-handler/mailto; @@ -16,8 +13,8 @@ Actions=new-window;new-instance; [Desktop Action new-window] Name=New Window -Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --create-frame --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u +Exec=emacsclient --alternate-editor= --create-frame --apply message-mailto -- %u [Desktop Action new-instance] Name=New Instance -Exec=emacs -f message-mailto %u +Exec=emacs --apply message-mailto -- %u diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 698bf9b50ae..159c22d1ae9 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -116,6 +116,9 @@ #define DEFAULT_TIMEOUT (30) /* True means args are expressions to be evaluated. --eval. */ static bool eval; +/* The function to call. Other arguments are passed as strings. --apply. */ +static char *apply; + /* True means open a new frame. --create-frame etc. */ static bool create_frame; @@ -169,6 +172,7 @@ #define DEFAULT_TIMEOUT (30) { "quiet", no_argument, NULL, 'q' }, { "suppress-output", no_argument, NULL, 'u' }, { "eval", no_argument, NULL, 'e' }, + { "apply", required_argument, NULL, 'y' }, { "help", no_argument, NULL, 'H' }, { "version", no_argument, NULL, 'V' }, { "tty", no_argument, NULL, 't' }, @@ -552,6 +556,10 @@ decode_options (int argc, char **argv) eval = true; break; + case 'y': + apply = optarg; + break; + case 'q': quiet = true; break; @@ -690,6 +698,7 @@ print_help_and_exit (void) -F ALIST, --frame-parameters=ALIST\n\ Set the parameters of a new frame\n\ -e, --eval Evaluate the FILE arguments as ELisp expressions\n\ +-y, --apply FUNC Call ELisp FUNC, passing all FILE arguments as strings\n\ -n, --no-wait Don't wait for the server to return\n\ -w, --timeout=SECONDS Seconds to wait before timing out\n\ -q, --quiet Don't display messages on success\n\ @@ -1953,7 +1962,7 @@ main (int argc, char **argv) /* Process options. */ decode_options (argc, argv); - if (! (optind < argc || eval || create_frame)) + if (! (optind < argc || eval || apply || create_frame)) { message (true, ("%s: file name or argument required\n" "Try '%s --help' for more information\n"), @@ -1961,6 +1970,14 @@ main (int argc, char **argv) exit (EXIT_FAILURE); } + if (eval && apply) + { + message (true, ("%s: can't pass both --eval and --apply\n" + "Try '%s --help' for more information\n"), + progname, progname); + exit (EXIT_FAILURE); + } + #ifdef SOCKETS_IN_FILE_SYSTEM if (tty) { @@ -2080,6 +2097,13 @@ main (int argc, char **argv) send_to_emacs (emacs_socket, " "); continue; } + else if (apply) + { + send_to_emacs (emacs_socket, "-applyarg "); + quote_argument (emacs_socket, argv[i]); + send_to_emacs (emacs_socket, " "); + continue; + } char *p = argv[i]; if (*p == '+') @@ -2136,10 +2160,18 @@ main (int argc, char **argv) send_to_emacs (emacs_socket, " "); } + if (apply) + { + send_to_emacs (emacs_socket, "-apply "); + quote_argument (emacs_socket, apply); + send_to_emacs (emacs_socket, " "); + } + + send_to_emacs (emacs_socket, "\n"); /* Wait for an answer. */ - if (!eval && !tty && !nowait && !quiet && 0 <= process_grouping ()) + if (!eval && !apply && !tty && !nowait && !quiet && 0 <= process_grouping ()) { printf ("Waiting for Emacs..."); skiplf = false; diff --git a/lisp/server.el b/lisp/server.el index c3325e5a24c..5981e90625d 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -873,6 +873,17 @@ server-eval-and-print (point-min) (point-max)))) (server-reply-print (server-quote-arg text) proc))))))) +(defun server-apply-and-print (func args proc) + "Call FUNC on ARGS and send the result back to client PROC." + (let ((v (with-local-quit (eval (apply (intern func) args) t)))) + (when proc + (with-temp-buffer + (let ((standard-output (current-buffer))) + (pp v) + (let ((text (buffer-substring-no-properties + (point-min) (point-max)))) + (server-reply-print (server-quote-arg text) proc))))))) + (defconst server-msg-size 1024 "Maximum size of a message sent to a client.") @@ -1196,6 +1207,7 @@ server-process-filter tty-type ; string. files filepos + applyargs args-left) ;; Remove this line from STRING. (setq string (substring string (match-end 0))) @@ -1323,6 +1335,28 @@ server-process-filter commands) (setq filepos nil))) + ;; -apply FUNC: Call a function on arguments. + ("-apply" + (if use-current-frame + (setq use-current-frame 'always)) + (let ((func (pop args-left))) + (if coding-system + (setq func (decode-coding-string func coding-system))) + (push (lambda () (server-apply-and-print func applyargs proc)) + commands) + (setq applyargs nil) + (setq filepos nil))) + + ;; -applyarg ARG: Add an argument for later -apply. + ("-applyarg" + (if use-current-frame + (setq use-current-frame 'always)) + (let ((arg (pop args-left))) + (if coding-system + (setq arg (decode-coding-string arg coding-system))) + (push arg applyargs) + (setq filepos nil))) + ;; -env NAME=VALUE: An environment variable. ("-env" (let ((var (pop args-left))) diff --git a/lisp/startup.el b/lisp/startup.el index 7f601668369..bb8da76bdf1 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -2531,10 +2531,11 @@ command-line-1 ;; straight away upon any --directory/-L option. splice just-files ;; t if this follows the magic -- option. + applysym applyargs ;; function and arguments for --apply ;; This includes our standard options' long versions ;; and long versions of what's on command-switch-alist. (longopts - (append '("--funcall" "--load" "--insert" "--kill" + (append '("--funcall" "--apply" "--load" "--insert" "--kill" "--dump-file" "--seccomp" "--directory" "--eval" "--execute" "--no-splash" "--find-file" "--visit" "--file" "--no-desktop") @@ -2632,6 +2633,11 @@ command-line-1 (command-execute tem) (funcall tem))) + ((member argi '("-y" "-apply")) + (setq inhibit-startup-screen t) + ;; Subsequent file args will be accumulated into applyargs. + (setq applysym (intern (or argval (pop command-line-args-left))))) + ((member argi '("-eval" "-execute")) (setq inhibit-startup-screen t) (let* ((str-expr (or argval (pop command-line-args-left))) @@ -2763,13 +2769,19 @@ command-line-1 ;; screen for -nw? (unless initial-window-system (setq inhibit-startup-screen t)) - (funcall process-file-arg orig-argi))))) + (if applysym + (push orig-argi applyargs) + (funcall process-file-arg orig-argi)))))) ;; In unusual circumstances, the execution of Lisp code due ;; to command-line options can cause the last visible frame ;; to be deleted. In this case, kill emacs to avoid an ;; abort later. - (unless (frame-live-p (selected-frame)) (kill-emacs nil))))))) + (unless (frame-live-p (selected-frame)) (kill-emacs nil)))) + + ;; Call the function specified with --apply, if any. + (when applysym + (apply applysym (nreverse applyargs)))))) (when (eq initial-buffer-choice t) ;; When `initial-buffer-choice' equals t make sure that *scratch* diff --git a/src/emacs.c b/src/emacs.c index 80a013b68df..8de40936250 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -323,6 +323,8 @@ #define MAIN_PROGRAM --file FILE visit FILE\n\ --find-file FILE visit FILE\n\ --funcall, -f FUNC call Emacs Lisp function FUNC with no arguments\n\ +--apply, -y FUNC call Emacs Lisp function FUNC, passing\n\ + subsequent positional FILE arguments as strings\n\ --insert FILE insert contents of FILE into current buffer\n\ --kill exit without asking for confirmation\n\ --load, -l FILE load Emacs Lisp FILE using the load function\n\ @@ -2648,6 +2650,7 @@ main (int argc, char **argv) option. In any case, this is entirely an internal option. */ { "-scriptload", NULL, 0, 1 }, { "-f", "--funcall", 0, 1 }, + { "-y", "--apply", 0, 1 }, { "-funcall", 0, 0, 1 }, { "-eval", "--eval", 0, 1 }, { "-execute", "--execute", 0, 1 }, -- 2.41.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 13 09:02:05 2023 Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 13:02:05 +0000 Received: from localhost ([127.0.0.1]:32897 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgPVM-0001lR-Mu for submit@debbugs.gnu.org; Wed, 13 Sep 2023 09:02:05 -0400 Received: from s.wrqvtzvf.outbound-mail.sendgrid.net ([149.72.126.143]:7066) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgPVK-0001ku-VW for 65902@debbugs.gnu.org; Wed, 13 Sep 2023 09:02:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=from:subject:in-reply-to:references:mime-version:to:cc:content-type: content-transfer-encoding:cc:content-type:from:subject:to; s=s1; bh=d/XQXB+zyoK5543jLJsjJXhpkelj1D3ArYEOINcbAGw=; b=HwgDXbm0mY3jVJUUarAUSZiMB1StmlzY8bQ+w4jKUObvD+R7z+OYMB6HgAM/UIt6ZJjj EBfBxhLc+P1VbHIK/W737BGwImBSjZ73C4tN/yIQ9xy2Rqtq67pz3+mhiiHsCojUEopnmp yws4haPMLfnSBVrVMHtOx0kdHT5b0mK15sJudHNrI/5W1PTa91j/jPsTwVJkKC0TfiiB2P ldJja1miSP8hShlzvlATtNwUAnJBL+69Hkda+ll7Vc0WZ0SqR1NtuI/Tka4VLGlyO0YFk9 DydJ/FUDtU/zxmqRKPRzgQArF+0jbUUHEcsBQnifoVdCX2l+vnbPGJfq5ZIHSdnA== Received: by filterdrecv-7765c6879f-kht5h with SMTP id filterdrecv-7765c6879f-kht5h-1-6501B2BF-13B 2023-09-13 13:01:51.817695253 +0000 UTC m=+2930786.635545343 Received: from earth.catern.com (unknown) by geopod-ismtpd-18 (SG) with ESMTP id EtcvEPjlRyCQg-W_NcUgQw Wed, 13 Sep 2023 13:01:51.631 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost; envelope-from=sbaugh@catern.com; receiver=gnu.org Received: from localhost (localhost [IPv6:::1]) by earth.catern.com (Postfix) with ESMTPSA id 5F4CE62523; Wed, 13 Sep 2023 09:01:51 -0400 (EDT) From: sbaugh@catern.com Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <83fs3int3t.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 13 Sep 2023 15:41:10 +0300") References: <871qf2vmi4.fsf@catern.com> <87v8ceu7o0.fsf@catern.com> <83fs3int3t.fsf@gnu.org> Date: Wed, 13 Sep 2023 13:01:51 +0000 (UTC) Message-ID: <87msxqtef4.fsf@catern.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbJsDIxVZAS6ctWFFVNKgH?= =?us-ascii?Q?SRQCZlJ0D1=2F8rM68qQhH0y14yTwRW3Q9XwioRuL?= =?us-ascii?Q?dGLnCq0vagagt31A3AVRTqxqQImWdimgqLKQWLi?= =?us-ascii?Q?N4UE3qCy64KoRDUxU42QT9FZ=2FL1FpreXTAolHPq?= =?us-ascii?Q?eb+V4RejUfPjv0LqBJa6CRmxoA2Huyu=2FCCQ=3D=3D?= To: Eli Zaretskii X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Eli Zaretskii writes: >> From: sbaugh@catern.com >> Date: Wed, 13 Sep 2023 02:30:08 +0000 (UTC) >> >> This patch avoids the complicated scripting needed for >> emacsclient-mail.desktop by adding a new flag to emacsclient, [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) Eli Zaretskii writes: >> From: sbaugh@catern.com >> Date: Wed, 13 Sep 2023 02:30:08 +0000 (UTC) >> >> This patch avoids the complicated scripting needed for >> emacsclient-mail.desktop by adding a new flag to emacsclient, --funcall, >> which mirrors emacs --funcall and allows emacsclient-mail.desktop to be >> basically the same as emacs-mail.desktop. >> >> I expect this to also be useful in other places; the need to escape >> arbitrary inputs before passing them to emacsclient is frequently >> annoying. > > Is quoting the only issue with --eval? If so, why not have a variant > of --eval that quotes the argument by itself, like you do in the > patch, i.e. by using quote_argument, instead of inventing yet another > weird option with its own small DSL and extra-special rules of how to > write the command line with it? I am not sure what you're suggesting. Can you show how the equivalent of: emacsclient --apply message-mailto -- %u would work with that design? > More generally, I cannot say I'm happy that we basically are > reiterating everything that was said in bug#57752 instead of picking > up where it left off. Why is it useful to have another discussion > like that one (which will probably end up at the same impasse)? I admit I didn't see that bug until now, but the way in which this is different is that I have now read the discussion, incorporated all the advice, and I'm actually implementing it :) Probably these bugs could/should be merged though. From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 13 09:06:49 2023 Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 13:06:49 +0000 Received: from localhost ([127.0.0.1]:32914 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgPZw-0001sc-St for submit@debbugs.gnu.org; Wed, 13 Sep 2023 09:06:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35454) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgPZr-0001ry-5j for 65902@debbugs.gnu.org; Wed, 13 Sep 2023 09:06:44 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qgPZg-0007TC-Fu; Wed, 13 Sep 2023 09:06:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=p70xN62ht52Am+Hm3WIZJStjPosWjVo977zbaMZbt+o=; b=VDmiPY7Kid+R ul1Ek8MEex5dhu+h6FCOFr18ZwhmK7iYtFTWIEZjF7yHAu7g4jP+ad6nn2aeE5Vvy+NU+yLPRI+nM HTyCSFgXCXpgaiPJzXIWrBGMwVYnCL/QHh8bdVUrKsLksDuG8EMrM4uvG2bFv3MbqrpjjstoemE9U C5oz+1DLbm2ULlnF9mp4m/V29Pemrg+M4B8W1DwKcuYL7QalMnkPQMakAC4Gu+YOi8emHqGHCyxKG 7ZRZZaJtGVNYLWKXc5zrvn6icxlZVnFjtgindhIJyAqjei3XfKszI+5eyH1ZpMQ1Jt+rKmHS9h51o IFbE13KgchbPir2cLLvx4w==; Date: Wed, 13 Sep 2023 16:06:07 +0300 Message-Id: <83a5tqnry8.fsf@gnu.org> From: Eli Zaretskii To: Robert Pluim In-Reply-To: <87edj2ec5b.fsf@gmail.com> (message from Robert Pluim on Wed, 13 Sep 2023 10:00:00 +0200) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping References: <871qf2vmi4.fsf@catern.com> <87v8ceu7o0.fsf@catern.com> <87edj2ec5b.fsf@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, jporterbugs@gmail.com, sbaugh@catern.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: sbaugh@catern.com, 65902@debbugs.gnu.org > From: Robert Pluim > Date: Wed, 13 Sep 2023 10:00:00 +0200 > > >>>>> On Tue, 12 Sep 2023 20:46:54 -0700, Jim Porter said: > > Jim> On 9/12/2023 7:30 PM, sbaugh@catern.com wrote: > >> tags 65902 + patch > >> quit > >> This patch avoids the complicated scripting needed for > >> emacsclient-mail.desktop by adding a new flag to emacsclient, --funcall, > >> which mirrors emacs --funcall and allows emacsclient-mail.desktop to be > >> basically the same as emacs-mail.desktop. > > Jim> I think this is actually the same as the (very long) bug#57752, so > Jim> thanks for working on this. (It was on my list of things to get to, > Jim> but I just haven't had time.) > > 57752 got bogged down in design paralysis :-) And where do you think we will get here, if we retrace all the arguments and counter-arguments voiced there? From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 13 09:27:06 2023 Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 13:27:06 +0000 Received: from localhost ([127.0.0.1]:32944 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgPtZ-0002Mt-Kk for submit@debbugs.gnu.org; Wed, 13 Sep 2023 09:27:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35372) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgPtU-0002MV-5S for 65902@debbugs.gnu.org; Wed, 13 Sep 2023 09:27:04 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qgPtJ-0006og-5a; Wed, 13 Sep 2023 09:26:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=2Om+pWYXNDzs1ILTcIBMdoaKkpNXr5usKOJq2b16Df4=; b=mjx185gbWvRF gC7ULHe4I6IRtGMAI5yW7CenfEbkBDXeOCxH3jRNd+kQOv5j4EHPdAbaoa6qg9ahH+IvKjFYnUbp+ uwbHFWp8D3TVCnwbEe2ObbNDAvj0bRmx5sRgUy1UKN1fWcrmzsDk8XNRnTCGe7jyqoRTAsSDPfcpp tGV2sVU+aZQnkVcXP+X+/z313Q7EukCWPmnGQcoBmgFeZBxR0wdgWaxZmGXP0r3OlXmABbZbPM6Tg 14C8WkC31FOrELP14AaqL4te/OdYNembuUrYIMnQWiUCy4V7XGvxYhL8Xxv/9E8NGirUO+ydz9P+i NyxFbiwkUkHqdQE8o/H/mw==; Date: Wed, 13 Sep 2023 16:26:31 +0300 Message-Id: <837counr08.fsf@gnu.org> From: Eli Zaretskii To: sbaugh@catern.com In-Reply-To: <87msxqtef4.fsf@catern.com> (sbaugh@catern.com) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping References: <871qf2vmi4.fsf@catern.com> <87v8ceu7o0.fsf@catern.com> <83fs3int3t.fsf@gnu.org> <87msxqtef4.fsf@catern.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: sbaugh@catern.com > Date: Wed, 13 Sep 2023 13:01:52 +0000 (UTC) > Cc: 65902@debbugs.gnu.org > > Eli Zaretskii writes: > > > Is quoting the only issue with --eval? If so, why not have a variant > > of --eval that quotes the argument by itself, like you do in the > > patch, i.e. by using quote_argument, instead of inventing yet another > > weird option with its own small DSL and extra-special rules of how to > > write the command line with it? > > I am not sure what you're suggesting. Can you show how the equivalent > of: > > emacsclient --apply message-mailto -- %u > > would work with that design? emacsclient --qeval '(message-mailto %u)' > > More generally, I cannot say I'm happy that we basically are > > reiterating everything that was said in bug#57752 instead of picking > > up where it left off. Why is it useful to have another discussion > > like that one (which will probably end up at the same impasse)? > > I admit I didn't see that bug until now, but the way in which this is > different is that I have now read the discussion, incorporated all the > advice, and I'm actually implementing it :) You are well under way to reach the same final point we ended up there, because both the arguments people voice here and your responses/reactions are the same as we saw there. For example, we already have an additional option to Emacs, although the original problem had nothing to do with Emacs itself. Let's not do that this time, okay? From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 13 10:08:16 2023 Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 14:08:16 +0000 Received: from localhost ([127.0.0.1]:35490 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgQXQ-0000tt-C3 for submit@debbugs.gnu.org; Wed, 13 Sep 2023 10:08:16 -0400 Received: from s.wfbtzhsw.outbound-mail.sendgrid.net ([159.183.224.105]:30634) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgQXN-0000td-W5 for 65902@debbugs.gnu.org; Wed, 13 Sep 2023 10:08:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=subject:in-reply-to:from:mime-version:to:cc:content-type: content-transfer-encoding:cc:content-type:from:subject:to; s=s1; bh=NspA0M77QMMtXUfKWUTieOgOkSUDSJtJBHHHZ4SRzJs=; b=QzaLvZ14mhnH5V8AdHjhZcRrblGa/WxiTwfqbzQjC7N4pJp0ZWIlWx+epTKYo8GP5C5W p57dqVtMNM5IBOskb+DJ/9/qfqA9T+2cQjDrX5019pcTzI9fEfE1deeqCcj4vQJhZtt0rd elQ0P/2mEVdsnJqFSiSFdAaebibY20fIWkTfm3BfyeGAo9Y0+jqAzxvRF1N89LqKKBKZDI yBNVZCfYeUMZGItzxBlRQApPQwvx6zC3Ty1Sznxy5b1bTOKYvbMTT0A+SefsacgreO9imX XWoXbnOnpTld110Yx5ym5YxlPnbRVHD6L6ZPzajR4LSY5716c5wbhLRU7ppsuaIg== Received: by filterdrecv-7765c6879f-sjjbz with SMTP id filterdrecv-7765c6879f-sjjbz-1-6501C241-B2 2023-09-13 14:08:01.661924256 +0000 UTC m=+2933147.434190176 Received: from earth.catern.com (unknown) by geopod-ismtpd-3 (SG) with ESMTP id YyKFgKvDTdyYyehARFEF5A Wed, 13 Sep 2023 14:08:01.537 +0000 (UTC) Date: Wed, 13 Sep 2023 14:08:01 +0000 (UTC) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping Message-ID: X-Android-Message-ID: In-Reply-To: <837counr08.fsf@gnu.org> From: Spencer Baugh Importance: Normal X-Priority: 3 X-MSMail-Priority: Normal MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?GW3oCMoYnalRiojMOuLzE6x2H5kORXvlCdz1UwQVRMVT4fbh9ODEfCogOe74cO?= =?us-ascii?Q?rI4e0V+MFZgakz9Re5a6=2FCgg4ZtpyhtSdfUjWBt?= =?us-ascii?Q?rKJKkNb93mt+zUcxCYxQGI91zbA37ACbxMBspmN?= =?us-ascii?Q?Xpoqhtpj5J9ZrS5ttgxfM61MW4aQHZirj9wRlxI?= =?us-ascii?Q?JoXD2ZsJdkER0NlNFwpbBDEMM6mjP07W4pMQ99K?= =?us-ascii?Q?dFKmCbOpZ6NyxAIg5X2lO5jgvS3KgGc+NUfjo1?= To: Eli Zaretskii X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: base64 X-Spam-Score: 1.7 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: On Sep 13, 2023 09:26, Eli Zaretskii wrote: > From: sbaugh@catern.com > Date: Wed, 13 Sep 2023 13:01:52 +0000 (UTC) > Cc: 65902@debbugs.gnu.org > > Eli Zaretskii writes: > > > Is quoting the only issue with --eval? If so, why not [...] Content analysis details: (1.7 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [159.183.224.105 listed in wl.mailspike.net] 0.1 MIME_HTML_ONLY BODY: Message only has text/html MIME parts 0.0 HTML_MESSAGE BODY: HTML included in message 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines 0.6 HTML_MIME_NO_HTML_TAG HTML-only message, but there is no HTML tag 1.0 MALF_HTML_B64 Malformatted base64-encoded HTML content X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) PGRpdiBkaXI9J2F1dG8nPjxkaXY+PGRpdiBjbGFzcz0iZ21haWxfZXh0cmEiPjxkaXYgY2xhc3M9 ImdtYWlsX3F1b3RlIj5PbiBTZXAgMTMsIDIwMjMgMDk6MjYsIEVsaSBaYXJldHNraWkgJmx0O2Vs aXpAZ251Lm9yZyZndDsgd3JvdGU6PGJyIHR5cGU9ImF0dHJpYnV0aW9uIj48YmxvY2txdW90ZSBj bGFzcz0icXVvdGUiIHN0eWxlPSJtYXJnaW46MCAwIDAgLjhleDtib3JkZXItbGVmdDoxcHggI2Nj YyBzb2xpZDtwYWRkaW5nLWxlZnQ6MWV4Ij48cCBkaXI9Imx0ciI+Jmd0OyBGcm9tOiBzYmF1Z2hA Y2F0ZXJuLmNvbQo8YnI+CiZndDsgRGF0ZTogV2VkLCAxMyBTZXAgMjAyMyAxMzowMTo1MiArMDAw MCAoVVRDKQo8YnI+CiZndDsgQ2M6IDY1OTAyQGRlYmJ1Z3MuZ251Lm9yZwo8YnI+CiZndDsgCjxi cj4KJmd0OyBFbGkgWmFyZXRza2lpICZsdDtlbGl6QGdudS5vcmcmZ3Q7IHdyaXRlczoKPGJyPgom Z3Q7IAo8YnI+CiZndDsgJmd0OyBJcyBxdW90aW5nIHRoZSBvbmx5IGlzc3VlIHdpdGggLS1ldmFs PyZuYnNwOyBJZiBzbywgd2h5IG5vdCBoYXZlIGEgdmFyaWFudAo8YnI+CiZndDsgJmd0OyBvZiAt LWV2YWwgdGhhdCBxdW90ZXMgdGhlIGFyZ3VtZW50IGJ5IGl0c2VsZiwgbGlrZSB5b3UgZG8gaW4g dGhlCjxicj4KJmd0OyAmZ3Q7IHBhdGNoLCBpLmUuIGJ5IHVzaW5nIHF1b3RlX2FyZ3VtZW50LCBp bnN0ZWFkIG9mIGludmVudGluZyB5ZXQgYW5vdGhlcgo8YnI+CiZndDsgJmd0OyB3ZWlyZCBvcHRp b24gd2l0aCBpdHMgb3duIHNtYWxsIERTTCBhbmQgZXh0cmEtc3BlY2lhbCBydWxlcyBvZiBob3cg dG8KPGJyPgomZ3Q7ICZndDsgd3JpdGUgdGhlIGNvbW1hbmQgbGluZSB3aXRoIGl0Pwo8YnI+CiZn dDsgCjxicj4KJmd0OyBJIGFtIG5vdCBzdXJlIHdoYXQgeW91J3JlIHN1Z2dlc3RpbmcuJm5ic3A7 IENhbiB5b3Ugc2hvdyBob3cgdGhlIGVxdWl2YWxlbnQKPGJyPgomZ3Q7IG9mOgo8YnI+CiZndDsg Cjxicj4KJmd0OyBlbWFjc2NsaWVudCAtLWFwcGx5IG1lc3NhZ2UtbWFpbHRvIC0tICV1Cjxicj4K Jmd0OyAKPGJyPgomZ3Q7IHdvdWxkIHdvcmsgd2l0aCB0aGF0IGRlc2lnbj8KPGJyPgoKPGJyPgom bmJzcDsgZW1hY3NjbGllbnQgLS1xZXZhbCAnKG1lc3NhZ2UtbWFpbHRvICV1KSc8L3A+PC9ibG9j a3F1b3RlPjwvZGl2PjwvZGl2PjwvZGl2PjxkaXYgZGlyPSJhdXRvIj5JIGRvbid0IHRoaW5rIHRo aXMgY2FuIHdvcmsgaW4gZ2VuZXJhbCBmb3IgYXJiaXRyYXJ5IHVzZXIgaW5wdXQ6IHdoYXQgaWYg JXUgaXMgcmVwbGFjZWQgd2l0aCBzb21ldGhpbmcgdGhhdCBjb250YWlucyBwYXJlbnRoZXNlcz88 L2Rpdj48ZGl2IGRpcj0iYXV0byI+PGJyPjwvZGl2PjxkaXYgZGlyPSJhdXRvIj5BcyBmYXIgYXMg SSBrbm93LCB0aGUgb25seSByb2J1c3Qgd2F5IGlzIHRvIHNlcGFyYXRlIGFyYml0cmFyeSBwb3Nz aWJseS1tYWxpY2lvdXMgaW5wdXQgZnJvbSBhY3R1YWwgaW50ZXJwcmV0ZWQgY29kZSwgd2hpY2gg aXMgd2hhdCB0aGlzIC0tYXBwbHkgYXJndW1lbnQgZG9lcy4mbmJzcDsgVGhlIHBvc3NpYmx5LW1h bGljaW91cyBpbnB1dCBjYW4gdGhlbiBiZSBlc2NhcGVkIG9uIGl0cyBvd24sIHNlcGFyYXRlIGZy b20gdGhlIGNvZGUgd2hpY2ggaXMgcHJvY2Vzc2VkIGRpZmZlcmVudGx5LjwvZGl2PjxkaXYgZGly PSJhdXRvIj48ZGl2IGNsYXNzPSJnbWFpbF9leHRyYSI+PGRpdiBjbGFzcz0iZ21haWxfcXVvdGUi PjxibG9ja3F1b3RlIGNsYXNzPSJxdW90ZSIgc3R5bGU9Im1hcmdpbjowIDAgMCAuOGV4O2JvcmRl ci1sZWZ0OjFweCAjY2NjIHNvbGlkO3BhZGRpbmctbGVmdDoxZXgiPjxwIGRpcj0ibHRyIj4KPGJy PgoKPGJyPgomZ3Q7ICZndDsgTW9yZSBnZW5lcmFsbHksIEkgY2Fubm90IHNheSBJJ20gaGFwcHkg dGhhdCB3ZSBiYXNpY2FsbHkgYXJlCjxicj4KJmd0OyAmZ3Q7IHJlaXRlcmF0aW5nIGV2ZXJ5dGhp bmcgdGhhdCB3YXMgc2FpZCBpbiBidWcjNTc3NTIgaW5zdGVhZCBvZiBwaWNraW5nCjxicj4KJmd0 OyAmZ3Q7IHVwIHdoZXJlIGl0IGxlZnQgb2ZmLiZuYnNwOyBXaHkgaXMgaXQgdXNlZnVsIHRvIGhh dmUgYW5vdGhlciBkaXNjdXNzaW9uCjxicj4KJmd0OyAmZ3Q7IGxpa2UgdGhhdCBvbmUgKHdoaWNo IHdpbGwgcHJvYmFibHkgZW5kIHVwIGF0IHRoZSBzYW1lIGltcGFzc2UpPwo8YnI+CiZndDsgCjxi cj4KJmd0OyBJIGFkbWl0IEkgZGlkbid0IHNlZSB0aGF0IGJ1ZyB1bnRpbCBub3csIGJ1dCB0aGUg d2F5IGluIHdoaWNoIHRoaXMgaXMKPGJyPgomZ3Q7IGRpZmZlcmVudCBpcyB0aGF0IEkgaGF2ZSBu b3cgcmVhZCB0aGUgZGlzY3Vzc2lvbiwgaW5jb3Jwb3JhdGVkIGFsbCB0aGUKPGJyPgomZ3Q7IGFk dmljZSwgYW5kIEknbSBhY3R1YWxseSBpbXBsZW1lbnRpbmcgaXQgOikKPGJyPgoKPGJyPgpZb3Ug YXJlIHdlbGwgdW5kZXIgd2F5IHRvIHJlYWNoIHRoZSBzYW1lIGZpbmFsIHBvaW50IHdlIGVuZGVk IHVwCjxicj4KdGhlcmUsIGJlY2F1c2UgYm90aCB0aGUgYXJndW1lbnRzIHBlb3BsZSB2b2ljZSBo ZXJlIGFuZCB5b3VyCjxicj4KcmVzcG9uc2VzL3JlYWN0aW9ucyBhcmUgdGhlIHNhbWUgYXMgd2Ug c2F3IHRoZXJlLiZuYnNwOyBGb3IgZXhhbXBsZSwgd2UKPGJyPgphbHJlYWR5IGhhdmUgYW4gYWRk aXRpb25hbCBvcHRpb24gdG8gRW1hY3MsIGFsdGhvdWdoIHRoZSBvcmlnaW5hbAo8YnI+CnByb2Js ZW0gaGFkIG5vdGhpbmcgdG8gZG8gd2l0aCBFbWFjcyBpdHNlbGYuCjxicj4KCjxicj4KTGV0J3Mg bm90IGRvIHRoYXQgdGhpcyB0aW1lLCBva2F5PzwvcD48L2Jsb2NrcXVvdGU+PC9kaXY+PC9kaXY+ PC9kaXY+PGRpdiBkaXI9ImF1dG8iPkFncmVlZCwgSSB0aGluayB3ZSByZWFjaGVkIGEgY29uc2Vu c3VzIGluIHRoYXQgYnVnIGFuZCBub3cgSSBhbSBpbXBsZW1lbnRpbmcgdGhhdCBjb25zZW5zdXMu PC9kaXY+PGRpdiBkaXI9ImF1dG8iPjxkaXYgY2xhc3M9ImdtYWlsX2V4dHJhIj48ZGl2IGNsYXNz PSJnbWFpbF9xdW90ZSI+PGJsb2NrcXVvdGUgY2xhc3M9InF1b3RlIiBzdHlsZT0ibWFyZ2luOjAg MCAwIC44ZXg7Ym9yZGVyLWxlZnQ6MXB4ICNjY2Mgc29saWQ7cGFkZGluZy1sZWZ0OjFleCI+PHAg ZGlyPSJsdHIiPgo8YnI+CjwvcD4KPC9ibG9ja3F1b3RlPjwvZGl2Pjxicj48L2Rpdj48L2Rpdj48 L2Rpdj4= From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 13 10:23:16 2023 Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 14:23:16 +0000 Received: from localhost ([127.0.0.1]:35509 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgQlh-0001GT-Lg for submit@debbugs.gnu.org; Wed, 13 Sep 2023 10:23:16 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:58657) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgQlc-0001GB-0m for 65902@debbugs.gnu.org; Wed, 13 Sep 2023 10:23:00 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-401b393df02so80264465e9.1 for <65902@debbugs.gnu.org>; Wed, 13 Sep 2023 07:22:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694614964; x=1695219764; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Tcvls7NE+i/fKwFV3CuJDMyDonj8rk1QUAZebI8udm0=; b=WbrlUrwKsmiH8gYa2m/OQY6Wa3QgYpWUnnRN8VIkFiHXfg83UlILhfK+jHDpLGGkx/ ruVGcVJhVvoozWySLJsIUlSAWtQ1RPGKFDw+yp7EeMSpmm28n5FbkviPL2lGjXWK50bw 7crIKr62hWMhnNiU2DSQyconDaX6c8eRjgt94s5DQMdHsqycwLUIxEEH/shks7BcQeQu AVxKpALNPHaIxqRrRerarpdO1A7n43zrg7n20ZevOCN/frHzPX/Wz71dGgD4JlrSwQEz e0PE2t3ab5nOSxVzNT/vbwFgoRaVyI74zq3iY1OJGOMlcnFHKhtEh1wsyLfwy7JZOTs6 m9KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694614964; x=1695219764; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Tcvls7NE+i/fKwFV3CuJDMyDonj8rk1QUAZebI8udm0=; b=o2HDn3zIV5B8PYwoy85x5m6PHFN2AWEp43+a0T7+4WG16Q69QtVVidQBNmnwCET58Q lKoyur/3eEKosXDoV/bz/ncFGoluztydAj6jSZIafksIusHTG0MydcYWeATsIy1PxHy6 uB7oW9Ved57gmWjRz6pTFBi4Ivqio/JdZca1xoAwpDaDiV861LKBTRSWhF32uXzFMOAF oPp0euiPoJghP1K+LhO3LcQlxeu7UQGG4J1uueyfOnncvPBR60fxn4BlLDXo8wLFlR9Q EBE1OI2OASmcSkELedrN28/A/BZrXoRif4iEUob/K2BFXwDCJ7TyhWvLlUiFscMe1BrA C27w== X-Gm-Message-State: AOJu0Yxaj9EtYTy89n5IM0L2toIgdiCf8WrBrXA3Z8WtbKhhwYKx9DCL uhLCWGkaOI02TVf3UAdJp12+OHZZDixjLQ== X-Google-Smtp-Source: AGHT+IEXyA2KtjCm104q6rTSOH7O9dhbxvWHXyj54g13vTzead3l38oVZ/0ZEMawXFtU5HDJCx6F3w== X-Received: by 2002:a05:600c:2242:b0:402:fec4:fddc with SMTP id a2-20020a05600c224200b00402fec4fddcmr2009799wmm.17.1694614964218; Wed, 13 Sep 2023 07:22:44 -0700 (PDT) Received: from rltb ([2a01:e0a:3f3:fb50:9eeb:e8ff:fe1b:1ad8]) by smtp.gmail.com with ESMTPSA id f22-20020a1c6a16000000b003fc0505be19sm2161396wmc.37.2023.09.13.07.22.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 07:22:43 -0700 (PDT) From: Robert Pluim To: Eli Zaretskii Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <83a5tqnry8.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 13 Sep 2023 16:06:07 +0300") References: <871qf2vmi4.fsf@catern.com> <87v8ceu7o0.fsf@catern.com> <87edj2ec5b.fsf@gmail.com> <83a5tqnry8.fsf@gnu.org> Date: Wed, 13 Sep 2023 16:22:43 +0200 Message-ID: <87a5tqdufg.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, jporterbugs@gmail.com, sbaugh@catern.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> On Wed, 13 Sep 2023 16:06:07 +0300, Eli Zaretskii said: >> Cc: sbaugh@catern.com, 65902@debbugs.gnu.org >> From: Robert Pluim >> Date: Wed, 13 Sep 2023 10:00:00 +0200 >>=20 >> >>>>> On Tue, 12 Sep 2023 20:46:54 -0700, Jim Porter said: >>=20 Jim> On 9/12/2023 7:30 PM, sbaugh@catern.com wrote: >> >> tags 65902 + patch >> >> quit >> >> This patch avoids the complicated scripting needed for >> >> emacsclient-mail.desktop by adding a new flag to emacsclient, --f= uncall, >> >> which mirrors emacs --funcall and allows emacsclient-mail.desktop= to be >> >> basically the same as emacs-mail.desktop. >>=20 Jim> I think this is actually the same as the (very long) bug#57752, so Jim> thanks for working on this. (It was on my list of things to get to, Jim> but I just haven't had time.) >>=20 >> 57752 got bogged down in design paralysis :-) Eli> And where do you think we will get here, if we retrace all the Eli> arguments and counter-arguments voiced there? I was not intending to do that, I was intending to advocate for Spencer=CA=BCs work to go in pretty much as-is (modulo calling it '--apply' rather than '--funcall'). Robert --=20 From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 13 10:50:54 2023 Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 14:50:54 +0000 Received: from localhost ([127.0.0.1]:35605 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgRCg-000282-0k for submit@debbugs.gnu.org; Wed, 13 Sep 2023 10:50:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51468) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgRCf-00027q-AJ for 65902@debbugs.gnu.org; Wed, 13 Sep 2023 10:50:53 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qgRCT-0000jg-Et; Wed, 13 Sep 2023 10:50:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=kJ8O4HxBrVPJT1J0JJJg+EPSd9GtTPE823JAwxNEdaY=; b=mvvfnpGu/Hm4 G5msQsSIlARsxCEEbcWGKtL2DY/9NSxrNvmPZ6w0FVbudF1rJIsJCwA1ptvbWPuctCqsk0FpJhVqE B/jZGakfxMPBvou3Qzamqpl7WJNEBtIz1vrd2pGoOsBVmqHgPY6Hb6qj7cWnIcpVqmXqe1HXKAqMv 18yq2eXN02So9DOcIb8Jf5bZup7LJlgF6uO9PyjmVnnFGAOIGOaJDSgt6po0FD5l9vNF8iiGbqa4N NwuwflAS6bTetM/cN90a1FYoZ5YkwqCk8Gnvs4zXxF+HWncfRpYQOTlp8uL4dRhScCuildWhbSXhp I3+wUxKTuwP44UEvT6j6Qg==; Date: Wed, 13 Sep 2023 17:50:26 +0300 Message-Id: <83ttrym8jx.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (message from Spencer Baugh on Wed, 13 Sep 2023 14:08:01 +0000 (UTC)) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Wed, 13 Sep 2023 14:08:01 +0000 (UTC) > From: Spencer Baugh > Cc: 65902@debbugs.gnu.org > > On Sep 13, 2023 09:26, Eli Zaretskii wrote: > > > I am not sure what you're suggesting. Can you show how the equivalent > > of: > > > > emacsclient --apply message-mailto -- %u > > > > would work with that design? > > emacsclient --qeval '(message-mailto %u)' > > I don't think this can work in general for arbitrary user input: what if %u is replaced with something > that contains parentheses? They are inside '..', so the only one who'd care is Emacs, not the shell. In which case it's the job of whoever provides the value for %u to handle that. And anyway, how is that different from the same problem happening with your suggested --funcall or --apply? they will bump into the same issues. > Let's not do that this time, okay? > > Agreed, I think we reached a consensus in that bug and now I am implementing that consensus. AFAIU, there was no consensus reached there, so I'm unsure what are you alluding to here. From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 13 11:01:15 2023 Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 15:01:15 +0000 Received: from localhost ([127.0.0.1]:35642 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgRMh-00054O-EV for submit@debbugs.gnu.org; Wed, 13 Sep 2023 11:01:15 -0400 Received: from smtp-out2.suse.de ([2001:67c:2178:6::1d]:58312) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgRMd-000549-VH for 65902@debbugs.gnu.org; Wed, 13 Sep 2023 11:01:14 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id D35B41F390; Wed, 13 Sep 2023 15:01:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1694617260; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hm6puBdSx8iMFsDQpiaYumdgN8wW3ryi7Bbjeb8TOl4=; b=kRnKk62XOKHwR/f/SfGFRHvY5oBfv4IgpRZDboIQCzXW5n8bA3lXjNrrFmb5W9MLko6DUC iTnzudAVzHsR+xpO0IBxq59vLjL60mLy2JnDwx/x5ioLEiLDCpWIPNSExdPT/8YeN7ZFCi gWnUIiTaBS/EiQskgLBDCxidC2Dc/bo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1694617260; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hm6puBdSx8iMFsDQpiaYumdgN8wW3ryi7Bbjeb8TOl4=; b=hExPg7+l9wcr0Fmh/X7Xb1gDyuF2qk7vADYhUta5KxRffXdL+ufLsv7OmmyAxHPxSn5CGy AOxpo1UP9/EulaAg== Received: from hawking.nue2.suse.org (unknown [10.168.4.11]) by relay2.suse.de (Postfix) with ESMTP id AABE92C142; Wed, 13 Sep 2023 15:01:00 +0000 (UTC) Received: by hawking.nue2.suse.org (Postfix, from userid 17005) id 8D4934A04B1; Wed, 13 Sep 2023 17:01:00 +0200 (CEST) From: Andreas Schwab To: Eli Zaretskii Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <83ttrym8jx.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 13 Sep 2023 17:50:26 +0300") References: <83ttrym8jx.fsf@gnu.org> X-Yow: I'm totally DESPONDENT over the LIBYAN situation and the price of CHICKEN.. Date: Wed, 13 Sep 2023 17:01:00 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902 Cc: Spencer Baugh , 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On Sep 13 2023, Eli Zaretskii wrote: > They are inside '..', so the only one who'd care is Emacs, not the > shell. In which case it's the job of whoever provides the value for > %u to handle that. The spec does not allow that. The %u marker cannot be part of a quoted argument. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 13 11:23:22 2023 Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 15:23:22 +0000 Received: from localhost ([127.0.0.1]:35665 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgRi6-0005ds-8y for submit@debbugs.gnu.org; Wed, 13 Sep 2023 11:23:22 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:55893) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgRi2-0005dc-0z for 65902@debbugs.gnu.org; Wed, 13 Sep 2023 11:23:21 -0400 From: Spencer Baugh To: Eli Zaretskii Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <83ttrym8jx.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 13 Sep 2023 17:50:26 +0300") References: <83ttrym8jx.fsf@gnu.org> Date: Wed, 13 Sep 2023 11:23:06 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 65902 Cc: Spencer Baugh , 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> Date: Wed, 13 Sep 2023 14:08:01 +0000 (UTC) >> From: Spencer Baugh >> Cc: 65902@debbugs.gnu.org >> >> On Sep 13, 2023 09:26, Eli Zaretskii wrote: >> >> > I am not sure what you're suggesting. Can you show how the equivalent >> > of: >> > >> > emacsclient --apply message-mailto -- %u >> > >> > would work with that design? >> >> emacsclient --qeval '(message-mailto %u)' >> >> I don't think this can work in general for arbitrary user input: what if %u is replaced with something >> that contains parentheses? > > They are inside '..', so the only one who'd care is Emacs, not the > shell. Agreed. The problem I'm referring to is in Emacs, interpreting arbitrary input from the web as code. (The .desktop commands don't even use a shell, a shell doesn't need to be involved at any point) > In which case it's the job of whoever provides the value for > %u to handle that. The value for %u is an arbitrary string from some other application which wants to open a mailto: URI, and passes it to xdg-open which then passes it to Emacs. Other applications are not aware of what escaping is needed to make Emacs not interpret it as code. And indeed, there's no point in doing that: Emacs is in the best position to do that escaping, if it needs to be done. > And anyway, how is that different from the same problem happening with > your suggested --funcall or --apply? they will bump into the same > issues. No, they won't: --apply passes the arguments as a string, without ever trying to parse them as Lisp. Let's be concrete: imagine %u is replaced with (shell-command "rm -r /") as could happen if an application receives some malicious input. The command line with --qeval is: emacsclient --qeval '(message-mailto (shell-command "rm -r /"))' Emacs receives -eval (message-mailto (shell-command "rm -r /")) and evals (message-mailto (shell-command "rm -r /")) and deletes your files. The command line with --apply is: emacsclient --apply message-mailto '(shell-command "rm -r /")' Emacs receives -apply message-mailto --applyarg (shell-command "rm -r /") and evals (message-mailto "(shell-command \"rm -r /\")") and nothing bad happens. Emacs just needs to get the verbatim string without trying to parse it as Lisp at any point. This is an extremely standard security technique when dealing with malicious input, which is why the previous thread converged on it so quickly. >> Let's not do that this time, okay? >> >> Agreed, I think we reached a consensus in that bug and now I am implementing that consensus. > > AFAIU, there was no consensus reached there, so I'm unsure what are > you alluding to here. Everyone in that thread agreed that something like this --apply design (which passes the strings verbatim to Emacs without evaling them) is what we need, they were just discussing the exact design, and in the end the design that everyone who posted agreed on, matched what I have implemented... I don't think we need to relitigate it. From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 13 12:19:33 2023 Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 16:19:33 +0000 Received: from localhost ([127.0.0.1]:35778 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgSaR-0001O3-Ve for submit@debbugs.gnu.org; Wed, 13 Sep 2023 12:19:33 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:55552) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgSaM-0001Nm-Jo for 65902@debbugs.gnu.org; Wed, 13 Sep 2023 12:19:30 -0400 Received: by mail-pj1-x102b.google.com with SMTP id 98e67ed59e1d1-269304c135aso1077a91.3 for <65902@debbugs.gnu.org>; Wed, 13 Sep 2023 09:19:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694621955; x=1695226755; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=OHDn5s8z/6fcimqjedTQ2kMb1v/0mmyEkORwPSLsM9s=; b=monkQVbF8KFt3yr5l9RUw2IxwDxVW7TGFE6+BBOJb0MBFCjYzWgTbNlA6jRztUXgBY Alcc2JTKUbxVY/3PsvMkwPeLFkkWk3YtUXGvF7kbb22RTvJicOFdrdFKrU8DdjnPFM3G 8KeKJVnrzYdiFpbqh6SHbEEMcBDPLNrsXcCTjP/p6+Vkz95mSHPIj0WQRKtYlSwlQkc+ vzGGE7G26cwyZQdgf2kZZJ7AsDts7fEZYNl22ijrUymgCjfMTiclsR033hE7SZtNFsA0 u4ijj0pn7DnJQEGD/hiEwxIVa8/x5MLOwH2KT82oi0wyyd0mH+AFbxTNZrnYJtTVUYhY 3a5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694621955; x=1695226755; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OHDn5s8z/6fcimqjedTQ2kMb1v/0mmyEkORwPSLsM9s=; b=MLRn7g+kD1XogMmnTz2zRm2kOIVdt9oP+C+tDXhOoSPxg0DC8wOWqDjwqFoO3K1Bcw 9fScbt8mVx0reXaiGpYGTAfi2b5PojsZ+RInHVHvkI4TDHFMImHTCtrfwPq2Kd3Hd+bS DUix7SdfjNArANjY3NhnoL1qXC6V3dwO8Hs2BgkgEmVJLJJ6FAD5vtMhHeVIWQFa4LTS JRfH2sRjA+JlwpLRXKRZ0SwhnnyRkX/IF2/uvyGgzrUxscuqGbM5dlQ5ZInCbb4BLDZr /zn1z7/aro8172AWZS+oMsWzpFJlUeCzgb7eH1C1uRz6rG5JEomopexOZlqNaCMyqQ9j ABOQ== X-Gm-Message-State: AOJu0YyuPFyPEek1Q5I/wt33kzwOi4xx8MI2BVN7QYDRXQV0FN+kQlCe bFeWpAY0De89t+8uSf0GBIA= X-Google-Smtp-Source: AGHT+IGNS8jd8xbl6b2MBvvpNcRXJQ0a92RlNxmKB8cbxomg3ZR7n2cjRd0MuciQqE2WrIpEAN7QDg== X-Received: by 2002:a17:90b:192:b0:26d:d7f:6779 with SMTP id t18-20020a17090b019200b0026d0d7f6779mr2505449pjs.27.1694621955412; Wed, 13 Sep 2023 09:19:15 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id lt12-20020a17090b354c00b00263154aab24sm1658196pjb.57.2023.09.13.09.19.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Sep 2023 09:19:15 -0700 (PDT) Message-ID: <75258dc0-4593-0dd2-f00d-965b37763fd4@gmail.com> Date: Wed, 13 Sep 2023 09:19:15 -0700 MIME-Version: 1.0 Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping Content-Language: en-US To: Spencer Baugh , Eli Zaretskii References: <83ttrym8jx.fsf@gnu.org> From: Jim Porter In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65902 Cc: Spencer Baugh , 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 9/13/2023 8:23 AM, Spencer Baugh wrote: > Eli Zaretskii writes: >> AFAIU, there was no consensus reached there, so I'm unsure what are >> you alluding to here. > > Everyone in that thread agreed that something like this --apply design > (which passes the strings verbatim to Emacs without evaling them) is > what we need, they were just discussing the exact design, and in the end > the design that everyone who posted agreed on, matched what I have > implemented... I don't think we need to relitigate it. That was my impression as well. Most of the discussion in that bug was among Robert (already commenting on this bug in agreement with the current patch), Gregory (who I believe supports the --apply design[1]), Lars (who proposed a form of the --apply design to handle multiple --apply calls[2]), and me (I support --apply, using Lars' semantics if we can get it). [1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57752#119 [2] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57752#122 From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 13 15:13:49 2023 Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 19:13:49 +0000 Received: from localhost ([127.0.0.1]:36055 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgVJ7-0005RT-5Q for submit@debbugs.gnu.org; Wed, 13 Sep 2023 15:13:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34634) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgVJ4-0005RF-B2 for 65902@debbugs.gnu.org; Wed, 13 Sep 2023 15:13:48 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qgVIr-0000E3-Tj; Wed, 13 Sep 2023 15:13:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=bV/vNxfADuTWDvymo8URuOyTi2ZfWISzlE/Kdi1Wu8Q=; b=QmgKeUEKdmd3 zSRKb1YjIn3AymKnbe0fy/oL2VE2TET8UXGRx5AGDCTY2SEFxATrUvg0lQoQcJS5gfNDZZebh5Bn1 Q8lsi9Fo3P32Qo8RplA3YuXwqRK8ezHkGfW06IrT4EcYKv5l/PFsZ8Ku1dnzhSffmkIfOzwZ5N23X w/SG23SStc6pHaAbEVvkQxTyD6Sz1MiBWi8ydBan47H3zNhrCUGgHLwodtd/E322IjCVwEiwh0f44 nPWo+AR3cDpv+YZlDcVe774KMiPfK3DDrzmMO0MUCKWkwu/FSugE4okn8gcNclLDADjH6oaM0Eq5x +AjbsdZQJoxmM1wJv5y9Ow==; Date: Wed, 13 Sep 2023 22:13:18 +0300 Message-Id: <83led9nay9.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (message from Spencer Baugh on Wed, 13 Sep 2023 11:23:06 -0400) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping References: <83ttrym8jx.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902 Cc: sbaugh@catern.com, 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Spencer Baugh > Cc: Spencer Baugh , 65902@debbugs.gnu.org > Date: Wed, 13 Sep 2023 11:23:06 -0400 > > >> Agreed, I think we reached a consensus in that bug and now I am implementing that consensus. > > > > AFAIU, there was no consensus reached there, so I'm unsure what are > > you alluding to here. > > Everyone in that thread agreed that something like this --apply design > (which passes the strings verbatim to Emacs without evaling them) is > what we need, they were just discussing the exact design, and in the end > the design that everyone who posted agreed on, matched what I have > implemented... That's not my reading of that long discussion. And I don't understand why we need to add any options to Emacs itself, btw. The suggestion to have some "symmetry" here was one of the reasons that discussion got nowhere. So let's learn from that mistake, at least. From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 13 15:33:16 2023 Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 19:33:16 +0000 Received: from localhost ([127.0.0.1]:36087 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgVbw-0005wN-40 for submit@debbugs.gnu.org; Wed, 13 Sep 2023 15:33:16 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:42288) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgVbt-0005w8-4R for 65902@debbugs.gnu.org; Wed, 13 Sep 2023 15:33:14 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-68fdd5c1bbbso152074b3a.1 for <65902@debbugs.gnu.org>; Wed, 13 Sep 2023 12:33:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694633581; x=1695238381; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=F+gB88NaKCIgKBd70Uhc7uE9mZZes/1m/liM19sJvCs=; b=FcdcZ+FACBrazUMTD615NjjXLy9Luxw3u8ohVvGySbgVW6EcHEkw+INNP38fvN3P8F LDELXiWtXCIXZcRDv20MtrdpVh6k4rK+4iyd/qyNCpjLgwUlJQwLxFQuPZ5mfBD8Gbf3 OmYDNaNoRwV+VvzkCslW9zZ0XuQ6h0K8tSoOPTagW7NawCqduzbnN5+/iiYZJtiErxuI kq4g/r4FcEBdOwDbWyAtZjYUt0J9XoEO4hf6q+QpcsGNe+U+ull2dneap1OWbCAXwagu h/qjtyD8Ihx7ZTl8Ssad4VCX1aIKqQ0Q2Yk2xrFARARaj2kxmw7ftjU8DX9+OCqV0FVv lohw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694633581; x=1695238381; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=F+gB88NaKCIgKBd70Uhc7uE9mZZes/1m/liM19sJvCs=; b=LqrPrdq/VEXo5brgRKC5jUeu6CsNyusk2apzlwL9CM2VrHApI3wnXgNj2wFF1c8usw yqSsLhXaxPgFRq4qS9/99JThR/gDDmHuVo3m3ZPPcq3oLJ8V5yqlhdpS3IA3ODEysSDC osT/Luz/xTFC58kIW6iRj4jw8M8GbjVuWrCkPgxoo2dP5pxH/+SCWuI0o8f3wczVTQPe xmkaQv7IsNLqn/QdnFBD+bZeDgxUgUY3lV+9YemjLBzSoJ8UFff4eVPUwBt29eEECJU3 ZjwwQmx/fuFMF+Ys3koaTKWPAy95eTLXcCAGuLkFo6sKWQ+UPFiDOKZa5UvIFX78coE9 5JWA== X-Gm-Message-State: AOJu0YzTAbkqxw4NMlBX8WySaojFAa0NDWDcrjxBL3x8cbSjLpZ+l5fs Ln365LyLngMsaGs0Vi/dDno= X-Google-Smtp-Source: AGHT+IEBsjJiFTdPI4fEeF9bkB81AbSBUORHtPzsEV2Doq7IMTHe938AjmgjKO3sV6Qa6tvcvSitcA== X-Received: by 2002:a05:6a21:a5a2:b0:138:68b9:138e with SMTP id gd34-20020a056a21a5a200b0013868b9138emr10680399pzc.8.1694633581358; Wed, 13 Sep 2023 12:33:01 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id o6-20020a639206000000b0056c3a4a3ca5sm9182434pgd.36.2023.09.13.12.33.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Sep 2023 12:33:00 -0700 (PDT) Message-ID: <66a6c09e-3b61-d913-5638-4c804fb826f6@gmail.com> Date: Wed, 13 Sep 2023 12:33:01 -0700 MIME-Version: 1.0 Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping Content-Language: en-US To: Eli Zaretskii , Spencer Baugh References: <83ttrym8jx.fsf@gnu.org> <83led9nay9.fsf@gnu.org> From: Jim Porter In-Reply-To: <83led9nay9.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65902 Cc: sbaugh@catern.com, 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 9/13/2023 12:13 PM, Eli Zaretskii wrote: > And I don't understand why we need to add any options to Emacs itself, > btw. The suggestion to have some "symmetry" here was one of the > reasons that discussion got nowhere. So let's learn from that > mistake, at least. There's a practical benefit to this. If you have $EDITOR set in your environment to something like "emacsclient --alternate-editor=emacs", then it would be nice if you could say this: $EDITOR --apply some-func arg1 arg2 and have it do the same thing whether or not there was already an Emacs server running. The symmetry between the two commands (plus proper argument forwarding) would make that work. However, if people can't agree, then we could probably drop that part. To me, it sounds like people *do* agree that this would be good to have though. From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 13 16:01:00 2023 Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 20:01:00 +0000 Received: from localhost ([127.0.0.1]:36115 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgW2m-0006h2-7W for submit@debbugs.gnu.org; Wed, 13 Sep 2023 16:01:00 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:38715) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgW2h-0006gl-S7 for 65902@debbugs.gnu.org; Wed, 13 Sep 2023 16:00:59 -0400 From: Spencer Baugh To: Jim Porter Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <66a6c09e-3b61-d913-5638-4c804fb826f6@gmail.com> (Jim Porter's message of "Wed, 13 Sep 2023 12:33:01 -0700") References: <83ttrym8jx.fsf@gnu.org> <83led9nay9.fsf@gnu.org> <66a6c09e-3b61-d913-5638-4c804fb826f6@gmail.com> Date: Wed, 13 Sep 2023 16:00:44 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 65902 Cc: sbaugh@catern.com, Eli Zaretskii , 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Jim Porter writes: > On 9/13/2023 12:13 PM, Eli Zaretskii wrote: >> And I don't understand why we need to add any options to Emacs itself, >> btw. The suggestion to have some "symmetry" here was one of the >> reasons that discussion got nowhere. So let's learn from that >> mistake, at least. > > There's a practical benefit to this. If you have $EDITOR set in your > environment to something like "emacsclient --alternate-editor=emacs", > then it would be nice if you could say this: > > $EDITOR --apply some-func arg1 arg2 > > and have it do the same thing whether or not there was already an > Emacs server running. The symmetry between the two commands (plus > proper argument forwarding) would make that work. This already works out of the box with --alternate-editor='', no need for any argument forwarding, and no need for support for this argument in Emacs itself. It doesn't work with --alternate-editor=emacs, but I think that is OK. I think the alternate-editor='' configuration is far more common, and that works just fine. And we have not before done any special casing for forwarding arguments from emacsclient to alternate-editor=emacs, so I don't think there's any reason to start now. (I personally think that alternate-editor=emacs is somewhat ill-advised, since it doesn't ensure that the server gets started) That being said, supporting --apply in Emacs itself is fine with me, although it's not strictly necessary since in Emacs itself, --apply func -- is basically equivalent to --eval (apply func command-line-args-left) (This doesn't work in emacsclient, and would be very difficult to support, so --apply is necessary for emacsclient) > However, if people can't agree, then we could probably drop that > part. To me, it sounds like people *do* agree that this would be good > to have though. I'm fine either way. From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 13 16:17:11 2023 Received: (at 65902) by debbugs.gnu.org; 13 Sep 2023 20:17:11 +0000 Received: from localhost ([127.0.0.1]:36146 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgWIR-000762-GL for submit@debbugs.gnu.org; Wed, 13 Sep 2023 16:17:11 -0400 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:56385) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgWIL-00075I-Q8 for 65902@debbugs.gnu.org; Wed, 13 Sep 2023 16:17:10 -0400 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1c3d6d88231so1712105ad.0 for <65902@debbugs.gnu.org>; Wed, 13 Sep 2023 13:17:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694636214; x=1695241014; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=IHE+8ysMfov6Vqntvfxo86lTBD8ipiD6Sg6CHzf9Hmg=; b=c2p+2/PiP5oCMGt0MkLuNhF0Fv+UX18qYS0F01VuBoclF1sBKZeIOXnflFM8MxoVlh BZ38s7YvFSGY+448reDQrz/OFTCZF4f9vttQzypc9ovB9Z++gMRTLmtBJjUAtxHXVGDv g8qNRvGKrWlXQyxrVRkn6j3HYyILhrqJ7y1WU3pLYFLM7NoM3CGbIx7OK3UlBf67FRMx hFui9VWuVS/Jt6qohJOyh9+TqrVSEaLtt65Dw7EIPkqjKFIACbh78V4DXzVOMRz9cVGe /562cuRAhBJqKc6A4ot4FwsIV1E7UzgWRqx/YTAybwOknGObA0rIB0RXXcNeXGp3QMIu n7ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694636214; x=1695241014; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IHE+8ysMfov6Vqntvfxo86lTBD8ipiD6Sg6CHzf9Hmg=; b=OXl6s59qsy+1LTs75MSCMUiUT/GtlTjP1RXunbwLfRA3H9Ld5AhJ2qz58iGTSvy7Al 5vjy2qPAAjbLrptGPd2WUvs2vgrq4s8/KBBZs3hqsCVOy7YHobWyKaaFkXqhgR08r/uG 2D8V2qtJrOUNYnSxJPInnS4YVs/MU/8b4izbPFHe+fQD+XuY8JzhY9b5BuzxpZGPSHjv MERyvlhOyfzDWGed6rPNZxdm4FjZYZ97GCAFoRnM++CtT0Em9+HCS+GsVnsdZ51oO8bQ FU4mNfVC4m1RtHIAtsewdjPwOxdDWTTMLg9VQM7qQ2pphZWEzhXonRnShGV4KfQE81XB W0Iw== X-Gm-Message-State: AOJu0YxMqJdbf3XHmld880UOnOYWb2vTQBaxCEyZWOVW5UEM4UtSoorz LL8rCmNFZIEJj4G3dWRwyA8= X-Google-Smtp-Source: AGHT+IFgAS9Im6PiSg+XRyFLDNnXtxi+J1cdNCp4TFJC3ZINWIgp48K+ATBgM//DQCZIC54IjTrqBQ== X-Received: by 2002:a17:90a:9482:b0:273:c314:e112 with SMTP id s2-20020a17090a948200b00273c314e112mr3318228pjo.15.1694636214445; Wed, 13 Sep 2023 13:16:54 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id mn6-20020a17090b188600b00263ba6a248bsm1896115pjb.1.2023.09.13.13.16.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Sep 2023 13:16:54 -0700 (PDT) Message-ID: <5d914d93-4c99-f809-4332-d50886ed112f@gmail.com> Date: Wed, 13 Sep 2023 13:16:54 -0700 MIME-Version: 1.0 Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping Content-Language: en-US To: Spencer Baugh References: <83ttrym8jx.fsf@gnu.org> <83led9nay9.fsf@gnu.org> <66a6c09e-3b61-d913-5638-4c804fb826f6@gmail.com> From: Jim Porter In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65902 Cc: sbaugh@catern.com, Eli Zaretskii , 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 9/13/2023 1:00 PM, Spencer Baugh wrote: > It doesn't work with --alternate-editor=emacs, but I think that is OK. > I think the alternate-editor='' configuration is far more common, and > that works just fine. In that case, I think the benefits of "emacs --apply" are somewhat reduced, but it does still make some cases a bit easier. ("emacs-mail.desktop" could use it, which would let us simplify the implementation of 'message-mailto' a little.) Still, if we dropped "emacs --apply" I wouldn't stamp my feet about it. The main benefit is for emacsclient anyway, where it seems we have consensus. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 14 01:11:32 2023 Received: (at 65902) by debbugs.gnu.org; 14 Sep 2023 05:11:32 +0000 Received: from localhost ([127.0.0.1]:36500 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgedW-0000qA-6T for submit@debbugs.gnu.org; Thu, 14 Sep 2023 01:11:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36462) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgedU-0000pq-TW for 65902@debbugs.gnu.org; Thu, 14 Sep 2023 01:11:29 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qgedH-0001El-EY; Thu, 14 Sep 2023 01:11:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=sR6oLOlMwRREl5GogAaCuJ2oalJ5PZ6d995/rbK0DAY=; b=Cr8ukZZJPNCo Ti/pNe+nkyUrKpSUlQhNfpJJdAh3zIUBATlNzZMHIkesFcx3K51j6twHFpXjiQeGsIA9ETSlrty5i L4Mc79Dj8jODRqPZMF5xVxw/tLOfwqoY33ftiPyNS65lEPO/ysMI6Rfbit8UjynneHMei/bFrDPj7 wqYyzfgobyYQXd4JdHFSo24TSOnKNZfaEJky34zIfCcF56ytZLQ+AO5+jt86p52M91NxfC4Cu/ZL/ CbnNfNSQE7fUS9rsTYMxEt+t4yupH3rvth6RVQCy5rEiXMiNojNqBi7iKS8aGGLrFOyaxAzkfSMJT v0HXYrUGwa02yL6Fwi0mWQ==; Date: Thu, 14 Sep 2023 08:10:58 +0300 Message-Id: <83edj1mja5.fsf@gnu.org> From: Eli Zaretskii To: Jim Porter In-Reply-To: <66a6c09e-3b61-d913-5638-4c804fb826f6@gmail.com> (message from Jim Porter on Wed, 13 Sep 2023 12:33:01 -0700) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping References: <83ttrym8jx.fsf@gnu.org> <83led9nay9.fsf@gnu.org> <66a6c09e-3b61-d913-5638-4c804fb826f6@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, sbaugh@janestreet.com, sbaugh@catern.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Wed, 13 Sep 2023 12:33:01 -0700 > Cc: sbaugh@catern.com, 65902@debbugs.gnu.org > From: Jim Porter > > On 9/13/2023 12:13 PM, Eli Zaretskii wrote: > > And I don't understand why we need to add any options to Emacs itself, > > btw. The suggestion to have some "symmetry" here was one of the > > reasons that discussion got nowhere. So let's learn from that > > mistake, at least. > > There's a practical benefit to this. If you have $EDITOR set in your > environment to something like "emacsclient --alternate-editor=emacs", > then it would be nice if you could say this: > > $EDITOR --apply some-func arg1 arg2 > > and have it do the same thing whether or not there was already an Emacs > server running. The symmetry between the two commands (plus proper > argument forwarding) would make that work. > > However, if people can't agree, then we could probably drop that part. > To me, it sounds like people *do* agree that this would be good to have > though. People might agree, but I don't. Please consider the perspective. This started as an obscure and rare problem in a desktop file (which we provided solely out of good will, since it really isn't our job to do so, it's the job of downstream distros). The proposed solution was to add a completely new option to emacsclient, with its own special syntax and rules about what can and cannot be done with it. This is already something that should raise brows: how can such an unimportant reason cause us to make such significant changes? We didn't yet finish discussing that nor even had time to understand all the implications (remember: Lars suggested to support several such options, which required another special option), and we already are told that "for symmetry" we should add the same to Emacs. All that where just yesterday there was no need for any new options in either, and if we decided to drop those desktop files from our sources (which I personally am tempted to do every few weeks, due to issues they cause us all the time since their introduction), then even the original need will miraculously disappear into thin air. So this is a classic case of the tail wagging the dog. What about alternative solutions: use a shell script in the desktop files, and delegate to that script to solve the problem with quoting? Had anyone considered this strategy? If not, why not? I would in general prefer not to add any new options to our programs due to this weak reason. Once again: it is not our job to get these desktop files right in every single downstream environment, so let's not make it our problem, certainly not a problem we should solve using such non-trivial solutions. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 14 07:04:04 2023 Received: (at 65902) by debbugs.gnu.org; 14 Sep 2023 11:04:04 +0000 Received: from localhost ([127.0.0.1]:37802 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgk8e-0005Dv-Ho for submit@debbugs.gnu.org; Thu, 14 Sep 2023 07:04:04 -0400 Received: from s.wfbtzhsw.outbound-mail.sendgrid.net ([159.183.224.105]:58788) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgk8b-0005Dg-1y for 65902@debbugs.gnu.org; Thu, 14 Sep 2023 07:03:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=from:subject:in-reply-to:references:mime-version:to:cc:content-type: content-transfer-encoding:cc:content-type:from:subject:to; s=s1; bh=MMnER4WM7dnXJgyHkY+X3lFDYF0U24d2qdrXMdVSwtY=; b=ukLZIifqYcfpG1kXwCW456QXkubEJcKhU5QgSDfSZ5fXFyS40x8YOVs2u7YOKJoMvfk4 0xy3MKu3s+1ZuCs1TkdYc2owkSl3a7Da9gGm6984stBXL6BYGZjBLQrHkaQ+Hax9N5SPxJ xPLPei98bsvld5TYmmwiyxtJwy5/QL2bHKk4rJoEpyNXu11dAbtBqlyonPj1XC8CDBLveG butM2P5CCzQ6nrA09K6DymlhgRNdBie0uPLfjkH+BfdnMhpYWTx7iPH6pK94Im3ypCyAFn ks9b9zTl2VqNP1lEsBkW5bsX6BSPok0rvWwA8Th/cR1kqxuSCj4xsOlEUXVYBBEw== Received: by filterdrecv-84b96456cb-zd4xh with SMTP id filterdrecv-84b96456cb-zd4xh-1-6502E890-A 2023-09-14 11:03:44.135318015 +0000 UTC m=+10927530.760105120 Received: from earth.catern.com (unknown) by geopod-ismtpd-22 (SG) with ESMTP id 2nl0BncCS_m_-Lgammhxgw Thu, 14 Sep 2023 11:03:43.397 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost; envelope-from=sbaugh@catern.com; receiver=gnu.org Received: from localhost (localhost [IPv6:::1]) by earth.catern.com (Postfix) with ESMTPSA id 4966765674; Thu, 14 Sep 2023 07:03:42 -0400 (EDT) From: sbaugh@catern.com Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <83edj1mja5.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 14 Sep 2023 08:10:58 +0300") References: <83ttrym8jx.fsf@gnu.org> <83led9nay9.fsf@gnu.org> <66a6c09e-3b61-d913-5638-4c804fb826f6@gmail.com> <83edj1mja5.fsf@gnu.org> Date: Thu, 14 Sep 2023 11:03:44 +0000 (UTC) Message-ID: <87il8dt3sh.fsf@catern.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbIOnyHASvNJhhaui0lq+6?= =?us-ascii?Q?SDln5iM21jX0qMLrjCdMDzaMx3kRWoX454Ec+ZB?= =?us-ascii?Q?IgTEvQv++Cw7ZGLOUVByNR93IR+9CTHrZfiX00b?= =?us-ascii?Q?QtUSzKNiP0Ha5qT12trxFRvSADc3HaddLNBtnJ+?= =?us-ascii?Q?vdMkAEn5=2FnQddynAW9msIx0HiGUk85SHJzw=3D=3D?= To: Eli Zaretskii X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65902 Cc: Jim Porter , sbaugh@janestreet.com, 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> Date: Wed, 13 Sep 2023 12:33:01 -0700 >> Cc: sbaugh@catern.com, 65902@debbugs.gnu.org >> From: Jim Porter >> >> On 9/13/2023 12:13 PM, Eli Zaretskii wrote: >> > And I don't understand why we need to add any options to Emacs itself, >> > btw. The suggestion to have some "symmetry" here was one of the >> > reasons that discussion got nowhere. So let's learn from that >> > mistake, at least. >> >> There's a practical benefit to this. If you have $EDITOR set in your >> environment to something like "emacsclient --alternate-editor=emacs", >> then it would be nice if you could say this: >> >> $EDITOR --apply some-func arg1 arg2 >> >> and have it do the same thing whether or not there was already an Emacs >> server running. The symmetry between the two commands (plus proper >> argument forwarding) would make that work. >> >> However, if people can't agree, then we could probably drop that part. >> To me, it sounds like people *do* agree that this would be good to have >> though. > > People might agree, but I don't. Please consider the perspective. > This started as an obscure and rare problem in a desktop file (which > we provided solely out of good will, since it really isn't our job to > do so, it's the job of downstream distros). The proposed solution was > to add a completely new option to emacsclient, with its own special > syntax and rules about what can and cannot be done with it. This is > already something that should raise brows: how can such an unimportant > reason cause us to make such significant changes? We didn't yet > finish discussing that nor even had time to understand all the > implications (remember: Lars suggested to support several such > options, which required another special option), and we already are > told that "for symmetry" we should add the same to Emacs. All that > where just yesterday there was no need for any new options in either, > and if we decided to drop those desktop files from our sources (which > I personally am tempted to do every few weeks, due to issues they > cause us all the time since their introduction), then even the > original need will miraculously disappear into thin air. The issue is not really with the desktop file. It's a generic problem: Suppose I have some arbitrary data which I want to send to the Emacs server (in this case, a URI). Today, there's no easy way to do that. - One approach is to stick the data inside an --eval call, as emacsclient-mail.desktop is doing. Getting the quoting right is hard and complex, and even Emacs developers have failed at it over multiple iterations, and when they fail it either breaks or exposes a security vulnerability. It is currently broken for me. - Another approach is to do what org-protocol does (shipped with Emacs!), and advise server-visit-files (with org-protocol-check-filename-for-protocol), and pass the data as a string FILE argument to emacsclient which gets intercepted by advice. But this is of course a gross hack, and also it still requires escaping the data, since some characters will still be specially interpreted. It would be nice to get rid of this org-protocol hack which is shipped with Emacs. - A third approach is to put the data in a temporary file and pass the path of that file to emacsclient, then use an --eval to process the file. But this doesn't work when emacsclient and the Emacs server are on different hosts or in different environments. - Finally, a fourth approach is to teach emacsclient to be able to send this arbitrary data to Emacs on its own. Such as by adding --apply. There are a bunch of designs for that, but all of them require modifying emacsclient. I have many times before wanted to be able to pass data to Emacs without worrying about escaping. This would be a very useful feature to have. And it would be nice to get rid of the org-protocol hack, and get rid of the complicated and broken escaping needed for things like emacsclient-mail.desktop. > So this is a classic case of the tail wagging the dog. > > What about alternative solutions: use a shell script in the desktop > files, and delegate to that script to solve the problem with quoting? > Had anyone considered this strategy? If not, why not? Getting the quoting right is hard and complex, and even Emacs developers have failed at it over multiple iterations, and when they fail it either breaks or exposes a security vulnerability. This solution is far simpler, and is reusable for many other different purposes. > I would in general prefer not to add any new options to our programs > due to this weak reason. Once again: it is not our job to get these > desktop files right in every single downstream environment, so let's > not make it our problem, certainly not a problem we should solve using > such non-trivial solutions. We don't have to add it to Emacs itself. But it's not just for the desktop files. It's a relatively small feature to add to emacsclient, and it's something that I've heard years of user requests for. I have many times before wanted to be able to pass data to Emacs without worrying about escaping. This would be a very useful feature to have. It would be nice to get rid of the org-protocol hack, and get rid of the complicated and broken escaping needed for things like emacsclient-mail.desktop. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 14 07:18:30 2023 Received: (at 65902) by debbugs.gnu.org; 14 Sep 2023 11:18:30 +0000 Received: from localhost ([127.0.0.1]:37828 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgkMf-0005Z3-DD for submit@debbugs.gnu.org; Thu, 14 Sep 2023 07:18:30 -0400 Received: from s.wrqvtzvf.outbound-mail.sendgrid.net ([149.72.126.143]:22236) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgkMa-0005Ym-EY for 65902@debbugs.gnu.org; Thu, 14 Sep 2023 07:18:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=from:subject:in-reply-to:references:mime-version:to:cc:content-type: cc:content-type:from:subject:to; s=s1; bh=VW/UV2g9DzSt763rbHdI0QwrZHDDIGVyGo6eN5I+p8E=; b=ngOvkqOiTriBjnq2scW3Br2d4AqnEBO6jH3CtxvSYv8KkAY2D5wmir7MOb/fTH77Y7XD xbHk+8J7wTezEM9XnYzHVojVPgdv8ZuTD286xtLJxUCL63Fd1ugj7yoFitG8pbatzHNoTb 6nCX1lnhGfTn1yTNzZl43ZeAtkcqOWEbgQNB7SW5u6xQjKELMZXy6ux4smV41PRMiyvYy7 GyRJAXxq3BhPVUKLiqKRyuF7tpkCJdz6ltY9VWukQcAFysdFwnKzNvhu6y55nCTr+mC4Cs OVvktwfUlvVRfgQyTU6hkvgV0jaehcHxNUGNSCsc9eeB4QLGTI8wApcLg+FTmM8A== Received: by filterdrecv-d7bbbc8bf-b8xkx with SMTP id filterdrecv-d7bbbc8bf-b8xkx-1-6502EBF4-1D 2023-09-14 11:18:12.954633677 +0000 UTC m=+10928306.467982787 Received: from earth.catern.com (unknown) by geopod-ismtpd-8 (SG) with ESMTP id KZBwylntSfOfKyy8ktfmBw Thu, 14 Sep 2023 11:18:12.807 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost; envelope-from=sbaugh@catern.com; receiver=gnu.org Received: from localhost (localhost [IPv6:::1]) by earth.catern.com (Postfix) with ESMTPSA id 3C76B60129; Thu, 14 Sep 2023 07:18:12 -0400 (EDT) From: sbaugh@catern.com Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <87il8dt3sh.fsf@catern.com> (sbaugh@catern.com's message of "Thu, 14 Sep 2023 11:03:44 +0000 (UTC)") References: <83ttrym8jx.fsf@gnu.org> <83led9nay9.fsf@gnu.org> <66a6c09e-3b61-d913-5638-4c804fb826f6@gmail.com> <83edj1mja5.fsf@gnu.org> <87il8dt3sh.fsf@catern.com> Date: Thu, 14 Sep 2023 11:18:13 +0000 (UTC) Message-ID: <87edj1t34b.fsf@catern.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbJZGaI4O8qNQ4TgjNkgKQ?= =?us-ascii?Q?BtPLyhyhmLAJUHmm8ZUshkasbKFJ2tGwjGJVwOD?= =?us-ascii?Q?dehFfuxzxFk9gkOQc08uLBFVT44sp5cn+5PFiS3?= =?us-ascii?Q?7btt9H+JJ4QiFBVcRy7elBUJoOyV2y6IqAVZ96Q?= =?us-ascii?Q?a+3SXhgamLqi9kWsGxtrz82abX9kuvGamKg=3D=3D?= To: Eli Zaretskii X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Here's a revised patch which drops adding the argument to Emacs itself; it only adds an argument to emacsclient. From d4558462598eaa33466b3b2fb1dbcc26ea877ede Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Thu, 14 Sep 2023 07:12:22 -0400 Subject: [PATCH] Add --apply argument to emacsclien [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, Jim Porter , sbaugh@janestreet.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) --=-=-= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Here's a revised patch which drops adding the argument to Emacs itself; it only adds an argument to emacsclient. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Add-apply-argument-to-emacsclient-to-avoid-escaping.patch >From d4558462598eaa33466b3b2fb1dbcc26ea877ede Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Thu, 14 Sep 2023 07:12:22 -0400 Subject: [PATCH] Add --apply argument to emacsclient to avoid escaping Passing arguments to functions through emacsclient --eval requires complicated escaping (as seen in emacsclient-mail.desktop before this change). The new --apply argument for emacsclient passes command line arguments as uninterpreted strings to the specified function. This simplifies use cases where arbitrary input needs to be passed to Emacs. org-protocol will be able to use this as well, which will allow it to eventually drop its current advice on server-visit-files. * etc/emacsclient-mail.desktop: Use --apply. (bug#65902) * lib-src/emacsclient.c (longopts, decode_options, main): Add support for --apply. * lisp/server.el (server-apply-and-print): Add. (server-process-filter): Add support for -apply and -applyargs --- etc/emacsclient-mail.desktop | 7 ++----- lib-src/emacsclient.c | 36 ++++++++++++++++++++++++++++++++++-- lisp/server.el | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 7 deletions(-) diff --git a/etc/emacsclient-mail.desktop b/etc/emacsclient-mail.desktop index 0a2420ddead..ea0690bacd9 100644 --- a/etc/emacsclient-mail.desktop +++ b/etc/emacsclient-mail.desktop @@ -1,10 +1,7 @@ [Desktop Entry] 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=$(echo "$1" | sed 's/[\"]/\\&/g'); exec emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"$u\")" -# Special chars '"', '$', and '\' must be escaped as '\\"', '\\$', and '\\\\'. -Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u +Exec=emacsclient --alternate-editor= --apply message-mailto -- %u Icon=emacs Name=Emacs (Mail, Client) MimeType=x-scheme-handler/mailto; @@ -16,7 +13,7 @@ Actions=new-window;new-instance; [Desktop Action new-window] Name=New Window -Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --create-frame --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u +Exec=emacsclient --alternate-editor= --create-frame --apply message-mailto -- %u [Desktop Action new-instance] Name=New Instance diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 698bf9b50ae..159c22d1ae9 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -116,6 +116,9 @@ #define DEFAULT_TIMEOUT (30) /* True means args are expressions to be evaluated. --eval. */ static bool eval; +/* The function to call. Other arguments are passed as strings. --apply. */ +static char *apply; + /* True means open a new frame. --create-frame etc. */ static bool create_frame; @@ -169,6 +172,7 @@ #define DEFAULT_TIMEOUT (30) { "quiet", no_argument, NULL, 'q' }, { "suppress-output", no_argument, NULL, 'u' }, { "eval", no_argument, NULL, 'e' }, + { "apply", required_argument, NULL, 'y' }, { "help", no_argument, NULL, 'H' }, { "version", no_argument, NULL, 'V' }, { "tty", no_argument, NULL, 't' }, @@ -552,6 +556,10 @@ decode_options (int argc, char **argv) eval = true; break; + case 'y': + apply = optarg; + break; + case 'q': quiet = true; break; @@ -690,6 +698,7 @@ print_help_and_exit (void) -F ALIST, --frame-parameters=ALIST\n\ Set the parameters of a new frame\n\ -e, --eval Evaluate the FILE arguments as ELisp expressions\n\ +-y, --apply FUNC Call ELisp FUNC, passing all FILE arguments as strings\n\ -n, --no-wait Don't wait for the server to return\n\ -w, --timeout=SECONDS Seconds to wait before timing out\n\ -q, --quiet Don't display messages on success\n\ @@ -1953,7 +1962,7 @@ main (int argc, char **argv) /* Process options. */ decode_options (argc, argv); - if (! (optind < argc || eval || create_frame)) + if (! (optind < argc || eval || apply || create_frame)) { message (true, ("%s: file name or argument required\n" "Try '%s --help' for more information\n"), @@ -1961,6 +1970,14 @@ main (int argc, char **argv) exit (EXIT_FAILURE); } + if (eval && apply) + { + message (true, ("%s: can't pass both --eval and --apply\n" + "Try '%s --help' for more information\n"), + progname, progname); + exit (EXIT_FAILURE); + } + #ifdef SOCKETS_IN_FILE_SYSTEM if (tty) { @@ -2080,6 +2097,13 @@ main (int argc, char **argv) send_to_emacs (emacs_socket, " "); continue; } + else if (apply) + { + send_to_emacs (emacs_socket, "-applyarg "); + quote_argument (emacs_socket, argv[i]); + send_to_emacs (emacs_socket, " "); + continue; + } char *p = argv[i]; if (*p == '+') @@ -2136,10 +2160,18 @@ main (int argc, char **argv) send_to_emacs (emacs_socket, " "); } + if (apply) + { + send_to_emacs (emacs_socket, "-apply "); + quote_argument (emacs_socket, apply); + send_to_emacs (emacs_socket, " "); + } + + send_to_emacs (emacs_socket, "\n"); /* Wait for an answer. */ - if (!eval && !tty && !nowait && !quiet && 0 <= process_grouping ()) + if (!eval && !apply && !tty && !nowait && !quiet && 0 <= process_grouping ()) { printf ("Waiting for Emacs..."); skiplf = false; diff --git a/lisp/server.el b/lisp/server.el index c3325e5a24c..5981e90625d 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -873,6 +873,17 @@ server-eval-and-print (point-min) (point-max)))) (server-reply-print (server-quote-arg text) proc))))))) +(defun server-apply-and-print (func args proc) + "Call FUNC on ARGS and send the result back to client PROC." + (let ((v (with-local-quit (eval (apply (intern func) args) t)))) + (when proc + (with-temp-buffer + (let ((standard-output (current-buffer))) + (pp v) + (let ((text (buffer-substring-no-properties + (point-min) (point-max)))) + (server-reply-print (server-quote-arg text) proc))))))) + (defconst server-msg-size 1024 "Maximum size of a message sent to a client.") @@ -1196,6 +1207,7 @@ server-process-filter tty-type ; string. files filepos + applyargs args-left) ;; Remove this line from STRING. (setq string (substring string (match-end 0))) @@ -1323,6 +1335,28 @@ server-process-filter commands) (setq filepos nil))) + ;; -apply FUNC: Call a function on arguments. + ("-apply" + (if use-current-frame + (setq use-current-frame 'always)) + (let ((func (pop args-left))) + (if coding-system + (setq func (decode-coding-string func coding-system))) + (push (lambda () (server-apply-and-print func applyargs proc)) + commands) + (setq applyargs nil) + (setq filepos nil))) + + ;; -applyarg ARG: Add an argument for later -apply. + ("-applyarg" + (if use-current-frame + (setq use-current-frame 'always)) + (let ((arg (pop args-left))) + (if coding-system + (setq arg (decode-coding-string arg coding-system))) + (push arg applyargs) + (setq filepos nil))) + ;; -env NAME=VALUE: An environment variable. ("-env" (let ((var (pop args-left))) -- 2.41.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 14 07:35:41 2023 Received: (at 65902) by debbugs.gnu.org; 14 Sep 2023 11:35:41 +0000 Received: from localhost ([127.0.0.1]:37844 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgkdJ-0000BX-Ce for submit@debbugs.gnu.org; Thu, 14 Sep 2023 07:35:41 -0400 Received: from s.wfbtzhsw.outbound-mail.sendgrid.net ([159.183.224.105]:40538) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgkdF-0000BH-Oo for 65902@debbugs.gnu.org; Thu, 14 Sep 2023 07:35:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=from:subject:in-reply-to:references:mime-version:to:cc:content-type: content-transfer-encoding:cc:content-type:from:subject:to; s=s1; bh=L7wDdi2vczeThzdk5D/eQxsy4xDd3iKUH0ezmqWzt9A=; b=hfBTa0kFmNl7v+23xp9yOFNG4LAEScgLr2jFsRgP+tIbBp67IVMLLyLs7nqV2VOgp73Y YuNrAaqlyUu4PjDJikJ7pS1HxiDE7rTNflANKZOGCfpooESzmK1KkON+zLrFBBact4POko 8/7l5j9OozWIMEDcVk3+ShGjKaNnf2OTn6e2prHdgW0+OD/RAS34ewcA9v1OB4/Yga2qSi q7PLxT2Fw6Bdd4Afd+/bzy4u3M5tQa36nD3vhTcQLf9in6vGoaTOzUwHUh7msaRWYcuHIk YJfneqGV3nSVaCZB/cEie5uWzU9DQVQipQDNGdR3ZO4DN67/MKvzYUTSmnwsF2Pg== Received: by filterdrecv-84b96456cb-b9h64 with SMTP id filterdrecv-84b96456cb-b9h64-1-6502EFFC-4F 2023-09-14 11:35:24.918209162 +0000 UTC m=+3867150.254278078 Received: from earth.catern.com (unknown) by geopod-ismtpd-12 (SG) with ESMTP id qF8skRtNSbCDGnc6GuFNeQ Thu, 14 Sep 2023 11:35:24.583 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost; envelope-from=sbaugh@catern.com; receiver=gnu.org Received: from localhost (localhost [IPv6:::1]) by earth.catern.com (Postfix) with ESMTPSA id 1A0A360129; Thu, 14 Sep 2023 07:35:24 -0400 (EDT) From: sbaugh@catern.com Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <87il8dt3sh.fsf@catern.com> (sbaugh@catern.com's message of "Thu, 14 Sep 2023 11:03:44 +0000 (UTC)") References: <83ttrym8jx.fsf@gnu.org> <83led9nay9.fsf@gnu.org> <66a6c09e-3b61-d913-5638-4c804fb826f6@gmail.com> <83edj1mja5.fsf@gnu.org> <87il8dt3sh.fsf@catern.com> Date: Thu, 14 Sep 2023 11:35:24 +0000 (UTC) Message-ID: <87a5tpt2bo.fsf@catern.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbJMDlYe6YMWlSeLtU4L7O?= =?us-ascii?Q?BKbcfQPBu4ptfh+7c8hKtnpX=2FscgTHVfJ+w7G+E?= =?us-ascii?Q?m242VIUm6fpYaN9VGXwZyPxHK3ZVuQOANv4hMAW?= =?us-ascii?Q?hKl4OPfLhhUStUESeATo66kSasa2yQp27RSmNmb?= =?us-ascii?Q?cX9IeEOwJ3e6XBO+aElFXSePVdJKJIz2iJA=3D=3D?= To: Eli Zaretskii X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, Jim Porter , sbaugh@janestreet.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) sbaugh@catern.com writes: > - Finally, a fourth approach is to teach emacsclient to be able to send > this arbitrary data to Emacs on its own. Such as by adding --apply. > There are a bunch of designs for that, but all of them require > modifying emacsclient. BTW, if this specific approach of --apply seems inelegant to you, I could make a different design work. As long as Lisp code gets direct access to the arguments as strings, without needing escaping. One person in the previous thread proposed making a command-line-args-left equivalent for emacsclient. If we did this, it wouldn't require adding any new arguments to the emacsclient interface. This could be called server-eval-args-left, so that --apply could be done instead as: emacsclient --eval '(progn (apply func server-eval-args-left) (setq server-eval-args-left nil))' arg1 arg2 I can do that if you prefer that, but it will require some more significant changes to the internals (because currently server.el processes -eval commands one at a time and doesn't have access to the subsequent ones). From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 14 09:36:56 2023 Received: (at 65902) by debbugs.gnu.org; 14 Sep 2023 13:36:56 +0000 Received: from localhost ([127.0.0.1]:37993 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgmWe-0005uT-7l for submit@debbugs.gnu.org; Thu, 14 Sep 2023 09:36:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39564) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgmWZ-0005uD-Dz for 65902@debbugs.gnu.org; Thu, 14 Sep 2023 09:36:55 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qgmWM-0004fY-Kd; Thu, 14 Sep 2023 09:36:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=EGvyrUjSTL0VHyHjQfsOuXbdgAfq6ILkvKI9VD9Iqyo=; b=qCsv8WDMCxEI xGX6riJrQ+2jzdoT5zR1pwzW5ZIQLF7TZ5Npyqn8c7eBWCXZJd0Bb19Dx/3R4ebxdr5rQRlq5zPpr trwb0DbKQXVWutLflnCBaGPTpFgq5lk7zawSor+tkgKsjFjquLwsoRMG/ZnudkCV8rz6tFWAxS5cj 2pK2bRTOjg2zpcLS/VeA7tt1HSmQPCg6sGQ8a/811Ns56c1jMUKynHEqt4kzbAXHxNJ21WsNbJ3/p SSCGlK6/4mVh3At8+pgfPkwNH2pu22mS5uIK//rBJPGR9tAjHccTj0kvO+KSs1E7rX8PYH7FqusBd 4jCc/iOrUo//4QI/LadEVQ==; Date: Thu, 14 Sep 2023 16:36:06 +0300 Message-Id: <83pm2klvw9.fsf@gnu.org> From: Eli Zaretskii To: sbaugh@catern.com In-Reply-To: <87il8dt3sh.fsf@catern.com> (sbaugh@catern.com) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping References: <83ttrym8jx.fsf@gnu.org> <83led9nay9.fsf@gnu.org> <66a6c09e-3b61-d913-5638-4c804fb826f6@gmail.com> <83edj1mja5.fsf@gnu.org> <87il8dt3sh.fsf@catern.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902 Cc: jporterbugs@gmail.com, sbaugh@janestreet.com, 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: sbaugh@catern.com > Date: Thu, 14 Sep 2023 11:03:44 +0000 (UTC) > Cc: Jim Porter , 65902@debbugs.gnu.org, > sbaugh@janestreet.com > > The issue is not really with the desktop file. It's a generic problem: No, it isn't. If it were, we'd have heard about it much sooner, and not because of the desktop files. What you are doing is representing a rare problem related to a niche feature is if it were a general one, by inventing use cases to justify that. But if those use cases were important, people would have asked for them long ago. They didn't. Why? because --eval already exists. > > What about alternative solutions: use a shell script in the desktop > > files, and delegate to that script to solve the problem with quoting? > > Had anyone considered this strategy? If not, why not? > > Getting the quoting right is hard and complex, and even Emacs developers > have failed at it over multiple iterations, and when they fail it either > breaks or exposes a security vulnerability. Emacs developers make mistakes even in the simple regexps we have in our code. That doesn't mean we should abandon regexps. The solution for sending Lisp forms to the server exists, and the quoting, although tricky in some cases, is not rocket science to get right. I don't see why we would need another mechanism to do something similar with radically different syntax, a separate set of rules and restrictions that need to be documented, etc. etc. > This solution is far simpler That's an illusion. There's nothing simple about it. You are inventing a new mechanism for passing Lisp forms as something other than Lisp. This has got to have issues into which we will bump sooner or later. E.g., assume that two or more of the arguments to the function begins with single quote, as in $ emacsclient --apply func arg1 'foo arg2 'bar Escape-quoting, here we come again! From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 14 10:05:03 2023 Received: (at 65902) by debbugs.gnu.org; 14 Sep 2023 14:05:03 +0000 Received: from localhost ([127.0.0.1]:40684 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgmxr-0007KJ-1Q for submit@debbugs.gnu.org; Thu, 14 Sep 2023 10:05:03 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:58635) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgmxo-0007Jk-3M for 65902@debbugs.gnu.org; Thu, 14 Sep 2023 10:05:01 -0400 From: Spencer Baugh To: Eli Zaretskii Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <83pm2klvw9.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 14 Sep 2023 16:36:06 +0300") References: <83ttrym8jx.fsf@gnu.org> <83led9nay9.fsf@gnu.org> <66a6c09e-3b61-d913-5638-4c804fb826f6@gmail.com> <83edj1mja5.fsf@gnu.org> <87il8dt3sh.fsf@catern.com> <83pm2klvw9.fsf@gnu.org> Date: Thu, 14 Sep 2023 10:04:48 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, sbaugh@catern.com, jporterbugs@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: sbaugh@catern.com >> Date: Thu, 14 Sep 2023 11:03:44 +0000 (UTC) >> Cc: Jim Porter , 65902@debbugs.gnu.org, >> sbaugh@janestreet.com >> >> The issue is not really with the desktop file. It's a generic problem: > > No, it isn't. If it were, we'd have heard about it much sooner, and > not because of the desktop files. > > What you are doing is representing a rare problem related to a niche > feature is if it were a general one, by inventing use cases to justify > that. But if those use cases were important, people would have asked > for them long ago. They didn't. Why? because --eval already exists. No... these are real use cases that I personally have. I have really wanted this for a long time. As I said in my original email, "I expect this to also be useful in other places; the need to escape arbitrary inputs before passing them to emacsclient is frequently annoying." - I've wanted the ability to pass arbitrary data to Emacs through emacsclient since at least 2016, for other reasons: https://lists.gnu.org/archive/html/emacs-devel/2016-06/msg00051.html - The fact that there is currently advice in org-protocol to implement this behavior means there are people who want it. I'm sure the org-protocol authors really wanted to be able to avoid that advice, back when they developed it in 2009. They didn't bother contributing a solution upstream back then, but why stop it from happening now? - It would allow lazy loading of org-protocol as desired by the org devs https://list.orgmode.org/strc07$3o0$1@ciao.gmane.io - I'm working on a package which allows using Emacs to do completing-read over arbitrary strings passed in from the command line, as a replacement for the popular terminal software fzf. Since this is completion over arbitrary strings, I need the ability to get those arbitrary strings into Emacs. - There are numerous examples on the web of users trying and failing to get the quoting right to pass arguments to emacsclient; for example https://www.reddit.com/r/emacs/comments/hhbcg7/emacsclient_eval_with_command_line_arguments/ this would become emacsclient --apply switch-to-buffer https://stackoverflow.com/questions/8848819/emacs-eval-ediff-1-2-how-to-put-this-line-in-to-shell-script this would become emacsclient --apply ediff No shell complexities required in either case. >> > What about alternative solutions: use a shell script in the desktop >> > files, and delegate to that script to solve the problem with quoting? >> > Had anyone considered this strategy? If not, why not? >> >> Getting the quoting right is hard and complex, and even Emacs developers >> have failed at it over multiple iterations, and when they fail it either >> breaks or exposes a security vulnerability. > > Emacs developers make mistakes even in the simple regexps we have in > our code. That doesn't mean we should abandon regexps. The solution > for sending Lisp forms to the server exists, and the quoting, although > tricky in some cases, is not rocket science to get right. I think this (the current contents of emacsclient-mail.desktop): sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u is in fact rocket science, and rocket science that needs to be repeated by every user who wants to pass arbitrary strings to Emacs. And keep in mind this mass of escaping *is currently broken*. > I don't see > why we would need another mechanism to do something similar with > radically different syntax, a separate set of rules and restrictions > that need to be documented, etc. etc. > >> This solution is far simpler > > That's an illusion. There's nothing simple about it. You are > inventing a new mechanism for passing Lisp forms as something other > than Lisp. But I don't want to pass Lisp forms, that's the entire point. I have some arbitrary string which is *not* Lisp, and I want Emacs to *not* parse it as Lisp. > This has got to have issues into which we will bump sooner > or later. E.g., assume that two or more of the arguments to the > function begins with single quote, as in > > $ emacsclient --apply func arg1 'foo arg2 'bar > > Escape-quoting, here we come again! That example works fine with --apply. The call becomes: (func "arg1" "'foo" "arg2" "'bar") which is reliable and expected. Maybe you're referring to how, if you run that command through a shell, the shell interprets the single quotes as creating a string? But that's that's a separate issue, because: - I don't plan to run any of my commands using --apply through a shell (which means they will require zero escaping or quoting whatsoever) - Right now with --eval you have to do escaping for both the shell and Lisp. With --apply you only have to do escaping for the shell, if you do use a shell, and if you don't use a shell you don't have to do anything. I think it is simpler to reduce the amount of quoting and escaping from "both Lisp and shell" to "just shell, and not even that if you don't use a shell". From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 14 10:31:57 2023 Received: (at 65902) by debbugs.gnu.org; 14 Sep 2023 14:31:57 +0000 Received: from localhost ([127.0.0.1]:40763 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgnNs-0002Ep-J2 for submit@debbugs.gnu.org; Thu, 14 Sep 2023 10:31:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47314) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgnNr-0002Ec-2V for 65902@debbugs.gnu.org; Thu, 14 Sep 2023 10:31:56 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qgnNf-0007UI-5o; Thu, 14 Sep 2023 10:31:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=8wOmVQfDiz5idwfBZgJ8AnZOuMBBZUq5xKd+iPNFJ6E=; b=juMt/HHuXlpN jlAytLpntPrVv8FZVFuZr+xhD5xqPMoQqbqs5gIrhguJVL4uhx4bLgfIRRXX8JVewOvDiJF/hut29 HEdD6rPiiWHdTyZwktxDxP0zLBhB3whL1GFsT6S6n6Qk72GgudiuOfNIfTZ98j/aiAHzoEuas465M X7Xbvbne4fLR002mvlA9n4ON0hLLhCF9CfKOTpTOtcsgoe64vWcxc0mytGb9OhZ+HFZ0pDuk2wj44 2kNyOs06xCYgb0G0n9WoL7/GTvQU5+iilEq4cB3FVQb0Qlqb/VfyXtd7xaJraxVl+NwE2dgv0Dat3 8DBztjrkOvvkam6LC0VA9A==; Date: Thu, 14 Sep 2023 17:31:28 +0300 Message-Id: <83o7i4ltbz.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (message from Spencer Baugh on Thu, 14 Sep 2023 10:04:48 -0400) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping References: <83ttrym8jx.fsf@gnu.org> <83led9nay9.fsf@gnu.org> <66a6c09e-3b61-d913-5638-4c804fb826f6@gmail.com> <83edj1mja5.fsf@gnu.org> <87il8dt3sh.fsf@catern.com> <83pm2klvw9.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, sbaugh@catern.com, jporterbugs@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Spencer Baugh > Cc: sbaugh@catern.com, jporterbugs@gmail.com, 65902@debbugs.gnu.org > Date: Thu, 14 Sep 2023 10:04:48 -0400 > > Eli Zaretskii writes: > > > What you are doing is representing a rare problem related to a niche > > feature is if it were a general one, by inventing use cases to justify > > that. But if those use cases were important, people would have asked > > for them long ago. They didn't. Why? because --eval already exists. > > No... these are real use cases that I personally have. I have really > wanted this for a long time. As I said in my original email, "I expect > this to also be useful in other places; the need to escape arbitrary > inputs before passing them to emacsclient is frequently annoying." Maybe it's annoying, but it can be done. And Emacs has the same feature, btw. > > Emacs developers make mistakes even in the simple regexps we have in > > our code. That doesn't mean we should abandon regexps. The solution > > for sending Lisp forms to the server exists, and the quoting, although > > tricky in some cases, is not rocket science to get right. > > I think this (the current contents of emacsclient-mail.desktop): > sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec > emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval > \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u > > is in fact rocket science, and rocket science that needs to be repeated > by every user who wants to pass arbitrary strings to Emacs. We disagree. > And keep in mind this mass of escaping *is currently broken*. Patches to fix it are welcome, although as I said I'd be quite glad to remove these desktop files from our repository. > > That's an illusion. There's nothing simple about it. You are > > inventing a new mechanism for passing Lisp forms as something other > > than Lisp. > > But I don't want to pass Lisp forms, that's the entire point. I have > some arbitrary string which is *not* Lisp, and I want Emacs to *not* > parse it as Lisp. It becomes Lisp when the server executes the request. > > $ emacsclient --apply func arg1 'foo arg2 'bar > > > > Escape-quoting, here we come again! > > That example works fine with --apply. The call becomes: > (func "arg1" "'foo" "arg2" "'bar") > which is reliable and expected. > > Maybe you're referring to how, if you run that command through a shell, > the shell interprets the single quotes as creating a string? Of course, I am! > But that's that's a separate issue, because: > > - I don't plan to run any of my commands using --apply through a shell > (which means they will require zero escaping or quoting whatsoever) This feature, if it will be added, is not just for you, it's for everyone. And emacsclient is a shell command, so invoking it from the shell is both natural and frequently used. > - Right now with --eval you have to do escaping for both the shell and > Lisp. With --apply you only have to do escaping for the shell, if you > do use a shell, and if you don't use a shell you don't have to do > anything. But we do that for Emacs, and do it quite a lot. > I think it is simpler to reduce the amount of quoting and escaping from > "both Lisp and shell" to "just shell, and not even that if you don't use > a shell". At what cost? The cost of adding yet another protocol for passing Lisp forms to the server is just too high for my palate. Bottom line: the escaping issue doesn't seem to me a reason strong enough to justify adding such a new feature. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 14 10:48:31 2023 Received: (at 65902) by debbugs.gnu.org; 14 Sep 2023 14:48:31 +0000 Received: from localhost ([127.0.0.1]:40804 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgndu-0002i5-GI for submit@debbugs.gnu.org; Thu, 14 Sep 2023 10:48:31 -0400 Received: from s.wrqvwxzv.outbound-mail.sendgrid.net ([149.72.154.232]:33586) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgndr-0002gr-9l for 65902@debbugs.gnu.org; Thu, 14 Sep 2023 10:48:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=subject:in-reply-to:from:mime-version:to:cc:content-type: content-transfer-encoding:cc:content-type:from:subject:to; s=s1; bh=khOLX21PrQSiXDPJGZdV3XVAuqEg+H81BuMT2qCRTS8=; b=SB2omD0Uhy8qmsWsuglk0/RpJDFTXY+iJf9sfrrrb8cfvgjL4goYXoGAkrBgEFgJ24Z0 w7CFMwSxvN2WyO7qn2knHtDsOjtyvmktrlTLYeLT3+CvBS/G6OZGoAPd4v4gkn3QTORvcd l1KTHKFdJCLB9N/XW7TzI/eICmEqKg/eYafLr5hK1gpy2PRr7orHQG1gtbVIddLF7BV0Jf TjIY+3myXl0MJbbBFKJjvYpFcUwHXJ7rdr6Z7D7c504IjSanCFqNkwjFMrxtwbJMsVKoGB G5hpdLTl6T/4TPhxgNJuD82HnBXFf0OPSTpoW/sidgG2A1FXqBIONgaYUQffJoCQ== Received: by filterdrecv-7765c6879f-vtjd5 with SMTP id filterdrecv-7765c6879f-vtjd5-1-65031D2E-10 2023-09-14 14:48:14.151752224 +0000 UTC m=+3023580.625499194 Received: from earth.catern.com (unknown) by geopod-ismtpd-35 (SG) with ESMTP id hmXf9ka8T9CS03i1LPfBig Thu, 14 Sep 2023 14:48:14.047 +0000 (UTC) Date: Thu, 14 Sep 2023 14:48:14 +0000 (UTC) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping Message-ID: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> X-Android-Message-ID: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> In-Reply-To: <83o7i4ltbz.fsf@gnu.org> From: Spencer Baugh Importance: Normal X-Priority: 3 X-MSMail-Priority: Normal MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?GW3oCMoYnalRiojMOuLzE6x2H5kORXvlCdz1UwQVRMVT4fbh9ODEfCogOe74cO?= =?us-ascii?Q?rI4e0V+MFZgakz9Re5a6=2FCgsxWnPSdnvztRlkPg?= =?us-ascii?Q?CDG6OSkgPQ2uGpvKgcGrm8zqZF+rSu5im23smQ7?= =?us-ascii?Q?3OVFuZvMtdHTAaYH6zlRBS8tGxXemwFsUTjNBwE?= =?us-ascii?Q?b8QzwfIp3drCXrmQPmSduuQiP=2FyfoUwkZhWLkAe?= =?us-ascii?Q?HP5XNdt6c7Bed=2FK95=2F78m64wG0M1ygoqpBR1T5?= To: Eli Zaretskii X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: base64 X-Spam-Score: 4.3 (++++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: On Sep 14, 2023 10:31, Eli Zaretskii wrote: > From: Spencer Baugh > Cc: sbaugh@catern.com, jporterbugs@gmail.com, 65902@debbugs.gnu.org > Date: Thu, 14 Sep 2023 10:04:48 -0400 > > Eli Zaretskii writes: > > [...] Content analysis details: (4.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [149.72.154.232 listed in wl.mailspike.net] 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] 0.1 MIME_HTML_ONLY BODY: Message only has text/html MIME parts 0.0 HTML_MESSAGE BODY: HTML included in message 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding 1.3 RCVD_IN_VALIDITY_RPBL RBL: Relay in Validity RPBL, https://senderscore.org/blocklistlookup/ [149.72.154.232 listed in bl.score.senderscore.com] 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines 0.6 HTML_MIME_NO_HTML_TAG HTML-only message, but there is no HTML tag 1.0 MALF_HTML_B64 Malformatted base64-encoded HTML content X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, Spencer Baugh , jporterbugs@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 3.3 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: On Sep 14, 2023 10:31, Eli Zaretskii wrote: > From: Spencer Baugh > Cc: sbaugh@catern.com, jporterbugs@gmail.com, 65902@debbugs.gnu.org > Date: Thu, 14 Sep 2023 10:04:48 -0400 > > Eli Zaretskii writes: > > [...] Content analysis details: (3.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [149.72.154.232 listed in wl.mailspike.net] 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] 1.3 RCVD_IN_VALIDITY_RPBL RBL: Relay in Validity RPBL, https://senderscore.org/blocklistlookup/ [149.72.154.232 listed in bl.score.senderscore.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 MIME_HTML_ONLY BODY: Message only has text/html MIME parts 0.0 HTML_MESSAGE BODY: HTML included in message 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines 0.6 HTML_MIME_NO_HTML_TAG HTML-only message, but there is no HTML tag 1.0 MALF_HTML_B64 Malformatted base64-encoded HTML content -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager PGRpdiBkaXI9J2F1dG8nPjxkaXY+PGRpdiBjbGFzcz0iZ21haWxfZXh0cmEiPjxkaXYgY2xhc3M9 ImdtYWlsX3F1b3RlIj5PbiBTZXAgMTQsIDIwMjMgMTA6MzEsIEVsaSBaYXJldHNraWkgJmx0O2Vs aXpAZ251Lm9yZyZndDsgd3JvdGU6PGJyIHR5cGU9ImF0dHJpYnV0aW9uIj48YmxvY2txdW90ZSBj bGFzcz0icXVvdGUiIHN0eWxlPSJtYXJnaW46MCAwIDAgLjhleDtib3JkZXItbGVmdDoxcHggI2Nj YyBzb2xpZDtwYWRkaW5nLWxlZnQ6MWV4Ij48cCBkaXI9Imx0ciI+Jmd0OyBGcm9tOiBTcGVuY2Vy IEJhdWdoICZsdDtzYmF1Z2hAamFuZXN0cmVldC5jb20mZ3Q7Cjxicj4KJmd0OyBDYzogc2JhdWdo QGNhdGVybi5jb20sJm5ic3A7IGpwb3J0ZXJidWdzQGdtYWlsLmNvbSwmbmJzcDsgNjU5MDJAZGVi YnVncy5nbnUub3JnCjxicj4KJmd0OyBEYXRlOiBUaHUsIDE0IFNlcCAyMDIzIDEwOjA0OjQ4IC0w NDAwCjxicj4KJmd0OyAKPGJyPgomZ3Q7IEVsaSBaYXJldHNraWkgJmx0O2VsaXpAZ251Lm9yZyZn dDsgd3JpdGVzOgo8YnI+CiZndDsgCjxicj4KJmd0OyAmZ3Q7IFdoYXQgeW91IGFyZSBkb2luZyBp cyByZXByZXNlbnRpbmcgYSByYXJlIHByb2JsZW0gcmVsYXRlZCB0byBhIG5pY2hlCjxicj4KJmd0 OyAmZ3Q7IGZlYXR1cmUgaXMgaWYgaXQgd2VyZSBhIGdlbmVyYWwgb25lLCBieSBpbnZlbnRpbmcg dXNlIGNhc2VzIHRvIGp1c3RpZnkKPGJyPgomZ3Q7ICZndDsgdGhhdC4mbmJzcDsgQnV0IGlmIHRo b3NlIHVzZSBjYXNlcyB3ZXJlIGltcG9ydGFudCwgcGVvcGxlIHdvdWxkIGhhdmUgYXNrZWQKPGJy PgomZ3Q7ICZndDsgZm9yIHRoZW0gbG9uZyBhZ28uJm5ic3A7IFRoZXkgZGlkbid0LiZuYnNwOyBX aHk/IGJlY2F1c2UgLS1ldmFsIGFscmVhZHkgZXhpc3RzLgo8YnI+CiZndDsgCjxicj4KJmd0OyBO by4uLiB0aGVzZSBhcmUgcmVhbCB1c2UgY2FzZXMgdGhhdCBJIHBlcnNvbmFsbHkgaGF2ZS4mbmJz cDsgSSBoYXZlIHJlYWxseQo8YnI+CiZndDsgd2FudGVkIHRoaXMgZm9yIGEgbG9uZyB0aW1lLiZu YnNwOyBBcyBJIHNhaWQgaW4gbXkgb3JpZ2luYWwgZW1haWwsICJJIGV4cGVjdAo8YnI+CiZndDsg dGhpcyB0byBhbHNvIGJlIHVzZWZ1bCBpbiBvdGhlciBwbGFjZXM7IHRoZSBuZWVkIHRvIGVzY2Fw ZSBhcmJpdHJhcnkKPGJyPgomZ3Q7IGlucHV0cyBiZWZvcmUgcGFzc2luZyB0aGVtIHRvIGVtYWNz Y2xpZW50IGlzIGZyZXF1ZW50bHkgYW5ub3lpbmcuIgo8YnI+Cgo8YnI+Ck1heWJlIGl0J3MgYW5u b3lpbmcsIGJ1dCBpdCBjYW4gYmUgZG9uZS4mbmJzcDsgQW5kIEVtYWNzIGhhcyB0aGUgc2FtZQo8 YnI+CmZlYXR1cmUsIGJ0dy4KPGJyPgoKPGJyPgomZ3Q7ICZndDsgRW1hY3MgZGV2ZWxvcGVycyBt YWtlIG1pc3Rha2VzIGV2ZW4gaW4gdGhlIHNpbXBsZSByZWdleHBzIHdlIGhhdmUgaW4KPGJyPgom Z3Q7ICZndDsgb3VyIGNvZGUuJm5ic3A7IFRoYXQgZG9lc24ndCBtZWFuIHdlIHNob3VsZCBhYmFu ZG9uIHJlZ2V4cHMuJm5ic3A7IFRoZSBzb2x1dGlvbgo8YnI+CiZndDsgJmd0OyBmb3Igc2VuZGlu ZyBMaXNwIGZvcm1zIHRvIHRoZSBzZXJ2ZXIgZXhpc3RzLCBhbmQgdGhlIHF1b3RpbmcsIGFsdGhv dWdoCjxicj4KJmd0OyAmZ3Q7IHRyaWNreSBpbiBzb21lIGNhc2VzLCBpcyBub3Qgcm9ja2V0IHNj aWVuY2UgdG8gZ2V0IHJpZ2h0Lgo8YnI+CiZndDsgCjxicj4KJmd0OyBJIHRoaW5rIHRoaXMgKHRo ZSBjdXJyZW50IGNvbnRlbnRzIG9mIGVtYWNzY2xpZW50LW1haWwuZGVza3RvcCk6Cjxicj4KJmd0 OyBzaCAtYyAidT1cXCQoZWNobyBcXCJcXCQxXFwiIHwgc2VkICdzL1tcXFxcXFwiXS9cXFxcXFxc XCZhbXA7L2cnKTsgZXhlYwo8YnI+CiZndDsgZW1hY3NjbGllbnQgLS1hbHRlcm5hdGUtZWRpdG9y PSAtLWRpc3BsYXk9XFwiXFwkRElTUExBWVxcIiAtLWV2YWwKPGJyPgomZ3Q7IFxcIihtZXNzYWdl LW1haWx0byBcXFxcXFwiXFwkdVxcXFxcXCIpXFwiIiBzaCAldQo8YnI+CiZndDsgCjxicj4KJmd0 OyBpcyBpbiBmYWN0IHJvY2tldCBzY2llbmNlLCBhbmQgcm9ja2V0IHNjaWVuY2UgdGhhdCBuZWVk cyB0byBiZSByZXBlYXRlZAo8YnI+CiZndDsgYnkgZXZlcnkgdXNlciB3aG8gd2FudHMgdG8gcGFz cyBhcmJpdHJhcnkgc3RyaW5ncyB0byBFbWFjcy4KPGJyPgoKPGJyPgpXZSBkaXNhZ3JlZS4KPGJy PgoKPGJyPgoKPGJyPgomZ3Q7IEFuZCBrZWVwIGluIG1pbmQgdGhpcyBtYXNzIG9mIGVzY2FwaW5n ICppcyBjdXJyZW50bHkgYnJva2VuKi4KPGJyPgoKPGJyPgpQYXRjaGVzIHRvIGZpeCBpdCBhcmUg d2VsY29tZSwgYWx0aG91Z2ggYXMgSSBzYWlkIEknZCBiZSBxdWl0ZSBnbGFkIHRvCjxicj4KcmVt b3ZlIHRoZXNlIGRlc2t0b3AgZmlsZXMgZnJvbSBvdXIgcmVwb3NpdG9yeS4KPGJyPgoKPGJyPgom Z3Q7ICZndDsgVGhhdCdzIGFuIGlsbHVzaW9uLiZuYnNwOyBUaGVyZSdzIG5vdGhpbmcgc2ltcGxl IGFib3V0IGl0LiZuYnNwOyBZb3UgYXJlCjxicj4KJmd0OyAmZ3Q7IGludmVudGluZyBhIG5ldyBt ZWNoYW5pc20gZm9yIHBhc3NpbmcgTGlzcCBmb3JtcyBhcyBzb21ldGhpbmcgb3RoZXIKPGJyPgom Z3Q7ICZndDsgdGhhbiBMaXNwLgo8YnI+CiZndDsgCjxicj4KJmd0OyBCdXQgSSBkb24ndCB3YW50 IHRvIHBhc3MgTGlzcCBmb3JtcywgdGhhdCdzIHRoZSBlbnRpcmUgcG9pbnQuJm5ic3A7IEkgaGF2 ZQo8YnI+CiZndDsgc29tZSBhcmJpdHJhcnkgc3RyaW5nIHdoaWNoIGlzICpub3QqIExpc3AsIGFu ZCBJIHdhbnQgRW1hY3MgdG8gKm5vdCoKPGJyPgomZ3Q7IHBhcnNlIGl0IGFzIExpc3AuCjxicj4K Cjxicj4KSXQgYmVjb21lcyBMaXNwIHdoZW4gdGhlIHNlcnZlciBleGVjdXRlcyB0aGUgcmVxdWVz dC4KPGJyPgoKPGJyPgomZ3Q7ICZndDsmbmJzcDsmbmJzcDsgJCBlbWFjc2NsaWVudCAtLWFwcGx5 IGZ1bmMgYXJnMSAnZm9vIGFyZzIgJ2Jhcgo8YnI+CiZndDsgJmd0Owo8YnI+CiZndDsgJmd0OyBF c2NhcGUtcXVvdGluZywgaGVyZSB3ZSBjb21lIGFnYWluIQo8YnI+CiZndDsgCjxicj4KJmd0OyBU aGF0IGV4YW1wbGUgd29ya3MgZmluZSB3aXRoIC0tYXBwbHkuJm5ic3A7IFRoZSBjYWxsIGJlY29t ZXM6Cjxicj4KJmd0OyAoZnVuYyAiYXJnMSIgIidmb28iICJhcmcyIiAiJ2JhciIpCjxicj4KJmd0 OyB3aGljaCBpcyByZWxpYWJsZSBhbmQgZXhwZWN0ZWQuCjxicj4KJmd0OyAKPGJyPgomZ3Q7IE1h eWJlIHlvdSdyZSByZWZlcnJpbmcgdG8gaG93LCBpZiB5b3UgcnVuIHRoYXQgY29tbWFuZCB0aHJv dWdoIGEgc2hlbGwsCjxicj4KJmd0OyB0aGUgc2hlbGwgaW50ZXJwcmV0cyB0aGUgc2luZ2xlIHF1 b3RlcyBhcyBjcmVhdGluZyBhIHN0cmluZz8KPGJyPgoKPGJyPgpPZiBjb3Vyc2UsIEkgYW0hCjxi cj4KCjxicj4KJmd0OyBCdXQgdGhhdCdzIHRoYXQncyBhIHNlcGFyYXRlIGlzc3VlLCBiZWNhdXNl Ogo8YnI+CiZndDsgCjxicj4KJmd0OyAtIEkgZG9uJ3QgcGxhbiB0byBydW4gYW55IG9mIG15IGNv bW1hbmRzIHVzaW5nIC0tYXBwbHkgdGhyb3VnaCBhIHNoZWxsCjxicj4KJmd0OyZuYnNwOyZuYnNw OyAod2hpY2ggbWVhbnMgdGhleSB3aWxsIHJlcXVpcmUgemVybyBlc2NhcGluZyBvciBxdW90aW5n IHdoYXRzb2V2ZXIpCjxicj4KCjxicj4KVGhpcyBmZWF0dXJlLCBpZiBpdCB3aWxsIGJlIGFkZGVk LCBpcyBub3QganVzdCBmb3IgeW91LCBpdCdzIGZvcgo8YnI+CmV2ZXJ5b25lLiZuYnNwOyBBbmQg ZW1hY3NjbGllbnQgaXMgYSBzaGVsbCBjb21tYW5kLCBzbyBpbnZva2luZyBpdCBmcm9tIHRoZQo8 YnI+CnNoZWxsIGlzIGJvdGggbmF0dXJhbCBhbmQgZnJlcXVlbnRseSB1c2VkLgo8YnI+Cgo8YnI+ CiZndDsgLSBSaWdodCBub3cgd2l0aCAtLWV2YWwgeW91IGhhdmUgdG8gZG8gZXNjYXBpbmcgZm9y IGJvdGggdGhlIHNoZWxsIGFuZAo8YnI+CiZndDsmbmJzcDsmbmJzcDsgTGlzcC4mbmJzcDsgV2l0 aCAtLWFwcGx5IHlvdSBvbmx5IGhhdmUgdG8gZG8gZXNjYXBpbmcgZm9yIHRoZSBzaGVsbCwgaWYg eW91Cjxicj4KJmd0OyZuYnNwOyZuYnNwOyBkbyB1c2UgYSBzaGVsbCwgYW5kIGlmIHlvdSBkb24n dCB1c2UgYSBzaGVsbCB5b3UgZG9uJ3QgaGF2ZSB0byBkbwo8YnI+CiZndDsmbmJzcDsmbmJzcDsg YW55dGhpbmcuCjxicj4KCjxicj4KQnV0IHdlIGRvIHRoYXQgZm9yIEVtYWNzLCBhbmQgZG8gaXQg cXVpdGUgYSBsb3QuCjxicj4KCjxicj4KJmd0OyBJIHRoaW5rIGl0IGlzIHNpbXBsZXIgdG8gcmVk dWNlIHRoZSBhbW91bnQgb2YgcXVvdGluZyBhbmQgZXNjYXBpbmcgZnJvbQo8YnI+CiZndDsgImJv dGggTGlzcCBhbmQgc2hlbGwiIHRvICJqdXN0IHNoZWxsLCBhbmQgbm90IGV2ZW4gdGhhdCBpZiB5 b3UgZG9uJ3QgdXNlCjxicj4KJmd0OyBhIHNoZWxsIi4KPGJyPgoKPGJyPgpBdCB3aGF0IGNvc3Q/ Jm5ic3A7IFRoZSBjb3N0IG9mIGFkZGluZyB5ZXQgYW5vdGhlciBwcm90b2NvbCBmb3IgcGFzc2lu Zwo8YnI+Ckxpc3AgZm9ybXMgdG8gdGhlIHNlcnZlciBpcyBqdXN0IHRvbyBoaWdoIGZvciBteSBw YWxhdGUuPGJyPjwvcD48L2Jsb2NrcXVvdGU+PC9kaXY+PC9kaXY+PC9kaXY+PGRpdiBkaXI9ImF1 dG8iPk9rYXksIGlmIEkgZG8gdGhpcyB3aXRob3V0IG1ha2luZyBtb2RpZmljYXRpb25zIHRvIGVt YWNzY2xpZW50LmMgb3IgdGhlIHNlcnZlciBwcm90b2NvbCwgd291bGQgdGhhdCBiZSBtb3JlIGFj Y2VwdGFibGU/IFRoZSBhcHByb2FjaCBJIGRlc2NyaWJlZCBpbiBhbm90aGVyIGVtYWlsLCB3aXRo IHNlcnZlci1ldmFsLWFyZ3MtbGVmdCwgYWxsIGl0IGFkZHMgaXMgYSBuZXcgdmFyaWFibGUuPC9k aXY+PGRpdiBkaXI9ImF1dG8iPjxkaXYgY2xhc3M9ImdtYWlsX2V4dHJhIj48ZGl2IGNsYXNzPSJn bWFpbF9xdW90ZSI+PGJsb2NrcXVvdGUgY2xhc3M9InF1b3RlIiBzdHlsZT0ibWFyZ2luOjAgMCAw IC44ZXg7Ym9yZGVyLWxlZnQ6MXB4ICNjY2Mgc29saWQ7cGFkZGluZy1sZWZ0OjFleCI+PHAgZGly PSJsdHIiPgo8L3A+CjwvYmxvY2txdW90ZT48L2Rpdj48YnI+PC9kaXY+PC9kaXY+PC9kaXY+ From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 14 10:58:17 2023 Received: (at 65902) by debbugs.gnu.org; 14 Sep 2023 14:58:17 +0000 Received: from localhost ([127.0.0.1]:40853 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgnnN-00031B-11 for submit@debbugs.gnu.org; Thu, 14 Sep 2023 10:58:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59884) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgnnL-00030w-Hv for 65902@debbugs.gnu.org; Thu, 14 Sep 2023 10:58:16 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qgnnA-0004ZC-25; Thu, 14 Sep 2023 10:58:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Wc20DFnnCU4rTRQ366Z7A0qrDFE37wEa1IHFpXN5E1E=; b=mujmOzUM2ZWh qa5HwlJRzDvCGbdqYSk12NTDLvu/2g5oMttIiDZWXT3IJoUn5UNshUY39twUR+qO3cMF813XVRjv5 vl9LabWzJEAXDX2tTQGG+LdzowUbwX4zD70vNtJkWrk2PWJmxf7J7k01wAJKo+vpIS4vrVX+w7jVe aRPcpDbTwVEpYHh1JCWcEcAZRaFLUAm9sYM7d5K0yOeTd6F1aaXNLn2h1UVin61XVQ3w8EDMB/cRU WOE7woo3pvcpKHBno/Tt5Y+wzd9saTeMC77iL3UhIpJo2STDhxZDMQq6Hw00bhTMeJKp3LmX9fjwN 4G++Zqs35FBpjORpoPjoVg==; Date: Thu, 14 Sep 2023 17:57:52 +0300 Message-Id: <83led8ls3z.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> (message from Spencer Baugh on Thu, 14 Sep 2023 14:48:14 +0000 (UTC)) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, sbaugh@janestreet.com, jporterbugs@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Thu, 14 Sep 2023 14:48:14 +0000 (UTC) > From: Spencer Baugh > Cc: Spencer Baugh , jporterbugs@gmail.com, > 65902@debbugs.gnu.org > > Okay, if I do this without making modifications to emacsclient.c or the server protocol, would that be > more acceptable? The approach I described in another email, with server-eval-args-left, all it adds is > a new variable. I cannot find the description of that approach. What did it say? From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 14 11:11:04 2023 Received: (at 65902) by debbugs.gnu.org; 14 Sep 2023 15:11:04 +0000 Received: from localhost ([127.0.0.1]:40895 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgnzg-00065G-Ag for submit@debbugs.gnu.org; Thu, 14 Sep 2023 11:11:03 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:53529) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgnzc-00064y-7O for 65902@debbugs.gnu.org; Thu, 14 Sep 2023 11:10:59 -0400 From: Spencer Baugh To: Eli Zaretskii Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <83led8ls3z.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 14 Sep 2023 17:57:52 +0300") References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> Date: Thu, 14 Sep 2023 11:10:44 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 65902 Cc: jporterbugs@gmail.com, Spencer Baugh , 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> Date: Thu, 14 Sep 2023 14:48:14 +0000 (UTC) >> From: Spencer Baugh >> Cc: Spencer Baugh , jporterbugs@gmail.com, >> 65902@debbugs.gnu.org >> >> Okay, if I do this without making modifications to emacsclient.c or the server protocol, would that be >> more acceptable? The approach I described in another email, with server-eval-args-left, all it adds is >> a new variable. > > I cannot find the description of that approach. What did it say? We could make a command-line-args-left equivalent for emacsclient, called server-eval-args-left, which contains the FILE arguments passed to emacsclient as strings. This can be done without making any changes to emacsclient.c or the server protocol. Then the message-mailto use case would look like this: emacsclient --eval '(message-mailto (pop server-eval-args-left))' %u This would match how message-mailto uses (pop command-line-args-left) internally. This would work for all the use-cases I described before; I'd be very happy with this solution (actually, I'm starting to prefer it to --apply). And again, it doesn't change emacsclient.c or the server protocol. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 14 15:16:37 2023 Received: (at 65902) by debbugs.gnu.org; 14 Sep 2023 19:16:37 +0000 Received: from localhost ([127.0.0.1]:41173 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgrpN-0007ip-4n for submit@debbugs.gnu.org; Thu, 14 Sep 2023 15:16:37 -0400 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]:42027) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qgrpH-0007iX-OU for 65902@debbugs.gnu.org; Thu, 14 Sep 2023 15:16:35 -0400 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-68fc292de9dso1035527b3a.0 for <65902@debbugs.gnu.org>; Thu, 14 Sep 2023 12:16:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694718980; x=1695323780; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=cvxqKibU0akGY81InuiZv/JrtdIv8PwPmMMprL50A2o=; b=F5OOM2pAYwOhTIb61lutxBLqSddGkezOIl4F0/zxTag/QJjafsFjt8lf31bY1o1JI+ S4qvRx3iptVaf7MiAqNHzQ5cj/j2LV1pPjjTgQVOpcJIXwpA4WYHlhI9D2BIQGskXfEk StG6EYfoMwfTx+RgoejdRuqAD55TAHos8RwV9ESUdst9T+IKKbJ7IwlT3lOetzPoD2rC lfQjuz+Ja16GypYRSmOVMHtU6h4OZfkmVoGKeVbIBu6afJY7vOhl4Q6WHIIVW8yzAHJw fQkRPnIHpd78waGYsf1Ip112L7BL+3xq/Y8m9l/IcdvNxhSmIb8SiRnQfPabQaN5e7P4 g1Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694718980; x=1695323780; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=cvxqKibU0akGY81InuiZv/JrtdIv8PwPmMMprL50A2o=; b=dkUgLFRkQDbQlVoU+L0mIrwucx6RHv7IGAEBTxy/sBddCA4NuPbtumGLTeH5aJYJBa brpOuKVhjr9oC1CuF7HSjslYyfK5JNdp4hEMNmw3aU59rD4FsflozcGhe64mSvwW1AhA UL+m+WKb8KL2yxqdZNBJaMXwVdZg/eDyqeHeIRRKkV9A3ELy41vov4XoV4jRyzMuegGd SopY4HcAVpNkdTKR/uqTRl6XMHAEMbppvt9J/Ua80D+9XJp7uZilcTrxSXBkYKRNsge/ GhUphtzaBpKkMRpLLy3uMCk8IC/NXtBCz8Y43w8SIQ8uIMgFTN/wK74WLcPWi7kmuvq8 cdyQ== X-Gm-Message-State: AOJu0YytROsroElhpQEOZ5xPCbx2g0HkDtmqHZjDJE2krek1FqKE4EjK H8XtCPhzZobRjKpknRAffkk= X-Google-Smtp-Source: AGHT+IGL1CYAWUyDmyt+Y4a7NYW1vMyP1PaCOa7utBnaCKAN7lR8Z7YNIFrcMDo5omiBTJzEW3GUhQ== X-Received: by 2002:a05:6a00:d9e:b0:68f:c1e0:a2c4 with SMTP id bf30-20020a056a000d9e00b0068fc1e0a2c4mr3397585pfb.3.1694718979760; Thu, 14 Sep 2023 12:16:19 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id k2-20020aa790c2000000b006875df4773fsm1652848pfk.163.2023.09.14.12.16.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Sep 2023 12:16:18 -0700 (PDT) Message-ID: <96efadce-beab-0908-8402-9429ff2bcc31@gmail.com> Date: Thu, 14 Sep 2023 12:16:17 -0700 MIME-Version: 1.0 Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping To: Eli Zaretskii , sbaugh@catern.com References: <83ttrym8jx.fsf@gnu.org> <83led9nay9.fsf@gnu.org> <66a6c09e-3b61-d913-5638-4c804fb826f6@gmail.com> <83edj1mja5.fsf@gnu.org> <87il8dt3sh.fsf@catern.com> <83pm2klvw9.fsf@gnu.org> Content-Language: en-US From: Jim Porter In-Reply-To: <83pm2klvw9.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65902 Cc: sbaugh@janestreet.com, 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 9/14/2023 6:36 AM, Eli Zaretskii wrote: >> From: sbaugh@catern.com >> Date: Thu, 14 Sep 2023 11:03:44 +0000 (UTC) >> Cc: Jim Porter , 65902@debbugs.gnu.org, >> sbaugh@janestreet.com >> >> The issue is not really with the desktop file. It's a generic problem: > > No, it isn't. If it were, we'd have heard about it much sooner, and > not because of the desktop files. This actually *has* come up before, but in Org. "org-protocol.el" tries to solves a similar use case (use emacsclient to open an "org-protocol:" URL, which calls some Org-mode function). The code for this integration is quite complex though, and relies on advising 'server-visit-files' (see the code around 'org--protocol-detect-protocol-server' in lisp/org/org-protocol.el). Overall, the Org solution works, though it's hacky, and hooks into things a bit too late, so Org has to do extra work to clean up the arguments it receives. For example, on MS-Windows[1], instead of seeing the original "org-protocol:/..." string that gets passed to emacsclient, Org sees something like "c:/WINDOWS/system32/org-protocol:/...". Org works around this problem, but it would be nice if there were a way to hook into things earlier before the input arguments had been munged. There have been a few reports/complaints about how this works on the Org list in the past, too. I'm not married to any particular implementation for this problem, but given how this has come up for multiple cases (admittedly both for handling URLs of some form), I think there's value in considering a common way to handle this that's more straightforward than shell scripting or org-protocol's advice hacks. [1] This is also an example of how the problem isn't *just* with desktop files, since MS-Windows doesn't use those; instead, you have to set some registry keys. Otherwise, the problems are pretty similar to desktop files though. From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 15 01:33:59 2023 Received: (at 65902) by debbugs.gnu.org; 15 Sep 2023 05:33:59 +0000 Received: from localhost ([127.0.0.1]:41813 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh1Sp-0003iX-5l for submit@debbugs.gnu.org; Fri, 15 Sep 2023 01:33:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48154) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh1Sm-0003iI-Ds for 65902@debbugs.gnu.org; Fri, 15 Sep 2023 01:33:57 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qh1Sa-0003S1-1b; Fri, 15 Sep 2023 01:33:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=5GRGVNQIYCPFpFJ92oAUkHwsi1P7GY+20JP3I+4Pzes=; b=oXxjSZH4SJZi AiA8H7HeBBLiC3og999w0YAnnSiRPDy74EI57uZezRSNgCsceTfe7P3c8MtJhFyzidZqI0vPvzUk+ anuPtO5qwsZTrQwQEo6HLT1zAsYRVMPb4K2EFkkZ9hbHtc35mP5L7Lv6vQUh5fEaUYSwlL2ZYIJeg rjlvq5FZU5Z01JqCPNF89QwZh6p4IAfMQ0Ltuqp7YeKGcILrW/4z376P+Cqsjg8xKsthhdW56pBl8 apHpwooyeiGIMSNtk+Nj0whbLhiTVm1beJMjm7TuzMA3pflH9vyK7Cjx1BLCQ7bnRSEROAad8M/+4 SERGLRiWkQoRoFGGWVkGRQ==; Date: Fri, 15 Sep 2023 08:33:32 +0300 Message-Id: <83cyykknkj.fsf@gnu.org> From: Eli Zaretskii To: Jim Porter In-Reply-To: <96efadce-beab-0908-8402-9429ff2bcc31@gmail.com> (message from Jim Porter on Thu, 14 Sep 2023 12:16:17 -0700) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping References: <83ttrym8jx.fsf@gnu.org> <83led9nay9.fsf@gnu.org> <66a6c09e-3b61-d913-5638-4c804fb826f6@gmail.com> <83edj1mja5.fsf@gnu.org> <87il8dt3sh.fsf@catern.com> <83pm2klvw9.fsf@gnu.org> <96efadce-beab-0908-8402-9429ff2bcc31@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, sbaugh@catern.com, sbaugh@janestreet.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Thu, 14 Sep 2023 12:16:17 -0700 > Cc: sbaugh@janestreet.com, 65902@debbugs.gnu.org > From: Jim Porter > > [1] This is also an example of how the problem isn't *just* with desktop > files, since MS-Windows doesn't use those; instead, you have to set some > registry keys. Otherwise, the problems are pretty similar to desktop > files though. No, it isn't: on Windows you configure all kinds of desktop shortcuts to invoke Emacs or emacsclient, and those shortcuts allow you to include %x style parameters inside quotes. In addition, there's no need to use the "sh -c COMMAND" style of invoking commands. So most of the quoting issues mentioned here as the main reason for the change don't arise at all. But my problem is not with solving the Windows case, so let's drop this tangent. From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 15 02:29:34 2023 Received: (at 65902) by debbugs.gnu.org; 15 Sep 2023 06:29:34 +0000 Received: from localhost ([127.0.0.1]:41865 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh2Kc-0005EK-8F for submit@debbugs.gnu.org; Fri, 15 Sep 2023 02:29:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37506) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qh2KZ-0005E4-C0 for 65902@debbugs.gnu.org; Fri, 15 Sep 2023 02:29:32 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qh2KN-0003tA-5o; Fri, 15 Sep 2023 02:29:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=qweul88gaDrhRVUwGYDaQeGsPIt+O/KLL1tvTQXL5OE=; b=B+kf4gkoteaR W/CU4mFHO68MCo++yY/bmlwuI6HOtY0h8JIAKsYIHxn1Mj19bU/wXhKTd+RRiENh+6zijEnPuha49 AU54VzKAUGjCvhA1qpA8aLTk+ts7BCso706sJbI8nfXAUPiJCcx9leiYA0/p1fumfLBSEBt8b3HNc EA8d4N/hg5YF5dqC/zhWkK9NSHyZ7Ee02fb4U+w4fUSwf7i3Tdh5ofLVc2wc/ZhkwOo3CN19weIo9 UoLkJ5xbw+MLqP19X4urTfOxpZ5UfU/lvE868zulp0k6c8lEALhjEYP8NH0YiQAC8udO90H8sjtvN 3dROKQnquWedCoBaOlWqeA==; Date: Fri, 15 Sep 2023 09:29:09 +0300 Message-Id: <835y4ckkzu.fsf@gnu.org> From: Eli Zaretskii To: Spencer Baugh In-Reply-To: (message from Spencer Baugh on Thu, 14 Sep 2023 11:10:44 -0400) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902 Cc: jporterbugs@gmail.com, sbaugh@catern.com, 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Spencer Baugh > Cc: Spencer Baugh , 65902@debbugs.gnu.org, > jporterbugs@gmail.com > Date: Thu, 14 Sep 2023 11:10:44 -0400 > > We could make a command-line-args-left equivalent for emacsclient, > called server-eval-args-left, which contains the FILE arguments passed > to emacsclient as strings. This can be done without making any changes > to emacsclient.c or the server protocol. Then the message-mailto > use case would look like this: > > emacsclient --eval '(message-mailto (pop server-eval-args-left))' %u > > This would match how message-mailto uses (pop command-line-args-left) > internally. > > This would work for all the use-cases I described before; I'd be very > happy with this solution (actually, I'm starting to prefer it to > --apply). And again, it doesn't change emacsclient.c or the server > protocol. This could perhaps be acceptable (although it's still rather kludgey, IMO), but are you sure you understand all the consequences? Currently, when emacsclient is invoked like this: $ emacsclient --eval '(func args)' foo bar we send to the server the following commands: -eval (func args) -eval foo -eval bar IOW, every command-line argument after --eval is treated as being implicitly preceded with --eval. With your proposal, how will the server know that some of "-eval foo" commands should cause foo to be added to server-eval-args-left instead of being evaluated as it does now? From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 16 09:30:54 2023 Received: (at 65902) by debbugs.gnu.org; 16 Sep 2023 13:30:55 +0000 Received: from localhost ([127.0.0.1]:45662 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhVNu-0002yM-6W for submit@debbugs.gnu.org; Sat, 16 Sep 2023 09:30:54 -0400 Received: from thaodan.de ([2a03:4000:4f:f15::1]:41908) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhVNk-0002y4-KZ for 65902@debbugs.gnu.org; Sat, 16 Sep 2023 09:30:52 -0400 Received: from odin (dsl-trebng12-50dc77-87.dhcp.inet.fi [80.220.119.87]) by thaodan.de (Postfix) with ESMTPSA id 924A6D08DB9; Sat, 16 Sep 2023 16:30:34 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thaodan.de; s=mail; t=1694871034; bh=OMr2DkBKoklb0rf8O5r+s+Fo9YHmQNn93VgOV0UVCQQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=iACtfqENAQX5ulmwQsPzaEc6nXdfylJz5NmyL6Dvf9brBxfE/1Jx1dOZAVLS4ufBK tJBBRaar09M3pVU/raaQNzIBkAfqEPRhmX9qWR6tIIpf4q1J5lLKIGeoaC1OBVm0EX apkhFh+GD7AZzP++NXzagRGBst6O58LCKDs9a5xIPKaUG+7J9P5I1ngdkm872jzHo6 yPxnMsnqCtFMFtpUeExVwLfoLLAfz16NClhYSB3P++c299nm2Zx0jhXjLKhjYXb8sb 812ZgjmLNo/UrD608m+z2UGijC1qsCMig8e6Z6H9CfGQtzlzDicasG3AAvBgs560f4 9L0/qkurS7Etw/R2DJoyodY95KG4xW8Ft6ueJr3q9DPvgvxGVEEPj6li5P6aJ4BfVW O8ZdnrKGC98bzCRaB4FNoU9sXtURwCSXz3+F+GrdE0h8VPeDLUJAVFhCgrXCnVpJ32 lsBLkufWDef9IH/13oJx1am+lL+ms6wAyFfDTx0XXkODfNP9jsiCdek3EOu30m1uFy qXAU/0myPkYf+s3BkseY+R2Myk8UdRsXFVHpxnSETth1tBxoDK6mshdXAUsFcWifaV IN9qGoBlCdA52all88idf12ykOCu9WtcAVrk79w/MVsmlryjFyMZWXlJt2p9tVRkmJ Peuj07kbW5Ev9jecydPtbels= From: =?utf-8?Q?Bj=C3=B6rn?= Bidar To: Eli Zaretskii Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <837counr08.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 13 Sep 2023 16:26:31 +0300") References: <871qf2vmi4.fsf@catern.com> <87v8ceu7o0.fsf@catern.com> <83fs3int3t.fsf@gnu.org> <87msxqtef4.fsf@catern.com> <837counr08.fsf@gnu.org> Autocrypt: addr=bjorn.bidar@thaodan.de; prefer-encrypt=nopreference; keydata= mDMEZNfpPhYJKwYBBAHaRw8BAQdACBEmr+0xwIIHZfIDlZmm7sa+lHHSb0g9FZrN6qE6ru60JUJq w7ZybiBCaWRhciA8Ympvcm4uYmlkYXJAdGhhb2Rhbi5kZT6IlgQTFgoAPgIbAwULCQgHAgIiAgYV CgkICwIEFgIDAQIeBwIXgBYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1/YmAhkBAAoJEFwbdKFl HF9oB9cBAJoIIGQKXm4cpap+Flxc/EGnYl0123lcEyzuduqvlDT0AQC3OlFKm/OiqJ8IMTrzJRZ8 phFssTkSrrFXnM2jm5PYDoiTBBMWCgA7FiEEUfF263VHMB6nKairXBt0oWUcX2gFAmTX6T4CGwMF CwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQXBt0oWUcX2hbCQEAtru7kvM8hi8zo6z9ux2h K+B5xViKuo7Z8K3IXuK5ugwA+wUfKzomzdBPhfxDsqLcEziGRxoyx0Q3ld9aermBUccHtBxCasO2 cm4gQmlkYXIgPG1lQHRoYW9kYW4uZGU+iJMEExYKADsCGwMFCwkIBwICIgIGFQoJCAsCBBYCAwEC HgcCF4AWIQRR8XbrdUcwHqcpqKtcG3ShZRxfaAUCZNf2FQAKCRBcG3ShZRxfaCzSAP4hZ7cSp0YN XYpcjHdsySh2MuBhhoPeLGXs+2kSiqBiOwD/TP8AgPEg/R+SI9GI9on7fBJJ0mp2IT8kZ2rhDOjg gA6IkwQTFgoAOxYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1+ntAhsDBQsJCAcCAiICBhUKCQgL AgQWAgMBAh4HAheAAAoJEFwbdKFlHF9oBgwA/iQHwe0VL4Df4GGTYlNjMSHFlIkBmN4UfYGLYj3E TrOUAQC51M+M3cjsL8WHdpBz6VAo6df9d+rVwhQ9vQuFHqevArg4BGTX6T4SCisGAQQBl1UBBQEB B0Cbohc3JEfn005/cm0AOGjSsW1ZxAkgaoVNjbpqk4MgNAMBCAeIeAQYFgoAIBYhBFHxdut1RzAe pymoq1wbdKFlHF9oBQJk1+k+AhsMAAoJEFwbdKFlHF9ooHABAKGmrGBic/Vys3BBrOQiRB3Z7izO HwhqTRpAqFZtXS2nAQDZhp/5aYw1TZjTzkm1KVt9QiYnjd/MvxRE9iaY6x4mDbgzBGTX6T4WCSsG AQQB2kcPAQEHQAgRJq/tMcCCB2XyA5WZpu7GvpRx0m9IPRWazeqhOq7uiO8EGBYKACAWIQRR8Xbr dUcwHqcpqKtcG3ShZRxfaAUCZNf71AIbIgCBCRBcG3ShZRxfaHYgBBkWCgAdFiEEUfF263VHMB6n KairXBt0oWUcX2gFAmTX+9QACgkQXBt0oWUcX2jeSwD6AtWn0cuo8IF35YRo4o3cDRJnUfJnbvJy GxyCDThR+zYBAKG6/jdwmZkBQZKslnDAbMMd2WfiZZT5JW3IWC4EaKMO7HkBAKYPGZ3UbfkRvfFK S+pQ9CgtNfkSJQBtT1Ob7Y6nsacgAQCpyXN7yppmhW/oBgivITPy9Lkg+V4NK9WZYZCU9Q7LBA== Date: Sat, 16 Sep 2023 16:30:33 +0300 Message-ID: <87led6p7nq.fsf@thaodan.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 65902 Cc: sbaugh@catern.com, 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: sbaugh@catern.com >> Date: Wed, 13 Sep 2023 13:01:52 +0000 (UTC) >> Cc: 65902@debbugs.gnu.org >> >> Eli Zaretskii writes: >> >> > Is quoting the only issue with --eval? If so, why not have a variant >> > of --eval that quotes the argument by itself, like you do in the >> > patch, i.e. by using quote_argument, instead of inventing yet another >> > weird option with its own small DSL and extra-special rules of how to >> > write the command line with it? >> >> I am not sure what you're suggesting. Can you show how the equivalent >> of: >> >> emacsclient --apply message-mailto -- %u >> >> would work with that design? > > emacsclient --qeval '(message-mailto %u)' > Try desktop-file-validate. ' is a reserved character. I have a desktop file for a similar use case, I validated that desktop file using desktop-file-validate and got the following output: emacs-gnus.desktop: error: value "emacsclient --create-frame --eval '(gnus)'" for key "Exec" in group "Desktop Entry" contains a reserved character ''' outside of a quote From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 16 09:43:32 2023 Received: (at 65902) by debbugs.gnu.org; 16 Sep 2023 13:43:32 +0000 Received: from localhost ([127.0.0.1]:45691 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhVa7-0003HU-OV for submit@debbugs.gnu.org; Sat, 16 Sep 2023 09:43:32 -0400 Received: from thaodan.de ([2a03:4000:4f:f15::1]:49304) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhVa4-0003HL-UQ for 65902@debbugs.gnu.org; Sat, 16 Sep 2023 09:43:30 -0400 Received: from odin (dsl-trebng12-50dc77-87.dhcp.inet.fi [80.220.119.87]) by thaodan.de (Postfix) with ESMTPSA id E6C0ED08DB9; Sat, 16 Sep 2023 16:43:20 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thaodan.de; s=mail; t=1694871801; bh=lXkdE3c2A4nPK1b83I8UlBQscsqw6QDfGQDMgpAshco=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=sL1mk77Pbxc0txgtnoYH87Fs0iObWrTb8UePIQrM52QOHa2kZfb4HmDoFZzYrPkBX PWblrQx0Jls4jL988cN5uwzg+kp1lc4GmbaExVnvnFOZ8l15slnksiQ+kX6NQqKAQw RVzQOsQRGFmBOi1UZrF5EiwIIvukUBrCf1yiwEP116M4DNJkyw17glxdAndMA+LRsM u7dZC0DDn3JbqlwLBJdAANmk5DaRhHPCujTxy2F55dXkk2TzdaJzBtuBTAKWwEHT1s DiXo1XEh+vocTkobSAuy54coZsS9v2+Pami3PMyCR3wSsqc5AZODxgOCGJnHUO39op 7Vp/D3Oljwjod6BlZa7GetB+EIFqOSEbCOFdnjwxhS1/+Q9mBZeok+IwocHy2FP7vR MtI9hc0Nr1d0ogV6rls2ZuGz6wn2WFbhYHD9QLeiLCwcXn0ZE+eRI46ZcDc7OAUINr yDQnWfXNH9eL4qOhV7ldzofRLJEVdqNHyYbt4wCBu5I0wuT7UvZkBPj2L00Pzhc5VJ qZGuzUIKctGHjNguq600g59mhv0Yob6hT3kl6tHAWQSS1rBYbk+iGODXc3fFbcpHFv GgU4vIz/XUIxNHP3e3aVM/8RE7NFdE8mIYSqcoBrOPY6kwYr5RbKjQFnw5Qbnk6Cf5 wgyW1CtKhTRV05N1UGuokuoQ= From: =?utf-8?Q?Bj=C3=B6rn?= Bidar To: Eli Zaretskii Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <83edj1mja5.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 14 Sep 2023 08:10:58 +0300") References: <83ttrym8jx.fsf@gnu.org> <83led9nay9.fsf@gnu.org> <66a6c09e-3b61-d913-5638-4c804fb826f6@gmail.com> <83edj1mja5.fsf@gnu.org> Autocrypt: addr=bjorn.bidar@thaodan.de; prefer-encrypt=nopreference; keydata= mDMEZNfpPhYJKwYBBAHaRw8BAQdACBEmr+0xwIIHZfIDlZmm7sa+lHHSb0g9FZrN6qE6ru60JUJq w7ZybiBCaWRhciA8Ympvcm4uYmlkYXJAdGhhb2Rhbi5kZT6IlgQTFgoAPgIbAwULCQgHAgIiAgYV CgkICwIEFgIDAQIeBwIXgBYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1/YmAhkBAAoJEFwbdKFl HF9oB9cBAJoIIGQKXm4cpap+Flxc/EGnYl0123lcEyzuduqvlDT0AQC3OlFKm/OiqJ8IMTrzJRZ8 phFssTkSrrFXnM2jm5PYDoiTBBMWCgA7FiEEUfF263VHMB6nKairXBt0oWUcX2gFAmTX6T4CGwMF CwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQXBt0oWUcX2hbCQEAtru7kvM8hi8zo6z9ux2h K+B5xViKuo7Z8K3IXuK5ugwA+wUfKzomzdBPhfxDsqLcEziGRxoyx0Q3ld9aermBUccHtBxCasO2 cm4gQmlkYXIgPG1lQHRoYW9kYW4uZGU+iJMEExYKADsCGwMFCwkIBwICIgIGFQoJCAsCBBYCAwEC HgcCF4AWIQRR8XbrdUcwHqcpqKtcG3ShZRxfaAUCZNf2FQAKCRBcG3ShZRxfaCzSAP4hZ7cSp0YN XYpcjHdsySh2MuBhhoPeLGXs+2kSiqBiOwD/TP8AgPEg/R+SI9GI9on7fBJJ0mp2IT8kZ2rhDOjg gA6IkwQTFgoAOxYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1+ntAhsDBQsJCAcCAiICBhUKCQgL AgQWAgMBAh4HAheAAAoJEFwbdKFlHF9oBgwA/iQHwe0VL4Df4GGTYlNjMSHFlIkBmN4UfYGLYj3E TrOUAQC51M+M3cjsL8WHdpBz6VAo6df9d+rVwhQ9vQuFHqevArg4BGTX6T4SCisGAQQBl1UBBQEB B0Cbohc3JEfn005/cm0AOGjSsW1ZxAkgaoVNjbpqk4MgNAMBCAeIeAQYFgoAIBYhBFHxdut1RzAe pymoq1wbdKFlHF9oBQJk1+k+AhsMAAoJEFwbdKFlHF9ooHABAKGmrGBic/Vys3BBrOQiRB3Z7izO HwhqTRpAqFZtXS2nAQDZhp/5aYw1TZjTzkm1KVt9QiYnjd/MvxRE9iaY6x4mDbgzBGTX6T4WCSsG AQQB2kcPAQEHQAgRJq/tMcCCB2XyA5WZpu7GvpRx0m9IPRWazeqhOq7uiO8EGBYKACAWIQRR8Xbr dUcwHqcpqKtcG3ShZRxfaAUCZNf71AIbIgCBCRBcG3ShZRxfaHYgBBkWCgAdFiEEUfF263VHMB6n KairXBt0oWUcX2gFAmTX+9QACgkQXBt0oWUcX2jeSwD6AtWn0cuo8IF35YRo4o3cDRJnUfJnbvJy GxyCDThR+zYBAKG6/jdwmZkBQZKslnDAbMMd2WfiZZT5JW3IWC4EaKMO7HkBAKYPGZ3UbfkRvfFK S+pQ9CgtNfkSJQBtT1Ob7Y6nsacgAQCpyXN7yppmhW/oBgivITPy9Lkg+V4NK9WZYZCU9Q7LBA== Date: Sat, 16 Sep 2023 16:43:20 +0300 Message-ID: <87ediyp72f.fsf@thaodan.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 65902 Cc: Jim Porter , sbaugh@catern.com, sbaugh@janestreet.com, 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> Date: Wed, 13 Sep 2023 12:33:01 -0700 >> Cc: sbaugh@catern.com, 65902@debbugs.gnu.org >> From: Jim Porter >> >> On 9/13/2023 12:13 PM, Eli Zaretskii wrote: >> > And I don't understand why we need to add any options to Emacs itself, >> > btw. The suggestion to have some "symmetry" here was one of the >> > reasons that discussion got nowhere. So let's learn from that >> > mistake, at least. >> >> There's a practical benefit to this. If you have $EDITOR set in your >> environment to something like "emacsclient --alternate-editor=emacs", >> then it would be nice if you could say this: >> >> $EDITOR --apply some-func arg1 arg2 >> >> and have it do the same thing whether or not there was already an Emacs >> server running. The symmetry between the two commands (plus proper >> argument forwarding) would make that work. >> >> However, if people can't agree, then we could probably drop that part. >> To me, it sounds like people *do* agree that this would be good to have >> though. > > People might agree, but I don't. Please consider the perspective. > This started as an obscure and rare problem in a desktop file (which > we provided solely out of good will, since it really isn't our job to > do so, it's the job of downstream distros). Programs ship their own desktop files. It is not the job of the downstream to provide desktop files unless it is because of a patch from said downstream. In any case it doesn't make sense for each downstream to ship their own desktop file and fix their own. >From my pov letting Emacs do all work in passing arguments is the best solution as escaping is error prone. I haven't seen any program besides Emacs using escaped shell syntax to pass the escaped syntax of their target language. Most just have options to pass the target file or deal with the dbus activation/interface. From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 16 10:03:14 2023 Received: (at 65902) by debbugs.gnu.org; 16 Sep 2023 14:03:14 +0000 Received: from localhost ([127.0.0.1]:48196 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhVtB-0004Xf-MR for submit@debbugs.gnu.org; Sat, 16 Sep 2023 10:03:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54510) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhVt7-0004XO-Kd for 65902@debbugs.gnu.org; Sat, 16 Sep 2023 10:03:12 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhVsu-0004iQ-Db; Sat, 16 Sep 2023 10:02:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=LvhnABGrpDS4HLqIHK+E8hXKseIipd/f/Dm1pWIO0r8=; b=G7QKV0JqQQ8Wcdmnk10q Kk8CuVsR6lekflUbK3Z8MAKyutIg81MFmJFKwb3oK75dgwbqawd3kvW7cBgmP6zzAg5GiqoHSmDZF MKJIq4zDYyQt5XYxJR0bsFCoMzmhiPQNdJEd5wuKrWAkCUxg0M/oKOG9X3L0mbViPwNCYDTNWxP5P q1MXsz7+0Um/xRxrrM7Ibafw8gH1Fb/3BVJXlhU2eyDwnEPTNR0ZS2ABXA8IG2iaTs/bimR1m3da8 d26ZI/BANAxjSfvOOXMDXH/XbFSp93U19c8DUSzOtcxMGeJ/iGNevagi0fmGtTaj5Z+1jgjeH/jTF ELGhr1g9KaW+fw==; Date: Sat, 16 Sep 2023 17:02:50 +0300 Message-Id: <83zg1mgqr9.fsf@gnu.org> From: Eli Zaretskii To: =?utf-8?Q?Bj=C3=B6rn?= Bidar In-Reply-To: <87ediyp72f.fsf@thaodan.de> (message from =?utf-8?Q?Bj=C3=B6r?= =?utf-8?Q?n?= Bidar on Sat, 16 Sep 2023 16:43:20 +0300) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping References: <83ttrym8jx.fsf@gnu.org> <83led9nay9.fsf@gnu.org> <66a6c09e-3b61-d913-5638-4c804fb826f6@gmail.com> <83edj1mja5.fsf@gnu.org> <87ediyp72f.fsf@thaodan.de> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902 Cc: jporterbugs@gmail.com, sbaugh@catern.com, sbaugh@janestreet.com, 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Björn Bidar > Cc: Jim Porter , 65902@debbugs.gnu.org, > sbaugh@janestreet.com, sbaugh@catern.com > Date: Sat, 16 Sep 2023 16:43:20 +0300 > > Eli Zaretskii writes: > > > People might agree, but I don't. Please consider the perspective. > > This started as an obscure and rare problem in a desktop file (which > > we provided solely out of good will, since it really isn't our job to > > do so, it's the job of downstream distros). > > Programs ship their own desktop files. Programs are shipped by distros. Emacs as a project does not ship anything, we just release the sources in a form that makes building Emacs easy. Our source tarballs cannot be installed, so they are not a finished, ready-to-use product. Distros, by contrast, do ship programs ready to be used. > It is not the job of the downstream to provide desktop files unless > it is because of a patch from said downstream. > > In any case it doesn't make sense for each downstream to ship their own > desktop file and fix their own. I disagree. Desktop files are specific to the target OS, but Emacs as the project does not target any specific OS (although there are OSes that we treat more favorably when considering features). The know-how about what exactly is needed for the desktop integration is also something that the distros have and we don't, except by chance. Each distro targets a single OS, and so it is reasonable to expect them to arrange for the necessary desktop integration. For example, no one would expect us to provide desktop shortcuts for MS-Windows, except as a sign of good will and when we have the necessary expertise on board. > >From my pov letting Emacs do all work in passing arguments is the best > solution as escaping is error prone. I haven't seen any program besides > Emacs using escaped shell syntax to pass the escaped syntax of their > target language. Most just have options to pass the target file or deal > with the dbus activation/interface. We don't require any escapes except those needed by Lisp. Note that in this case, at least some of the escapes are because the desktop shortcut invokes emacsclient via "sh -c "COMMAND STRING", something that should be considered an Emacs problem or a problem we must solve. From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 16 11:54:37 2023 Received: (at 65902) by debbugs.gnu.org; 16 Sep 2023 15:54:37 +0000 Received: from localhost ([127.0.0.1]:48347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhXcz-00027h-5Q for submit@debbugs.gnu.org; Sat, 16 Sep 2023 11:54:37 -0400 Received: from thaodan.de ([2a03:4000:4f:f15::1]:37828) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhXcu-00027V-W1 for 65902@debbugs.gnu.org; Sat, 16 Sep 2023 11:54:35 -0400 Received: from odin (dsl-trebng12-50dc77-87.dhcp.inet.fi [80.220.119.87]) by thaodan.de (Postfix) with ESMTPSA id 12427D08DB9; Sat, 16 Sep 2023 18:54:24 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thaodan.de; s=mail; t=1694879664; bh=LH0m+uId9ERa6zUnmHb//Nc5A5YUShlKp3MGd11ycE0=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=gdylTTXJbBwE8FHlWYAbS1C/EqWwbd93lg6wX5VdGUcyXykvhz1bkeuh4nUGemOKU aZQYJTWtaQ8q5xHPUswWJkvMcpZgNK7ojYkZ4Q0/IxpyeZbVE+fdj+J/f8mN8t3h7i nG8h2K9IEWhqw8piHRfiG9lXGKaHtzRdKOCHo6vCcyHPY7f8tzZrDUg0vfsajXck/j JniV72D4ZCBv88+uFxIM8AuEON/fTRNiQJ79Y6QLNZ/h+XNfydJP0PfPMF/THCWHW2 b7KHrgoS4jj7U+gZBBufa7ugxrInXhdm019RtETqHNTiAC1oW6EkqChEgmmElZjqtC 08Rvs7hk+6T+ox2EHJs1ATZkeS5sbTVcO/Hai6ycyUsrWlzwIaBZFdFQE5r37ptpE7 s5BVJwWsK+LKnqwfb2MjwyDiVXl18RjsXQxxss9ef8PH8rnv+DPB/refrAsaBRNl4X 6cb21EqWBz9xm2o/vQLwvxXG2onESQD94radI0lNfikt2xPYcedbz+eYQWWm0DGVT1 Rylqlj/an4D/jz5juKR+k5Jkm+ppmv4CEuWL6gn397yhPKyAOX9bYq8f7eXRmPKD2D /9gE69MbQpbM/lkQEPb60NHPFF0gnCwX2FhB1N2KrN2UlzqHVt6TmMKPcyo5HRcQl0 fSAOzEhv9iyUKNOyLujsbd5A= From: =?utf-8?Q?Bj=C3=B6rn?= Bidar To: Eli Zaretskii Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <83zg1mgqr9.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 16 Sep 2023 17:02:50 +0300") References: <83ttrym8jx.fsf@gnu.org> <83led9nay9.fsf@gnu.org> <66a6c09e-3b61-d913-5638-4c804fb826f6@gmail.com> <83edj1mja5.fsf@gnu.org> <87ediyp72f.fsf@thaodan.de> <83zg1mgqr9.fsf@gnu.org> Autocrypt: addr=bjorn.bidar@thaodan.de; prefer-encrypt=nopreference; keydata= mDMEZNfpPhYJKwYBBAHaRw8BAQdACBEmr+0xwIIHZfIDlZmm7sa+lHHSb0g9FZrN6qE6ru60JUJq w7ZybiBCaWRhciA8Ympvcm4uYmlkYXJAdGhhb2Rhbi5kZT6IlgQTFgoAPgIbAwULCQgHAgIiAgYV CgkICwIEFgIDAQIeBwIXgBYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1/YmAhkBAAoJEFwbdKFl HF9oB9cBAJoIIGQKXm4cpap+Flxc/EGnYl0123lcEyzuduqvlDT0AQC3OlFKm/OiqJ8IMTrzJRZ8 phFssTkSrrFXnM2jm5PYDoiTBBMWCgA7FiEEUfF263VHMB6nKairXBt0oWUcX2gFAmTX6T4CGwMF CwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQXBt0oWUcX2hbCQEAtru7kvM8hi8zo6z9ux2h K+B5xViKuo7Z8K3IXuK5ugwA+wUfKzomzdBPhfxDsqLcEziGRxoyx0Q3ld9aermBUccHtBxCasO2 cm4gQmlkYXIgPG1lQHRoYW9kYW4uZGU+iJMEExYKADsCGwMFCwkIBwICIgIGFQoJCAsCBBYCAwEC HgcCF4AWIQRR8XbrdUcwHqcpqKtcG3ShZRxfaAUCZNf2FQAKCRBcG3ShZRxfaCzSAP4hZ7cSp0YN XYpcjHdsySh2MuBhhoPeLGXs+2kSiqBiOwD/TP8AgPEg/R+SI9GI9on7fBJJ0mp2IT8kZ2rhDOjg gA6IkwQTFgoAOxYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1+ntAhsDBQsJCAcCAiICBhUKCQgL AgQWAgMBAh4HAheAAAoJEFwbdKFlHF9oBgwA/iQHwe0VL4Df4GGTYlNjMSHFlIkBmN4UfYGLYj3E TrOUAQC51M+M3cjsL8WHdpBz6VAo6df9d+rVwhQ9vQuFHqevArg4BGTX6T4SCisGAQQBl1UBBQEB B0Cbohc3JEfn005/cm0AOGjSsW1ZxAkgaoVNjbpqk4MgNAMBCAeIeAQYFgoAIBYhBFHxdut1RzAe pymoq1wbdKFlHF9oBQJk1+k+AhsMAAoJEFwbdKFlHF9ooHABAKGmrGBic/Vys3BBrOQiRB3Z7izO HwhqTRpAqFZtXS2nAQDZhp/5aYw1TZjTzkm1KVt9QiYnjd/MvxRE9iaY6x4mDbgzBGTX6T4WCSsG AQQB2kcPAQEHQAgRJq/tMcCCB2XyA5WZpu7GvpRx0m9IPRWazeqhOq7uiO8EGBYKACAWIQRR8Xbr dUcwHqcpqKtcG3ShZRxfaAUCZNf71AIbIgCBCRBcG3ShZRxfaHYgBBkWCgAdFiEEUfF263VHMB6n KairXBt0oWUcX2gFAmTX+9QACgkQXBt0oWUcX2jeSwD6AtWn0cuo8IF35YRo4o3cDRJnUfJnbvJy GxyCDThR+zYBAKG6/jdwmZkBQZKslnDAbMMd2WfiZZT5JW3IWC4EaKMO7HkBAKYPGZ3UbfkRvfFK S+pQ9CgtNfkSJQBtT1Ob7Y6nsacgAQCpyXN7yppmhW/oBgivITPy9Lkg+V4NK9WZYZCU9Q7LBA== Date: Sat, 16 Sep 2023 18:54:23 +0300 Message-ID: <87pm2ijeq8.fsf@thaodan.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, jporterbugs@gmail.com, sbaugh@janestreet.com, sbaugh@catern.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Bj=C3=B6rn Bidar >> Cc: Jim Porter , 65902@debbugs.gnu.org, >> sbaugh@janestreet.com, sbaugh@catern.com >> Date: Sat, 16 Sep 2023 16:43:20 +0300 >>=20 >> Eli Zaretskii writes: >>=20 >> > People might agree, but I don't. Please consider the perspective. >> > This started as an obscure and rare problem in a desktop file (which >> > we provided solely out of good will, since it really isn't our job to >> > do so, it's the job of downstream distros). >>=20 >> Programs ship their own desktop files. > > Programs are shipped by distros. Emacs as a project does not ship > anything, we just release the sources in a form that makes building > Emacs easy. Our source tarballs cannot be installed, so they are not > a finished, ready-to-use product. Distros, by contrast, do ship > programs ready to be used. > Ship source or programs the difference is in semantics. >> It is not the job of the downstream to provide desktop files unless >> it is because of a patch from said downstream. >>=20 >> In any case it doesn't make sense for each downstream to ship their own >> desktop file and fix their own. > > I disagree. Desktop files are specific to the target OS, but Emacs as > the project does not target any specific OS (although there are OSes > that we treat more favorably when considering features). The know-how > about what exactly is needed for the desktop integration is also > something that the distros have and we don't, except by chance. Emacs contains many files specific to operating system or shared by operating systems (in the case of desktop files mostly about different Linux distributions that share 90% of their specific attributes). But again it's about semantics, if it really was about not having any operating specific parts in Emacs than why is there Windows or macOS specific functions in Emacs. > Each distro targets a single OS, and so it is reasonable to expect > them to arrange for the necessary desktop integration. For example, > no one would expect us to provide desktop shortcuts for MS-Windows, > except as a sign of good will and when we have the necessary expertise > on board. Emacs has operating specific code, for Windows or macOS even in low level interfaces and not just lisp code or accessories such as desktop shor= tcuts. Each distribution complies with XDG, all desktop file are XDG compliant. Emacs has desktop files that work with all distributions be it Linux or BSD. >> >From my pov letting Emacs do all work in passing arguments is the best >> solution as escaping is error prone. I haven't seen any program besides >> Emacs using escaped shell syntax to pass the escaped syntax of their >> target language. Most just have options to pass the target file or deal >> with the dbus activation/interface. > > We don't require any escapes except those needed by Lisp. > > Note that in this case, at least some of the escapes are because the > desktop shortcut invokes emacsclient via "sh -c "COMMAND STRING", > something that should be considered an Emacs problem or a problem we > must solve. I agree. In the desktop files it is assumed that X11 is used (check for DISPLAY variable to be set) which breaks (native) Wayland usage, but that is another issue. From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 21 21:37:10 2023 Received: (at 65902) by debbugs.gnu.org; 22 Sep 2023 01:37:10 +0000 Received: from localhost ([127.0.0.1]:35032 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjV6T-00085I-N6 for submit@debbugs.gnu.org; Thu, 21 Sep 2023 21:37:10 -0400 Received: from s.wrqvtbkv.outbound-mail.sendgrid.net ([149.72.123.24]:24778) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjV6O-00084f-0K for 65902@debbugs.gnu.org; Thu, 21 Sep 2023 21:37:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=from:subject:in-reply-to:references:mime-version:to:cc:content-type: cc:content-type:from:subject:to; s=s1; bh=nyLhZkA0zo2cA6svc0McbWL3RLafePY4+JHmp7fQogg=; b=ammzF6BJKcx59avgpJncVdsYVPohCntMq5I+r4fj76psi3jss/3BliiLthcIir9k4B47 fnhhSadzi97NhJ2WvN2xzL8L6UcnumkITkJitQFHE3C+1reo51Nx2WyAaIAhZCTC07v8YU 6owucL/LB29zC6kKuzBnAIS4pX+6O5B/uJXDB8LLzOCavXNHDV46Lrq5nBTi1J7gx12hNn 9hclAOsJsT6/+2Yp+EpnZOWBhzQ2an1ZHpdxJ/32S+lGj3LIIar/cpoIBDvwjHva+c2UzF 9of67tRc9/YJfaro0g7+7zn4iqOcsteHYfdXqsloogeOtJHoCbzemRlXVaeWkILQ== Received: by filterdrecv-84b96456cb-2mccf with SMTP id filterdrecv-84b96456cb-2mccf-1-650CEFAF-9 2023-09-22 01:36:47.306839535 +0000 UTC m=+11584715.869149617 Received: from earth.catern.com (unknown) by geopod-ismtpd-21 (SG) with ESMTP id 2PM24CXGQZqWig4T128qcQ Fri, 22 Sep 2023 01:36:47.084 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost; envelope-from=sbaugh@catern.com; receiver=gnu.org Received: from localhost (localhost [IPv6:::1]) by earth.catern.com (Postfix) with ESMTPSA id 83FA4656A5; Thu, 21 Sep 2023 21:36:46 -0400 (EDT) From: sbaugh@catern.com Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <835y4ckkzu.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 15 Sep 2023 09:29:09 +0300") References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> Date: Fri, 22 Sep 2023 01:36:47 +0000 (UTC) Message-ID: <874jjnvvip.fsf@catern.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbJNyIwq5KhjaYsgDkt2Fa?= =?us-ascii?Q?hRN+yXCp9KeieX+XiKh4IQpl=2FfFT6HJt6=2FgCp8U?= =?us-ascii?Q?xk71rJIfqD7x+=2Fj2F7Cjg2j6hu5DDX3gsZ3uk=2FN?= =?us-ascii?Q?AKcYGCRjZmFe8UiLoikskfPRAu4QEd21oDmCUfD?= =?us-ascii?Q?GBydP0Lyh45qirQsBUdXfbBbZPw08so+GUg=3D=3D?= To: Eli Zaretskii X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Eli Zaretskii writes: >> From: Spencer Baugh >> Cc: Spencer Baugh , 65902@debbugs.gnu.org, >> jporterbugs@gmail.com >> Date: Thu, 14 Sep 2023 [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [149.72.123.24 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, Spencer Baugh , jporterbugs@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) --=-=-= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Eli Zaretskii writes: >> From: Spencer Baugh >> Cc: Spencer Baugh , 65902@debbugs.gnu.org, >> jporterbugs@gmail.com >> Date: Thu, 14 Sep 2023 11:10:44 -0400 >> >> We could make a command-line-args-left equivalent for emacsclient, >> called server-eval-args-left, which contains the FILE arguments passed >> to emacsclient as strings. This can be done without making any changes >> to emacsclient.c or the server protocol. Then the message-mailto >> use case would look like this: >> >> emacsclient --eval '(message-mailto (pop server-eval-args-left))' %u >> >> This would match how message-mailto uses (pop command-line-args-left) >> internally. >> >> This would work for all the use-cases I described before; I'd be very >> happy with this solution (actually, I'm starting to prefer it to >> --apply). And again, it doesn't change emacsclient.c or the server >> protocol. > > This could perhaps be acceptable (although it's still rather kludgey, > IMO), but are you sure you understand all the consequences? > Currently, when emacsclient is invoked like this: > > $ emacsclient --eval '(func args)' foo bar > > we send to the server the following commands: > > -eval (func args) > -eval foo > -eval bar > > IOW, every command-line argument after --eval is treated as being > implicitly preceded with --eval. > > With your proposal, how will the server know that some of "-eval foo" > commands should cause foo to be added to server-eval-args-left instead > of being evaluated as it does now? As in the attached patch. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Add-server-eval-args-left-to-server.el.patch >From 1f0ff370a23eee1fdf740527efa75c0ddbe625bb Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Thu, 21 Sep 2023 21:35:50 -0400 Subject: [PATCH] Add server-eval-args-left to server.el Passing arbitrary arguments to functions through emacsclient --eval requires complicated escaping to avoid them being parsed as Lisp (as seen in emacsclient-mail.desktop before this change). This new variable server-eval-args-left allows access to the arguments before they are parsed as Lisp. By removing arguments from the variable before they're parsed, a snippet of Lisp can consume arguments, as in emacsclient-mail.desktop. org-protocol might be able to use this as well, which might allow it to drop its current advice on server-visit-files. * etc/emacsclient-mail.desktop: Use server-eval-args-left. (bug#65902) * lisp/server.el (server-eval-args-left): Add. (server-process-filter, server-execute): Make -eval arguments available through server-eval-args-left. --- etc/emacsclient-mail.desktop | 7 ++----- lisp/server.el | 21 +++++++++++++-------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/etc/emacsclient-mail.desktop b/etc/emacsclient-mail.desktop index 0a2420ddead..5962fa1764c 100644 --- a/etc/emacsclient-mail.desktop +++ b/etc/emacsclient-mail.desktop @@ -1,10 +1,7 @@ [Desktop Entry] 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=$(echo "$1" | sed 's/[\"]/\\&/g'); exec emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"$u\")" -# Special chars '"', '$', and '\' must be escaped as '\\"', '\\$', and '\\\\'. -Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u +Exec=emacsclient --alternate-editor= --eval '(message-mailto (pop server-eval-args-left))' %u Icon=emacs Name=Emacs (Mail, Client) MimeType=x-scheme-handler/mailto; @@ -16,7 +13,7 @@ Actions=new-window;new-instance; [Desktop Action new-window] Name=New Window -Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --create-frame --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u +Exec=emacsclient --alternate-editor= --create-frame --eval '(message-mailto (pop server-eval-args-left))' %u [Desktop Action new-instance] Name=New Instance diff --git a/lisp/server.el b/lisp/server.el index c3325e5a24c..6eff6ebe140 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1165,7 +1165,7 @@ server-process-filter (when prev (setq string (concat prev string)) (process-put proc 'previous-string nil))) - (condition-case err + (condition-case-unless-debug err (progn (server-add-client proc) ;; Send our pid @@ -1189,6 +1189,7 @@ server-process-filter parent-id ; Window ID for XEmbed dontkill ; t if client should not be killed. commands + evalexprs dir use-current-frame frame-parameters ;parameters for newly created frame @@ -1319,8 +1320,7 @@ server-process-filter (let ((expr (pop args-left))) (if coding-system (setq expr (decode-coding-string expr coding-system))) - (push (lambda () (server-eval-and-print expr proc)) - commands) + (push expr evalexprs) (setq filepos nil))) ;; -env NAME=VALUE: An environment variable. @@ -1345,7 +1345,7 @@ server-process-filter ;; arguments, use an existing frame. (and nowait (not (eq tty-name 'window-system)) - (or files commands) + (or files commands evalexprs) (setq use-current-frame t)) (setq frame @@ -1394,7 +1394,7 @@ server-process-filter (let ((default-directory (if (and dir (file-directory-p dir)) dir default-directory))) - (server-execute proc files nowait commands + (server-execute proc files nowait commands evalexprs dontkill frame tty-name))))) (when (or frame files) @@ -1404,22 +1404,27 @@ server-process-filter ;; condition-case (t (server-return-error proc err)))) -(defun server-execute (proc files nowait commands dontkill frame tty-name) +(defvar server-eval-args-left) + +(defun server-execute (proc files nowait commands evalexprs dontkill frame tty-name) ;; This is run from timers and process-filters, i.e. "asynchronously". ;; But w.r.t the user, this is not really asynchronous since the timer ;; is run after 0s and the process-filter is run in response to the ;; user running `emacsclient'. So it is OK to override the - ;; inhibit-quit flag, which is good since `commands' (as well as + ;; inhibit-quit flag, which is good since `evalexprs' (as well as ;; find-file-noselect via the major-mode) can run arbitrary code, ;; including code that needs to wait. (with-local-quit (condition-case err (let ((buffers (server-visit-files files proc nowait))) (mapc 'funcall (nreverse commands)) + (let ((server-eval-args-left (nreverse evalexprs))) + (while server-eval-args-left + (server-eval-and-print (pop server-eval-args-left) proc))) ;; If we were told only to open a new client, obey ;; `initial-buffer-choice' if it specifies a file ;; or a function. - (unless (or files commands) + (unless (or files commands evalexprs) (let ((buf (cond ((stringp initial-buffer-choice) (find-file-noselect initial-buffer-choice)) -- 2.41.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 22 02:36:30 2023 Received: (at 65902) by debbugs.gnu.org; 22 Sep 2023 06:36:30 +0000 Received: from localhost ([127.0.0.1]:35165 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjZm9-0007cs-K7 for submit@debbugs.gnu.org; Fri, 22 Sep 2023 02:36:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36094) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjZm4-0007cb-Gn for 65902@debbugs.gnu.org; Fri, 22 Sep 2023 02:36:28 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qjZln-0000qx-GV; Fri, 22 Sep 2023 02:36:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=ROs92ADmxFEUQ+1opgH4Dr6BcT+YwqtqbP1ZhS6957I=; b=sNT4tzNnLbsi uneqn5n3mWfR5HT9mzkd1vWModfIVu0XKVXBZmHu82V8wdO1WGhANeMAxEFq9ve0KZOTFPCOYkhui 94IjaiNQcpIC861hO7p8AKPyqe+0sBcQT6MrttOEi+8ecT6exWsNeYBap2MZIGSYkIZPdeaLy12jC WnzWJWsrjrgml5VGdXmZZX4QQeamn2mSomMIgpGtnzk/4dUjwGnnIjSXGuKKN6Qp/5JAP/LSXfwNO UMyXarfqyjdNw6PAh0aNc+MshFK4zgHU132SrT8QjTCvdFhLwetBZ4BE/uosqar8qzeQ2KY6xIMnb NXPRsbIQJoYtmtA9VtL0Wg==; Date: Fri, 22 Sep 2023 09:36:16 +0300 Message-Id: <835y4290kf.fsf@gnu.org> From: Eli Zaretskii To: sbaugh@catern.com In-Reply-To: <874jjnvvip.fsf@catern.com> (sbaugh@catern.com) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, sbaugh@janestreet.com, jporterbugs@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: sbaugh@catern.com > Date: Fri, 22 Sep 2023 01:36:47 +0000 (UTC) > Cc: Spencer Baugh , jporterbugs@gmail.com, > 65902@debbugs.gnu.org > > > Currently, when emacsclient is invoked like this: > > > > $ emacsclient --eval '(func args)' foo bar > > > > we send to the server the following commands: > > > > -eval (func args) > > -eval foo > > -eval bar > > > > IOW, every command-line argument after --eval is treated as being > > implicitly preceded with --eval. > > > > With your proposal, how will the server know that some of "-eval foo" > > commands should cause foo to be added to server-eval-args-left instead > > of being evaluated as it does now? > > As in the attached patch. I wish you'd accompanied the patch with some plain-text description of the idea, to make it easier to understand and to avoid unnecessary misunderstandings. IIUC, this kind of solution is fine by me, but the protocol of accessing and using server-eval-args-left in the Lisp expressions specified on the emacsclient command line should be well-documented to avoid any confusion and UB. Also, the patch includes an unrelated change: > --- a/lisp/server.el > +++ b/lisp/server.el > @@ -1165,7 +1165,7 @@ server-process-filter > (when prev > (setq string (concat prev string)) > (process-put proc 'previous-string nil))) > - (condition-case err > + (condition-case-unless-debug err From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 22 03:05:41 2023 Received: (at 65902) by debbugs.gnu.org; 22 Sep 2023 07:05:41 +0000 Received: from localhost ([127.0.0.1]:35181 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjaEP-0008Pc-2i for submit@debbugs.gnu.org; Fri, 22 Sep 2023 03:05:41 -0400 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]:58722) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjaEL-0008PM-D5 for 65902@debbugs.gnu.org; Fri, 22 Sep 2023 03:05:40 -0400 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2c022ce8114so30910021fa.1 for <65902@debbugs.gnu.org>; Fri, 22 Sep 2023 00:05:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695366321; x=1695971121; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=3tXEO5fZN9QEkDOWZRZL4YbeYwawJEiRdAYOA7I2l3o=; b=Balqs+bXhjYXPb/2VIJe5tWVqWe/SUF3vEUqKYd2Md1VrFXm8o3j4fLp/DoOKlFjua MMX3mrg5Qku3IrxhSdN8w5T++CBqhGrzWyDxuFRg0XXsXsKAMfo7vZleVB3GIkx00VV2 OQ3mUKY7Ovxi3fk1VFu/em36u+yRFPM3V7mn9NTB5u1GghJ0WOEnyo4KQmmAaW3URMmW pknnUGfnuvmrgF05WeggKqbVrKDIUTLVRlsSNHKFLzP9UIg4LKfw6/wP2c/2jfnXVvU3 azZNpPs/yZB8Q9gJCUlD7fw4MS7SwbAyfZ9uGO54EA/2unK0a9BSp4XBKLozwptEDyC0 B5Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695366321; x=1695971121; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3tXEO5fZN9QEkDOWZRZL4YbeYwawJEiRdAYOA7I2l3o=; b=r0eA+R4Pe3gtWdP+lUIGeqE8PUMBMlz3vjXsTWHguC/Ij1uU4BQKbeTPC0aeR4c4zy W5QoPBMNf1eOOmoMVK3Ej6npW3yBdc4yQeQ07mV+mGsBSZpmcON3Se5c9QGzLO9xdqC4 REWbY+wo2/JEIqLo9XgDvkll3FQdQIQMIhcm+x/YXve1WWQ26ycnMHgvuoDFvnM2Iv71 cqYyBtjcWnhdtigJCQ5iQ/PFAcRsniCYM/TxNPqLuL8YDIfvtbwNN/7bs6eMxu3Mzz9U l7mH60wKpn+5b74QdqRzvMDxnObvt+hV+hC2MX/nshRGU50NyJ6w+GQPH3GltyWP4sz/ SWLQ== X-Gm-Message-State: AOJu0YyZKkLea1Ctbkdzlz6xdofcorlKbxQwjpLkJUF5p4HuXsxJ84CP ASRc5l5hCf9whM9CsSTOuuW5XRrf/sU15JhdzUg= X-Google-Smtp-Source: AGHT+IGYjNo46Mbcn60BPMPu7TsftmxXqPkE8jHvCsWsYsPnYm0IY/1HajGvfbeV+5u2Tvkf/UDNTSSEbvNe/GaPvZU= X-Received: by 2002:a2e:b614:0:b0:2ba:8127:a2c3 with SMTP id r20-20020a2eb614000000b002ba8127a2c3mr5952210ljn.34.1695366320771; Fri, 22 Sep 2023 00:05:20 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Fri, 22 Sep 2023 00:05:20 -0700 From: Stefan Kangas In-Reply-To: <874jjnvvip.fsf@catern.com> References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> MIME-Version: 1.0 Date: Fri, 22 Sep 2023 00:05:20 -0700 Message-ID: Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping To: sbaugh@catern.com, Eli Zaretskii Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65902 Cc: jporterbugs@gmail.com, 65902@debbugs.gnu.org, Spencer Baugh X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) sbaugh@catern.com writes: > diff --git a/etc/emacsclient-mail.desktop b/etc/emacsclient-mail.desktop > index 0a2420ddead..5962fa1764c 100644 > --- a/etc/emacsclient-mail.desktop > +++ b/etc/emacsclient-mail.desktop > @@ -1,10 +1,7 @@ > [Desktop Entry] > 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=$(echo "$1" | sed 's/[\"]/\\&/g'); exec emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"$u\")" > -# Special chars '"', '$', and '\' must be escaped as '\\"', '\\$', and '\\\\'. > -Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u > +Exec=emacsclient --alternate-editor= --eval '(message-mailto (pop server-eval-args-left))' %u As Spencer pointed out upthread, the mailto: links come from untrusted sources (e.g. websites). Escaping is infamous for being hard to get right, and for that reason is a popular attack vector among bad actors. I think it would be good if we could reduce the amount of stuff we have to remember escaping here, or even better if we didn't need to escape anything at all. It's analogous to the case `shell-command-to-string' (which uses a shell) vs `call-process' (which doesn't). To my mind, this speaks in favor of some type of change in this direction. My two cents. From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 22 03:15:04 2023 Received: (at 65902) by debbugs.gnu.org; 22 Sep 2023 07:15:04 +0000 Received: from localhost ([127.0.0.1]:35199 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjaNU-0000Cn-FI for submit@debbugs.gnu.org; Fri, 22 Sep 2023 03:15:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43212) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjaNR-0000Br-S2 for 65902@debbugs.gnu.org; Fri, 22 Sep 2023 03:15:03 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qjaNB-0000yv-GN; Fri, 22 Sep 2023 03:14:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=JDXBEtB1BujwnwHSXlTlHxvX9f/5w117YG+DTwJEXdE=; b=jq9j4RKy23kO 1hsSEowheDqT0I8tvxTnVSKMI2bePzvlMewYMiHYL8SG2rImkrwuyjbLDP4Bm3ia/EXRKMK+pIKkY cOXJ6y5zYskviUzUY8E1uuenSRFgdQmMdTzkchj6xLKZJU1GM/6pmYG/u66e6uqW8/LuwPmCJclcY rZNXjJIdfQSqkjSCwHpOa2YO+xKjzoyQK9yH5zGoAE3tokhu3HrPWSqNm0SgF28T8dxQ1kwkzdQVS JWxy9TH8SEoXdE2h0Q/GHutDRRmNeb1lhZSn8KgDWKcnvXBrQ8bs+JZ7ndDza6x6fNkqKI1Jy8PRo OFlebhyVz392uro7ytUVEA==; Date: Fri, 22 Sep 2023 10:14:53 +0300 Message-Id: <8334z68ys2.fsf@gnu.org> From: Eli Zaretskii To: Stefan Kangas In-Reply-To: (message from Stefan Kangas on Fri, 22 Sep 2023 00:05:20 -0700) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902 Cc: jporterbugs@gmail.com, sbaugh@catern.com, sbaugh@janestreet.com, 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Kangas > Date: Fri, 22 Sep 2023 00:05:20 -0700 > Cc: 65902@debbugs.gnu.org, Spencer Baugh , jporterbugs@gmail.com > > I think it would be good if we could reduce the amount of stuff we have > to remember escaping here, or even better if we didn't need to escape > anything at all. We cannot avoid some escaping because the command is invoked through "sh -c". This is not our decision, this is the decision of freedesktop.org, and we have no control on what they decide, even if we think the decision is not the best one. From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 22 05:29:26 2023 Received: (at 65902) by debbugs.gnu.org; 22 Sep 2023 09:29:26 +0000 Received: from localhost ([127.0.0.1]:35323 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjcTW-0000Xq-25 for submit@debbugs.gnu.org; Fri, 22 Sep 2023 05:29:26 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:57784) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjcTQ-0000Xa-MG for 65902@debbugs.gnu.org; Fri, 22 Sep 2023 05:29:24 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4RsRmN2xFyz1sCmR; Fri, 22 Sep 2023 11:29:08 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 4RsRmM6qW1z1qqlW; Fri, 22 Sep 2023 11:29:07 +0200 (CEST) X-Virus-Scanned: amavis at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavis, port 10024) with ESMTP id 7Wnnc8CZZYm4; Fri, 22 Sep 2023 11:29:07 +0200 (CEST) X-Auth-Info: sRpxlChy8XVWMPQKi5nkTe/rURFcA/atCBPCT45GZx1r3Ty75N5Z0lXxbYxKaQGa Received: from igel.home (aftr-62-216-205-209.dynamic.mnet-online.de [62.216.205.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Fri, 22 Sep 2023 11:29:07 +0200 (CEST) Received: by igel.home (Postfix, from userid 1000) id E2B232C1DE4; Fri, 22 Sep 2023 11:29:06 +0200 (CEST) From: Andreas Schwab To: Eli Zaretskii Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <8334z68ys2.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 22 Sep 2023 10:14:53 +0300") References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> <8334z68ys2.fsf@gnu.org> X-Yow: All of life is a blur of Republicans and meat! Date: Fri, 22 Sep 2023 11:29:06 +0200 Message-ID: <874jjm36al.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.4 (/) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, jporterbugs@gmail.com, Stefan Kangas , sbaugh@janestreet.com, sbaugh@catern.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) On Sep 22 2023, Eli Zaretskii wrote: > We cannot avoid some escaping because the command is invoked through > "sh -c". This is not our decision, this is the decision of > freedesktop.org, That's not true. The Exec line is _not_ passed to the shell, but is processed by a specialized parser and then executed directly. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 22 07:32:40 2023 Received: (at 65902) by debbugs.gnu.org; 22 Sep 2023 11:32:40 +0000 Received: from localhost ([127.0.0.1]:35428 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjeOm-0006ZJ-4v for submit@debbugs.gnu.org; Fri, 22 Sep 2023 07:32:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41918) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjeOi-0006Z5-33 for 65902@debbugs.gnu.org; Fri, 22 Sep 2023 07:32:39 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qjeOQ-0005qK-Sn; Fri, 22 Sep 2023 07:32:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=UiGArjWVEUFXdgNWc1MuiVIb23zauu0g6Qiz83EsyW8=; b=aTWOJ/tzp2UX kCvbs9FZUGAdisU2tddVBYt5tfBtkhNfbRg5FVp6UcxpOD53NfuioZvHNX/ip5kjTxrs8hl5/CTvR 3Szy58C1qiF7o+b1cq6WTlZKAmT3qRaIlk8sITrWQxKU9cq6+9DqEHJsVGEjHyu4YXXerc0xMH5Ak g9o6vhldk8FflEaZkbHG8kQus0m9/7qiHwZ1cvTOTHLFKcZ/wyetsK1EFO6UMWlzXDGnKa6Qtsf3I 7+J1EA9dLyMC5vDEyTVsRFieC68oCo+qWA9pu7HNZDKB1PaA2Mn4HqlbeNtKl4UY9dViE6E7FFdxi 9Uoj0TslII9Ps7NbCodjWw==; Date: Fri, 22 Sep 2023 14:32:07 +0300 Message-Id: <83r0mq78aw.fsf@gnu.org> From: Eli Zaretskii To: Andreas Schwab In-Reply-To: <874jjm36al.fsf@igel.home> (message from Andreas Schwab on Fri, 22 Sep 2023 11:29:06 +0200) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> <8334z68ys2.fsf@gnu.org> <874jjm36al.fsf@igel.home> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, jporterbugs@gmail.com, stefankangas@gmail.com, sbaugh@janestreet.com, sbaugh@catern.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Andreas Schwab > Cc: Stefan Kangas , jporterbugs@gmail.com, > sbaugh@catern.com, sbaugh@janestreet.com, 65902@debbugs.gnu.org > Date: Fri, 22 Sep 2023 11:29:06 +0200 > > On Sep 22 2023, Eli Zaretskii wrote: > > > We cannot avoid some escaping because the command is invoked through > > "sh -c". This is not our decision, this is the decision of > > freedesktop.org, > > That's not true. The Exec line is _not_ passed to the shell, but is > processed by a specialized parser and then executed directly. Then why is "sh -c" being used? From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 22 08:38:10 2023 Received: (at 65902) by debbugs.gnu.org; 22 Sep 2023 12:38:10 +0000 Received: from localhost ([127.0.0.1]:35521 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjfQA-000590-2H for submit@debbugs.gnu.org; Fri, 22 Sep 2023 08:38:10 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:53867) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjfQ8-00058r-6D for 65902@debbugs.gnu.org; Fri, 22 Sep 2023 08:38:08 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4RsWyC6vnVz1sCHT; Fri, 22 Sep 2023 14:37:55 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 4RsWyC3w0Sz1qqlb; Fri, 22 Sep 2023 14:37:55 +0200 (CEST) X-Virus-Scanned: amavis at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavis, port 10024) with ESMTP id 5RLhlse4WpEW; Fri, 22 Sep 2023 14:37:54 +0200 (CEST) X-Auth-Info: SjZVwTeN3z/gG2oPhAfQOSnHUBN2YzpBx4x0noyWivah7LcZD+ZbM8AGZZ+iKk5X Received: from igel.home (aftr-62-216-205-209.dynamic.mnet-online.de [62.216.205.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Fri, 22 Sep 2023 14:37:54 +0200 (CEST) Received: by igel.home (Postfix, from userid 1000) id 8922B2C1DE4; Fri, 22 Sep 2023 14:37:53 +0200 (CEST) From: Andreas Schwab To: Eli Zaretskii Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <83r0mq78aw.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 22 Sep 2023 14:32:07 +0300") References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> <8334z68ys2.fsf@gnu.org> <874jjm36al.fsf@igel.home> <83r0mq78aw.fsf@gnu.org> X-Yow: I want you to MEMORIZE the collected poems of EDNA ST VINCENT MILLAY.. BACKWARDS!! Date: Fri, 22 Sep 2023 14:37:53 +0200 Message-ID: <87v8c21izi.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.4 (/) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, jporterbugs@gmail.com, stefankangas@gmail.com, sbaugh@janestreet.com, sbaugh@catern.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) On Sep 22 2023, Eli Zaretskii wrote: > Then why is "sh -c" being used? This is self-inflicted pain, because emacsclient does not support passing arbitrary arguments to emacs. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 22 08:56:46 2023 Received: (at 65902) by debbugs.gnu.org; 22 Sep 2023 12:56:46 +0000 Received: from localhost ([127.0.0.1]:35612 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjfiA-0005kU-3R for submit@debbugs.gnu.org; Fri, 22 Sep 2023 08:56:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57938) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjfi8-0005kG-3B for 65902@debbugs.gnu.org; Fri, 22 Sep 2023 08:56:44 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qjfhr-0008Fo-19; Fri, 22 Sep 2023 08:56:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=31h7GtlyxattXLiAr0IUd0gSgN+hpQ8OI+40p6Fbvvc=; b=ZKXXmD4tMEVO 218XX0SPrPjGwY2guKZSyBVnFSoxN+Q5ap+F4lx6Ym2QQblw6FK/ZIFvn6bnPH3hUxFSipRkTXAJE ibZnmXr4aN2PSP5PU34YwRYte14KUSqgStyKHC7X8m3wlO2tY10mR0V35dhHZVgahobBCO+TR41QB fmwQuF8dmfL9ivnbI/BE71vEK3x2fEcGNYlxtGXQaQFg7MgmvB5FIAXC4poY37HEk0mrPN0LniSqa n2OGo9k+P4RvsPNih+Lrok6WQbmKPXiRVMejpHdZCnsSE3+nYCka4Ezavtp8CMuGb29dML2fC4Doc TUrwnse3URGJ0UxqR7siFw==; Date: Fri, 22 Sep 2023 15:56:36 +0300 Message-Id: <835y4274e3.fsf@gnu.org> From: Eli Zaretskii To: Andreas Schwab In-Reply-To: <87v8c21izi.fsf@igel.home> (message from Andreas Schwab on Fri, 22 Sep 2023 14:37:53 +0200) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> <8334z68ys2.fsf@gnu.org> <874jjm36al.fsf@igel.home> <83r0mq78aw.fsf@gnu.org> <87v8c21izi.fsf@igel.home> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, jporterbugs@gmail.com, stefankangas@gmail.com, sbaugh@janestreet.com, sbaugh@catern.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Andreas Schwab > Cc: stefankangas@gmail.com, jporterbugs@gmail.com, sbaugh@catern.com, > sbaugh@janestreet.com, 65902@debbugs.gnu.org > Date: Fri, 22 Sep 2023 14:37:53 +0200 > > On Sep 22 2023, Eli Zaretskii wrote: > > > Then why is "sh -c" being used? > > This is self-inflicted pain, because emacsclient does not support > passing arbitrary arguments to emacs. What do you mean by "arbitrary arguments"? what kind of arguments need to be passed here that are not currently supported? From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 22 09:24:10 2023 Received: (at 65902) by debbugs.gnu.org; 22 Sep 2023 13:24:10 +0000 Received: from localhost ([127.0.0.1]:35666 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjg8g-0006S7-52 for submit@debbugs.gnu.org; Fri, 22 Sep 2023 09:24:10 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:60493) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjg8b-0006Rv-Re for 65902@debbugs.gnu.org; Fri, 22 Sep 2023 09:24:09 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4RsXzF4cCbz1sDfk; Fri, 22 Sep 2023 15:23:53 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 4RsXzF1bzkz1qqlW; Fri, 22 Sep 2023 15:23:53 +0200 (CEST) X-Virus-Scanned: amavis at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavis, port 10024) with ESMTP id B6MC3c2L7RPf; Fri, 22 Sep 2023 15:23:52 +0200 (CEST) X-Auth-Info: h2rSaRyJX/ltWLximz2KTKJVY+/GHkKq5BW0dchzRLv0cJAvrLs6SgIWR8yhRXUL Received: from igel.home (aftr-62-216-205-209.dynamic.mnet-online.de [62.216.205.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Fri, 22 Sep 2023 15:23:52 +0200 (CEST) Received: by igel.home (Postfix, from userid 1000) id B67572C1DE4; Fri, 22 Sep 2023 15:23:51 +0200 (CEST) From: Andreas Schwab To: Eli Zaretskii Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <835y4274e3.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 22 Sep 2023 15:56:36 +0300") References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> <8334z68ys2.fsf@gnu.org> <874jjm36al.fsf@igel.home> <83r0mq78aw.fsf@gnu.org> <87v8c21izi.fsf@igel.home> <835y4274e3.fsf@gnu.org> X-Yow: Will the third world war keep ``Bosom Buddies'' off the air? Date: Fri, 22 Sep 2023 15:23:51 +0200 Message-ID: <87r0mq1guw.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.4 (/) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, jporterbugs@gmail.com, stefankangas@gmail.com, sbaugh@janestreet.com, sbaugh@catern.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) On Sep 22 2023, Eli Zaretskii wrote: > What do you mean by "arbitrary arguments"? what kind of arguments need > to be passed here that are not currently supported? %u -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 22 10:51:43 2023 Received: (at 65902) by debbugs.gnu.org; 22 Sep 2023 14:51:43 +0000 Received: from localhost ([127.0.0.1]:37059 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjhVP-0003CZ-Ap for submit@debbugs.gnu.org; Fri, 22 Sep 2023 10:51:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59994) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjhVL-0003CK-FO for 65902@debbugs.gnu.org; Fri, 22 Sep 2023 10:51:41 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qjhV3-00008j-Nj; Fri, 22 Sep 2023 10:51:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=yMdsmsT2Ifz/xgKmy0sptBF3fi/qpn2P+isvPU83Pxo=; b=RkLOU7D4CvNW +e0megZ2mL8CCrEHxggJKfpxfpULZHk7spQ1gv73o5LmrrVN94/OryD4A0MugvSPCJxUAwCiU7Fsx T+xPdN0GSTxo9uGopTaG/wwgJz6iGRRUJWk2Ag3WDRnM7emhkYdBBhAvnpzQDTEfOfzJzZcvouSX2 HjtzVm13LLutcS//4hh6yeHxYxQq1rNpgCpdFkHpaYfgwLoOTLtWZ1w2pOI5PDcBThdldMn7H7VX8 lzhg8/RrcO68QcrrE4vFGQDVZ1GA1gcpqbi2jgJQ9fdQDzwg8hKtfRzzejyd10xAuMxYOyQ0hEZHt 7hTaxfWoK15YCyNAN/qOGg==; Date: Fri, 22 Sep 2023 17:51:18 +0300 Message-Id: <83r0mq5kih.fsf@gnu.org> From: Eli Zaretskii To: Andreas Schwab In-Reply-To: <87r0mq1guw.fsf@igel.home> (message from Andreas Schwab on Fri, 22 Sep 2023 15:23:51 +0200) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> <8334z68ys2.fsf@gnu.org> <874jjm36al.fsf@igel.home> <83r0mq78aw.fsf@gnu.org> <87v8c21izi.fsf@igel.home> <835y4274e3.fsf@gnu.org> <87r0mq1guw.fsf@igel.home> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, jporterbugs@gmail.com, stefankangas@gmail.com, sbaugh@janestreet.com, sbaugh@catern.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Andreas Schwab > Cc: stefankangas@gmail.com, jporterbugs@gmail.com, sbaugh@catern.com, > sbaugh@janestreet.com, 65902@debbugs.gnu.org > Date: Fri, 22 Sep 2023 15:23:51 +0200 > > On Sep 22 2023, Eli Zaretskii wrote: > > > What do you mean by "arbitrary arguments"? what kind of arguments need > > to be passed here that are not currently supported? > > %u This contradicts what I see in the *desktop files. They use shell commands and features. See, for example, emacsclient.desktop and emacsclient-mail.desktop. From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 22 10:52:30 2023 Received: (at 65902) by debbugs.gnu.org; 22 Sep 2023 14:52:30 +0000 Received: from localhost ([127.0.0.1]:37067 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjhW9-0003E9-Vb for submit@debbugs.gnu.org; Fri, 22 Sep 2023 10:52:30 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:37884) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qjhW4-0003Dy-O9 for 65902@debbugs.gnu.org; Fri, 22 Sep 2023 10:52:27 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4RsZx84m9Tz1r3dl; Fri, 22 Sep 2023 16:52:10 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 4RsZx56glQz1qqlW; Fri, 22 Sep 2023 16:52:09 +0200 (CEST) X-Virus-Scanned: amavis at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavis, port 10024) with ESMTP id 4izDe5kBXvdF; Fri, 22 Sep 2023 16:52:09 +0200 (CEST) X-Auth-Info: NlVHUw5S16cC7aVONL5xjRZY/MrbJY1iZMUJH2SgS+u5x9ziFUWZNaBgCgHa18Qt Received: from igel.home (aftr-62-216-205-209.dynamic.mnet-online.de [62.216.205.209]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Fri, 22 Sep 2023 16:52:09 +0200 (CEST) Received: by igel.home (Postfix, from userid 1000) id AAA1A2C1DE4; Fri, 22 Sep 2023 16:52:08 +0200 (CEST) From: Andreas Schwab To: Eli Zaretskii Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <83r0mq5kih.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 22 Sep 2023 17:51:18 +0300") References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> <8334z68ys2.fsf@gnu.org> <874jjm36al.fsf@igel.home> <83r0mq78aw.fsf@gnu.org> <87v8c21izi.fsf@igel.home> <835y4274e3.fsf@gnu.org> <87r0mq1guw.fsf@igel.home> <83r0mq5kih.fsf@gnu.org> X-Yow: Hmmm... an arrogant bouquet with a subtle suggestion of POLYVINYL CHLORIDE... Date: Fri, 22 Sep 2023 16:52:08 +0200 Message-ID: <87msxe1crr.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.4 (/) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, jporterbugs@gmail.com, stefankangas@gmail.com, sbaugh@janestreet.com, sbaugh@catern.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) On Sep 22 2023, Eli Zaretskii wrote: >> From: Andreas Schwab >> Cc: stefankangas@gmail.com, jporterbugs@gmail.com, sbaugh@catern.com, >> sbaugh@janestreet.com, 65902@debbugs.gnu.org >> Date: Fri, 22 Sep 2023 15:23:51 +0200 >> >> On Sep 22 2023, Eli Zaretskii wrote: >> >> > What do you mean by "arbitrary arguments"? what kind of arguments need >> > to be passed here that are not currently supported? >> >> %u > > This contradicts what I see in the *desktop files. They use shell > commands and features. That's the self-inflicted pain. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 23 16:24:28 2023 Received: (at 65902) by debbugs.gnu.org; 23 Sep 2023 20:24:29 +0000 Received: from localhost ([127.0.0.1]:40682 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qk9Ay-0004FU-7s for submit@debbugs.gnu.org; Sat, 23 Sep 2023 16:24:28 -0400 Received: from s.wfbtzhsw.outbound-mail.sendgrid.net ([159.183.224.105]:42924) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qk9Av-0004FE-Bl for 65902@debbugs.gnu.org; Sat, 23 Sep 2023 16:24:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=from:subject:in-reply-to:references:mime-version:to:cc:content-type: cc:content-type:from:subject:to; s=s1; bh=DndJ8w3HDoAMjhJnLnwDwtFVxeMh5OntqXVj1yBjys0=; b=RdX9ATqALGTQvJye+HDHAjNWNmBgHzeUJ9IbkGf5KdnAWMhSVohP66Kk+IdwzdT0phYt /fkUMhq6BdV6B8HoD/Z7aACz3KNDIJ+4Faq83+42HMqfqJfFm3rKxenSfoZeM2Nxk8CfXw gq0izosjNsuaI52Jx7Av8CWy43CVXZc2sEDr0bMGbrqphhx+rL492KciwD7P8l5bFFEhY/ F7v2GtFJXC+NvRpUYeilIN0iXZwowJiF0BY4cuf//sQVmF47odB18RSIPGA7DfnvkdC/L1 CJCdTUqfpakHg0JsviJ6Cdtie1gc93UTiqYTDG0G2Q3riK6P8oBi4r2csNlrEw9A== Received: by filterdrecv-d7bbbc8bf-7m5fp with SMTP id filterdrecv-d7bbbc8bf-7m5fp-1-650F4967-F 2023-09-23 20:24:07.43747357 +0000 UTC m=+717150.530742951 Received: from earth.catern.com (unknown) by geopod-ismtpd-7 (SG) with ESMTP id idtM00KnTP2A_fJTOugs9Q Sat, 23 Sep 2023 20:24:07.245 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost; envelope-from=sbaugh@catern.com; receiver=gnu.org Received: from localhost (localhost [IPv6:::1]) by earth.catern.com (Postfix) with ESMTPSA id 5F65160166; Sat, 23 Sep 2023 16:24:06 -0400 (EDT) From: sbaugh@catern.com Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <835y4290kf.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 22 Sep 2023 09:36:16 +0300") References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> <835y4290kf.fsf@gnu.org> Date: Sat, 23 Sep 2023 20:24:07 +0000 (UTC) Message-ID: <87zg1cprix.fsf@catern.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbKT9PHbWLcohoUdn1o940?= =?us-ascii?Q?HESvMq7=2FmhUBwQJCe3dIXZGZPqnz3kmrHzVXNi=2F?= =?us-ascii?Q?uacdx=2FbdUuXJpwqnVYLqFCnThc+g6J0+c6Uh2my?= =?us-ascii?Q?bD5oqD+hadEPfuK8n3z=2FBALHxVZJUAN+OooINiS?= =?us-ascii?Q?fJggM7yBYnWrDmUYjIR2g3gDQtUqxF080vg=3D=3D?= To: Eli Zaretskii X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65902 Cc: jporterbugs@gmail.com, 65902@debbugs.gnu.org, sbaugh@janestreet.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Eli Zaretskii writes: >> From: sbaugh@catern.com >> Date: Fri, 22 Sep 2023 01:36:47 +0000 (UTC) >> Cc: Spencer Baugh , jporterbugs@gmail.com, >> 65902@debbugs.gnu.org >> >> > Currently, when emacsclient is invoked like this: >> > >> > $ emacsclient --eval '(func args)' foo bar >> > >> > we send to the server the following commands: >> > >> > -eval (func args) >> > -eval foo >> > -eval bar >> > >> > IOW, every command-line argument after --eval is treated as being >> > implicitly preceded with --eval. >> > >> > With your proposal, how will the server know that some of "-eval foo" >> > commands should cause foo to be added to server-eval-args-left instead >> > of being evaluated as it does now? >> >> As in the attached patch. > > I wish you'd accompanied the patch with some plain-text description of > the idea, to make it easier to understand and to avoid unnecessary > misunderstandings. Ah, well, the basic idea is that for each -eval request we receive in the protocol, we accumulate the argument as a string into a single list (instead of immediately turning it into a closure which calls server-eval-and-print). Then we let-bind server-eval-args-left to that list around the calls to to server-eval-and-print, and consume each argument from the list one by one. > IIUC, this kind of solution is fine by me, but the protocol of > accessing and using server-eval-args-left in the Lisp expressions > specified on the emacsclient command line should be well-documented to > avoid any confusion and UB. Added a docstring and included it in NEWS. I would have put it in the manual, but it seems rather niche to put in the Emacs manual and I didn't see a natural place to put it in the Emacs Lisp manual. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Add-server-eval-args-left-to-server.el.patch >From cf7fcda1374491cc73a751d5636f36a95b2e8669 Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Thu, 21 Sep 2023 21:35:50 -0400 Subject: [PATCH] Add server-eval-args-left to server.el Passing arbitrary arguments to functions through emacsclient --eval requires complicated escaping to avoid them being parsed as Lisp (as seen in emacsclient-mail.desktop before this change). This new variable server-eval-args-left allows access to the arguments before they are parsed as Lisp. By removing arguments from the variable before they're parsed, a snippet of Lisp can consume arguments, as in emacsclient-mail.desktop. org-protocol might be able to use this as well, which might allow it to drop its current advice on server-visit-files. * etc/emacsclient-mail.desktop: Use server-eval-args-left. (bug#65902) * lisp/server.el (server-eval-args-left): Add. (server-process-filter, server-execute): Make -eval arguments available through server-eval-args-left. * lisp/startup.el (argv): Mention server-eval-args-left in docstring. * etc/NEWS: Announce server-eval-args-left. --- etc/NEWS | 10 ++++++++++ etc/emacsclient-mail.desktop | 7 ++----- lisp/server.el | 35 ++++++++++++++++++++++++++++------- lisp/startup.el | 5 ++++- 4 files changed, 44 insertions(+), 13 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index cd4c414a64c..de1d79fcb98 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -121,6 +121,16 @@ Anything following the symbol 'mode-line-format-right-align' in right-aligned to is controlled by the new user option 'mode-line-right-align-edge'. +** Emacs Server and Client + +--- +*** 'server-eval-args-left' can be used to pop subsequent eval args +When '--eval' is passed to emacsclient and Emacs is evaluating each +argument, this variable is set to those which have not yet been +evaluated. It can be used to 'pop' arguments to prevent them from +being evaluated, which is useful when those arguments contain +arbitrary data. + * Editing Changes in Emacs 30.1 diff --git a/etc/emacsclient-mail.desktop b/etc/emacsclient-mail.desktop index 0a2420ddead..5962fa1764c 100644 --- a/etc/emacsclient-mail.desktop +++ b/etc/emacsclient-mail.desktop @@ -1,10 +1,7 @@ [Desktop Entry] 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=$(echo "$1" | sed 's/[\"]/\\&/g'); exec emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"$u\")" -# Special chars '"', '$', and '\' must be escaped as '\\"', '\\$', and '\\\\'. -Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u +Exec=emacsclient --alternate-editor= --eval '(message-mailto (pop server-eval-args-left))' %u Icon=emacs Name=Emacs (Mail, Client) MimeType=x-scheme-handler/mailto; @@ -16,7 +13,7 @@ Actions=new-window;new-instance; [Desktop Action new-window] Name=New Window -Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --create-frame --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u +Exec=emacsclient --alternate-editor= --create-frame --eval '(message-mailto (pop server-eval-args-left))' %u [Desktop Action new-instance] Name=New Instance diff --git a/lisp/server.el b/lisp/server.el index c3325e5a24c..65f28cdea23 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1189,6 +1189,7 @@ server-process-filter parent-id ; Window ID for XEmbed dontkill ; t if client should not be killed. commands + evalexprs dir use-current-frame frame-parameters ;parameters for newly created frame @@ -1319,8 +1320,7 @@ server-process-filter (let ((expr (pop args-left))) (if coding-system (setq expr (decode-coding-string expr coding-system))) - (push (lambda () (server-eval-and-print expr proc)) - commands) + (push expr evalexprs) (setq filepos nil))) ;; -env NAME=VALUE: An environment variable. @@ -1345,7 +1345,7 @@ server-process-filter ;; arguments, use an existing frame. (and nowait (not (eq tty-name 'window-system)) - (or files commands) + (or files commands evalexprs) (setq use-current-frame t)) (setq frame @@ -1394,7 +1394,7 @@ server-process-filter (let ((default-directory (if (and dir (file-directory-p dir)) dir default-directory))) - (server-execute proc files nowait commands + (server-execute proc files nowait commands evalexprs dontkill frame tty-name))))) (when (or frame files) @@ -1404,22 +1404,43 @@ server-process-filter ;; condition-case (t (server-return-error proc err)))) -(defun server-execute (proc files nowait commands dontkill frame tty-name) +(defvar server-eval-args-left nil + "List of eval args not yet processed. + +When the server receives a request to eval one or more strings, +it stores them in this variable. Then, until this variable is +nil, it `pop's a string from this variable and evaluates it with +`server-eval-and-print'. Adding or removing strings from this +variable during this process will affect what is evaluated. + +This allows an expression passed to \"emacsclient --eval\" to +consume one or more subsequent arguments before they're parsed or +evaluated, with (pop server-eval-args-left). This is useful if +those arguments are arbitrary strings which should not be +evaluated. + +See also `command-line-args-left' for a similar variable which +works for command line invocations of \"emacs\".") + +(defun server-execute (proc files nowait commands evalexprs dontkill frame tty-name) ;; This is run from timers and process-filters, i.e. "asynchronously". ;; But w.r.t the user, this is not really asynchronous since the timer ;; is run after 0s and the process-filter is run in response to the ;; user running `emacsclient'. So it is OK to override the - ;; inhibit-quit flag, which is good since `commands' (as well as + ;; inhibit-quit flag, which is good since `evalexprs' (as well as ;; find-file-noselect via the major-mode) can run arbitrary code, ;; including code that needs to wait. (with-local-quit (condition-case err (let ((buffers (server-visit-files files proc nowait))) (mapc 'funcall (nreverse commands)) + (let ((server-eval-args-left (nreverse evalexprs))) + (while server-eval-args-left + (server-eval-and-print (pop server-eval-args-left) proc))) ;; If we were told only to open a new client, obey ;; `initial-buffer-choice' if it specifies a file ;; or a function. - (unless (or files commands) + (unless (or files commands evalexprs) (let ((buf (cond ((stringp initial-buffer-choice) (find-file-noselect initial-buffer-choice)) diff --git a/lisp/startup.el b/lisp/startup.el index 7f601668369..f2c84751211 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -120,7 +120,10 @@ command-switch-alist "List of command-line args not yet processed. This is a convenience alias, so that one can write (pop argv) inside of --eval command line arguments in order to access -following arguments.")) +following arguments. + +See also `server-eval-args-left' for a similar variable which +works for invocations of \"emacsclient --eval\".")) (internal-make-var-non-special 'argv) (defvar command-line-args-left nil -- 2.41.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 24 01:19:32 2023 Received: (at 65902) by debbugs.gnu.org; 24 Sep 2023 05:19:32 +0000 Received: from localhost ([127.0.0.1]:40870 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qkHWm-00023l-7i for submit@debbugs.gnu.org; Sun, 24 Sep 2023 01:19:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38422) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qkHWj-00023U-5N for 65902@debbugs.gnu.org; Sun, 24 Sep 2023 01:19:31 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qkHWR-0003pe-LQ; Sun, 24 Sep 2023 01:19:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=cKxMP3y/CYrdI5uMcg38K2hrEJj8Fb7gSPMe6i6F6M4=; b=H/siEePBYe4u wVHkVwYvWf6dYWdO/JTr9qzhwmSdIQq6OZxL0MHGuCe235nGG0cFzpZ28ZT+t9p5++OMiCuJQTZDH CRoLzkMT/bHClx3jBxZAeKYY9X0HcXd+Y9cBYIQtZ4H2MQbbgNkoMSiVWl3m6neW8rb6UEZrCEZdv dSVeL6+KpMPTh1sCICpnc6ATeNR1BXe6WXfgUieJ9dXCDaIg9sBWSEWvLle/LuXE/jvszUTUpFKFX 5tKMLwRNDS7YhYqLXYEVSOxlmLBmNwm49cjTPPL0hR1WJkSo0aSBWkhq0W8KC5CZcwhTI5osb9jw9 +G5oZyyoVwHOgAMy0LCp0g==; Date: Sun, 24 Sep 2023 08:18:45 +0300 Message-Id: <83a5tc4096.fsf@gnu.org> From: Eli Zaretskii To: sbaugh@catern.com In-Reply-To: <87zg1cprix.fsf@catern.com> (sbaugh@catern.com) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> <835y4290kf.fsf@gnu.org> <87zg1cprix.fsf@catern.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902 Cc: jporterbugs@gmail.com, 65902@debbugs.gnu.org, sbaugh@janestreet.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: sbaugh@catern.com > Date: Sat, 23 Sep 2023 20:24:07 +0000 (UTC) > Cc: 65902@debbugs.gnu.org, sbaugh@janestreet.com, jporterbugs@gmail.com > > > IIUC, this kind of solution is fine by me, but the protocol of > > accessing and using server-eval-args-left in the Lisp expressions > > specified on the emacsclient command line should be well-documented to > > avoid any confusion and UB. > > Added a docstring and included it in NEWS. I would have put it in the > manual, but it seems rather niche to put in the Emacs manual and I > didn't see a natural place to put it in the Emacs Lisp manual. The natural place is in the Emacs user manual, in "emacsclient Options", where --eval is described. Where else? > Passing arbitrary arguments to functions through emacsclient --eval > requires complicated escaping to avoid them being parsed as Lisp (as > seen in emacsclient-mail.desktop before this change). > > This new variable server-eval-args-left allows access to the arguments > before they are parsed as Lisp. By removing arguments from the > variable before they're parsed, a snippet of Lisp can consume > arguments, as in emacsclient-mail.desktop. > > org-protocol might be able to use this as well, which might allow it > to drop its current advice on server-visit-files. The right place to keep this information is in the manual and the doc strings, not just in the Git commit log message. > +(defvar server-eval-args-left nil > + "List of eval args not yet processed. > + > +When the server receives a request to eval one or more strings, > +it stores them in this variable. Then, until this variable is > +nil, it `pop's a string from this variable and evaluates it with > +`server-eval-and-print'. Adding or removing strings from this > +variable during this process will affect what is evaluated. This describes the implementation rather than the intended usage. > +This allows an expression passed to \"emacsclient --eval\" to > +consume one or more subsequent arguments before they're parsed or > +evaluated, with (pop server-eval-args-left). This is useful if > +those arguments are arbitrary strings which should not be > +evaluated. This describes a way of using this, but without the important part: that any processed argument _must_ be popped, or it will be evaluated again. See the doc string of command-line-functions for what I have in mind. All in all, I think this should be rewritten in terms of how to use this, and the result moved to the Emacs manual, leaving just the minimum here. > +See also `command-line-args-left' for a similar variable which > +works for command line invocations of \"emacs\".") This "see also" is not useful, because the doc string of command-line-args-left is minimal and doesn't add any information (which is okay, since that variable is basically meant for internal Emacs handling of command-line arguments, unlike this one). > --- a/lisp/startup.el > +++ b/lisp/startup.el > @@ -120,7 +120,10 @@ command-switch-alist > "List of command-line args not yet processed. > This is a convenience alias, so that one can write (pop argv) > inside of --eval command line arguments in order to access > -following arguments.")) > +following arguments. > + > +See also `server-eval-args-left' for a similar variable which > +works for invocations of \"emacsclient --eval\".")) And neither is this, because the use cases of the two variables are almost completely unrelated. From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 24 10:20:44 2023 Received: (at 65902) by debbugs.gnu.org; 24 Sep 2023 14:20:44 +0000 Received: from localhost ([127.0.0.1]:43388 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qkPyS-0002oR-Lb for submit@debbugs.gnu.org; Sun, 24 Sep 2023 10:20:44 -0400 Received: from s.wfbtzhsv.outbound-mail.sendgrid.net ([159.183.224.104]:44368) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qkPyN-0002o5-Hh for 65902@debbugs.gnu.org; Sun, 24 Sep 2023 10:20:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=from:subject:in-reply-to:references:mime-version:to:cc:content-type: cc:content-type:from:subject:to; s=s1; bh=2gZjm7zpgvjHkvVnoniLdM5KdtNzGlv/czRBkKcZh64=; b=kn39f1SzVa4J3ljQdx+D8i1pFx8uEzhtOTbb3ehyV+jSwIX4t9VFBTZlcy4YlZgWIsCi MRdgW/B8UwOPXhedrbf/A/VCWTcyFe3GTU9gq35IowexR7M2ptCE4ppUGuySc3VrSZzXBq OFj23HbHgkrzlIqAEBr2BlkayGUhMnVarDTWtr6zHs+U9QnWhDCw4z3MXRnsYoYSurQgoi lD0w2tfABRYCFOpQyXaKNoBDhiJiWE10wsWTIgs57tpZe2sv7NzNNX0nhGaNxNbLSbWOVX Bw9UkQJjbQnq4VlaXmq1asdQEHrMCa80SU2a5esP7jvcb5Dnle1jHmfe2RQVdq5Q== Received: by filterdrecv-84b96456cb-vm9rv with SMTP id filterdrecv-84b96456cb-vm9rv-1-651045A0-19 2023-09-24 14:20:16.640783476 +0000 UTC m=+11803291.394807526 Received: from earth.catern.com (unknown) by geopod-ismtpd-4 (SG) with ESMTP id Kj0zs797SWu0wHI6_UKTvg Sun, 24 Sep 2023 14:20:16.393 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost; envelope-from=sbaugh@catern.com; receiver=gnu.org Received: from localhost (localhost [IPv6:::1]) by earth.catern.com (Postfix) with ESMTPSA id E94DA62523; Sun, 24 Sep 2023 10:20:15 -0400 (EDT) From: sbaugh@catern.com Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <83a5tc4096.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 24 Sep 2023 08:18:45 +0300") References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> <835y4290kf.fsf@gnu.org> <87zg1cprix.fsf@catern.com> <83a5tc4096.fsf@gnu.org> Date: Sun, 24 Sep 2023 14:20:16 +0000 (UTC) Message-ID: <87wmwfps9s.fsf@catern.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbLC3WoWB5tg9x0+m6oYKR?= =?us-ascii?Q?VDWrjV2LdH6ULrE2KTahezJtcW51fC6aUaKxNkH?= =?us-ascii?Q?HTUsx8rh+TqvTCynNw+GgGtLB+aIigHvXyKachO?= =?us-ascii?Q?Sx4f9=2Fb7iEHccMh82al=2FBYPpG9HJpYGU1UsHw36?= =?us-ascii?Q?WoDtFwpBdKGtK+jQmHWfhJO37ElqcNPsk4Q=3D=3D?= To: Eli Zaretskii X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65902 Cc: jporterbugs@gmail.com, sbaugh@janestreet.com, 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Eli Zaretskii writes: >> From: sbaugh@catern.com >> Date: Sat, 23 Sep 2023 20:24:07 +0000 (UTC) >> Cc: 65902@debbugs.gnu.org, sbaugh@janestreet.com, jporterbugs@gmail.com >> >> > IIUC, this kind of solution is fine by me, but the protocol of >> > accessing and using server-eval-args-left in the Lisp expressions >> > specified on the emacsclient command line should be well-documented to >> > avoid any confusion and UB. >> >> Added a docstring and included it in NEWS. I would have put it in the >> manual, but it seems rather niche to put in the Emacs manual and I >> didn't see a natural place to put it in the Emacs Lisp manual. > > The natural place is in the Emacs user manual, in "emacsclient > Options", where --eval is described. Where else? Ah true, obvious, I added it there. >> Passing arbitrary arguments to functions through emacsclient --eval >> requires complicated escaping to avoid them being parsed as Lisp (as >> seen in emacsclient-mail.desktop before this change). >> >> This new variable server-eval-args-left allows access to the arguments >> before they are parsed as Lisp. By removing arguments from the >> variable before they're parsed, a snippet of Lisp can consume >> arguments, as in emacsclient-mail.desktop. >> >> org-protocol might be able to use this as well, which might allow it >> to drop its current advice on server-visit-files. > > The right place to keep this information is in the manual and the doc > strings, not just in the Git commit log message. Done. >> +(defvar server-eval-args-left nil >> + "List of eval args not yet processed. >> + >> +When the server receives a request to eval one or more strings, >> +it stores them in this variable. Then, until this variable is >> +nil, it `pop's a string from this variable and evaluates it with >> +`server-eval-and-print'. Adding or removing strings from this >> +variable during this process will affect what is evaluated. > > This describes the implementation rather than the intended usage. Fixed. >> +This allows an expression passed to \"emacsclient --eval\" to >> +consume one or more subsequent arguments before they're parsed or >> +evaluated, with (pop server-eval-args-left). This is useful if >> +those arguments are arbitrary strings which should not be >> +evaluated. > > This describes a way of using this, but without the important part: > that any processed argument _must_ be popped, or it will be evaluated > again. See the doc string of command-line-functions for what I have > in mind. > > All in all, I think this should be rewritten in terms of how to use > this, and the result moved to the Emacs manual, leaving just the > minimum here. Done. >> +See also `command-line-args-left' for a similar variable which >> +works for command line invocations of \"emacs\".") > > This "see also" is not useful, because the doc string of > command-line-args-left is minimal and doesn't add any information > (which is okay, since that variable is basically meant for internal > Emacs handling of command-line arguments, unlike this one). Okay, fair, probably that should point at `argv' instead. >> --- a/lisp/startup.el >> +++ b/lisp/startup.el >> @@ -120,7 +120,10 @@ command-switch-alist >> "List of command-line args not yet processed. >> This is a convenience alias, so that one can write (pop argv) >> inside of --eval command line arguments in order to access >> -following arguments.")) >> +following arguments. >> + >> +See also `server-eval-args-left' for a similar variable which >> +works for invocations of \"emacsclient --eval\".")) > > And neither is this, because the use cases of the two variables are > almost completely unrelated. The docstring of argv says: This is a convenience alias, so that one can write (pop argv) inside of --eval command line arguments in order to access following arguments. That is exactly the same way this new variable is used. And in fact it's used for the exact same purpose in message-mailto. The reason "emacs" doesn't require complicated escaping is because message-mailto does (pop command-line-args-left) internally. I agree that argv/command-line-args-left has other use cases besides this one. But one of argv's use cases is the exact same use case of server-eval-args-left. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Add-server-eval-args-left-to-server.el.patch >From bd49b918e57363593660f605c3e0efc3d0155c2b Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Thu, 21 Sep 2023 21:35:50 -0400 Subject: [PATCH] Add server-eval-args-left to server.el Passing arbitrary arguments to functions through emacsclient --eval requires complicated escaping to avoid them being parsed as Lisp (as seen in emacsclient-mail.desktop before this change). This new variable server-eval-args-left allows access to the arguments before they are parsed as Lisp. By removing arguments from the variable before they're parsed, a snippet of Lisp can consume arguments, as in emacsclient-mail.desktop. org-protocol might be able to use this as well, which might allow it to drop its current advice on server-visit-files. * etc/emacsclient-mail.desktop: Use server-eval-args-left. (bug#65902) * lisp/server.el (server-eval-args-left): Add. (server-process-filter, server-execute): Make -eval arguments available through server-eval-args-left. * lisp/startup.el (argv): Mention server-eval-args-left in docstring. * etc/NEWS: Announce server-eval-args-left. * doc/emacs/misc.texi (emacsclient Options): Document server-eval-args-left. --- doc/emacs/misc.texi | 9 +++++++++ etc/NEWS | 10 ++++++++++ etc/emacsclient-mail.desktop | 7 ++----- lisp/server.el | 27 ++++++++++++++++++++------- lisp/startup.el | 5 ++++- 5 files changed, 45 insertions(+), 13 deletions(-) diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 7a88b7ef5e0..1ce1713b01c 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -2078,6 +2078,15 @@ emacsclient Options @command{emacsclient} are interpreted as a list of expressions to evaluate, @emph{not} as a list of files to visit. +@vindex server-eval-args-left +If you have arbitrary data which you want to provide as input to one +of your expressions, you can pass the data as another argument to +@command{emacsclient} and use @var{server-eval-args-left} in the +expression to access the data. Be careful to have your expression +remove the data from @var{server-eval-args-left} regardless of whether +your code succeeds, such as by using @code{pop}, otherwise Emacs will +attempt to evaluate the data as a Lisp expression. + @item -f @var{server-file} @itemx --server-file=@var{server-file} Specify a server file (@pxref{TCP Emacs server}) for connecting to an diff --git a/etc/NEWS b/etc/NEWS index cd4c414a64c..de1d79fcb98 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -121,6 +121,16 @@ Anything following the symbol 'mode-line-format-right-align' in right-aligned to is controlled by the new user option 'mode-line-right-align-edge'. +** Emacs Server and Client + +--- +*** 'server-eval-args-left' can be used to pop subsequent eval args +When '--eval' is passed to emacsclient and Emacs is evaluating each +argument, this variable is set to those which have not yet been +evaluated. It can be used to 'pop' arguments to prevent them from +being evaluated, which is useful when those arguments contain +arbitrary data. + * Editing Changes in Emacs 30.1 diff --git a/etc/emacsclient-mail.desktop b/etc/emacsclient-mail.desktop index 0a2420ddead..5962fa1764c 100644 --- a/etc/emacsclient-mail.desktop +++ b/etc/emacsclient-mail.desktop @@ -1,10 +1,7 @@ [Desktop Entry] 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=$(echo "$1" | sed 's/[\"]/\\&/g'); exec emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"$u\")" -# Special chars '"', '$', and '\' must be escaped as '\\"', '\\$', and '\\\\'. -Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u +Exec=emacsclient --alternate-editor= --eval '(message-mailto (pop server-eval-args-left))' %u Icon=emacs Name=Emacs (Mail, Client) MimeType=x-scheme-handler/mailto; @@ -16,7 +13,7 @@ Actions=new-window;new-instance; [Desktop Action new-window] Name=New Window -Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --create-frame --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u +Exec=emacsclient --alternate-editor= --create-frame --eval '(message-mailto (pop server-eval-args-left))' %u [Desktop Action new-instance] Name=New Instance diff --git a/lisp/server.el b/lisp/server.el index c3325e5a24c..3970d7a7e81 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1189,6 +1189,7 @@ server-process-filter parent-id ; Window ID for XEmbed dontkill ; t if client should not be killed. commands + evalexprs dir use-current-frame frame-parameters ;parameters for newly created frame @@ -1319,8 +1320,7 @@ server-process-filter (let ((expr (pop args-left))) (if coding-system (setq expr (decode-coding-string expr coding-system))) - (push (lambda () (server-eval-and-print expr proc)) - commands) + (push expr evalexprs) (setq filepos nil))) ;; -env NAME=VALUE: An environment variable. @@ -1345,7 +1345,7 @@ server-process-filter ;; arguments, use an existing frame. (and nowait (not (eq tty-name 'window-system)) - (or files commands) + (or files commands evalexprs) (setq use-current-frame t)) (setq frame @@ -1394,7 +1394,7 @@ server-process-filter (let ((default-directory (if (and dir (file-directory-p dir)) dir default-directory))) - (server-execute proc files nowait commands + (server-execute proc files nowait commands evalexprs dontkill frame tty-name))))) (when (or frame files) @@ -1404,22 +1404,35 @@ server-process-filter ;; condition-case (t (server-return-error proc err)))) -(defun server-execute (proc files nowait commands dontkill frame tty-name) +(defvar server-eval-args-left nil + "List of eval args not yet processed. + +Adding or removing strings from this variable while the Emacs +server is processing a series of eval requests will affect what +Emacs evaluates. + +See also `argv' for a similar variable which works for +invocations of \"emacs\".") + +(defun server-execute (proc files nowait commands evalexprs dontkill frame tty-name) ;; This is run from timers and process-filters, i.e. "asynchronously". ;; But w.r.t the user, this is not really asynchronous since the timer ;; is run after 0s and the process-filter is run in response to the ;; user running `emacsclient'. So it is OK to override the - ;; inhibit-quit flag, which is good since `commands' (as well as + ;; inhibit-quit flag, which is good since `evalexprs' (as well as ;; find-file-noselect via the major-mode) can run arbitrary code, ;; including code that needs to wait. (with-local-quit (condition-case err (let ((buffers (server-visit-files files proc nowait))) (mapc 'funcall (nreverse commands)) + (let ((server-eval-args-left (nreverse evalexprs))) + (while server-eval-args-left + (server-eval-and-print (pop server-eval-args-left) proc))) ;; If we were told only to open a new client, obey ;; `initial-buffer-choice' if it specifies a file ;; or a function. - (unless (or files commands) + (unless (or files commands evalexprs) (let ((buf (cond ((stringp initial-buffer-choice) (find-file-noselect initial-buffer-choice)) diff --git a/lisp/startup.el b/lisp/startup.el index 7f601668369..f2c84751211 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -120,7 +120,10 @@ command-switch-alist "List of command-line args not yet processed. This is a convenience alias, so that one can write (pop argv) inside of --eval command line arguments in order to access -following arguments.")) +following arguments. + +See also `server-eval-args-left' for a similar variable which +works for invocations of \"emacsclient --eval\".")) (internal-make-var-non-special 'argv) (defvar command-line-args-left nil -- 2.41.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 21 11:20:49 2023 Received: (at 65902) by debbugs.gnu.org; 21 Oct 2023 15:20:49 +0000 Received: from localhost ([127.0.0.1]:44891 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quDmT-0001UZ-72 for submit@debbugs.gnu.org; Sat, 21 Oct 2023 11:20:49 -0400 Received: from s.wrqvtbkv.outbound-mail.sendgrid.net ([149.72.123.24]:30200) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quDmQ-0001UI-Et for 65902@debbugs.gnu.org; Sat, 21 Oct 2023 11:20:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=from:subject:in-reply-to:references:mime-version:to:cc:content-type: content-transfer-encoding:cc:content-type:from:subject:to; s=s1; bh=7pTPxYGjG2OlUtV/6GlE/C6Z5PXkPQ3tU8HOoKQB+7o=; b=Q6tWGVcX/WlxpiE1rayxLh/H4N5budS9opvqiahYcu7XjGmpl6OcAgZdUUaBibkUF7ET Laxhq4HhTUp5GFfybdSBPjB/STgyQ8D5/7e490sWpzkCvrefPs4h3Wq2my2zdThkoGkPPB 2uFPme1Jmwp6tIGYiPj5qowoIXSqiXQF4VDo5SqVl+UXDXnuV0g7PjV+O3ED7w/qXoFuhV ugnZSbLF3SBBU4IZ6if+P4wtsN2es9teau8YGR6KdSQt6Oyq0iQXWfv4b6yXW00LFmxkCP 6tCnbWDLHpu3d8qAt0/XLj+RuUY4EAukkrlVWn9fYjviJglH3E1UUa3oBw1A4BUQ== Received: by filterdrecv-655bd866f5-x7rtn with SMTP id filterdrecv-655bd866f5-x7rtn-1-6533EC2C-1D 2023-10-21 15:20:12.94124689 +0000 UTC m=+333553.812821162 Received: from earth.catern.com (unknown) by geopod-ismtpd-38 (SG) with ESMTP id xJktrVFISeGfOngwyFZBTw Sat, 21 Oct 2023 15:20:12.888 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost; envelope-from=sbaugh@catern.com; receiver=gnu.org Received: from localhost (localhost [IPv6:::1]) by earth.catern.com (Postfix) with ESMTPSA id 76CFC63610; Sat, 21 Oct 2023 11:20:12 -0400 (EDT) From: sbaugh@catern.com Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <87wmwfps9s.fsf@catern.com> (sbaugh@catern.com's message of "Sun, 24 Sep 2023 14:20:16 +0000 (UTC)") References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> <835y4290kf.fsf@gnu.org> <87zg1cprix.fsf@catern.com> <83a5tc4096.fsf@gnu.org> <87wmwfps9s.fsf@catern.com> Date: Sat, 21 Oct 2023 15:20:12 +0000 (UTC) Message-ID: <87o7gsroib.fsf@catern.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbLjt7P1ZuQ7kSTQDNQDBT?= =?us-ascii?Q?J0gPh4h9LTVQYhn77OWtqaxoh1m4dcr1r1XmyhZ?= =?us-ascii?Q?3wrQLf5L4VMkfzNS0nkt+RGV9gBBg6EkYvgscFQ?= =?us-ascii?Q?U0EIELgCTzjfWTkxSE=2Fu5fjFq5QcTcHMi1nuTLk?= =?us-ascii?Q?pl60Ih8LpVDBPpdciFD73URuqQREpXeUJ=2FA=3D=3D?= To: Eli Zaretskii X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, jporterbugs@gmail.com, sbaugh@janestreet.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.2 (/) Any remaining concerns about this patch? It would be nice to install it. From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 22 01:27:45 2023 Received: (at 65902) by debbugs.gnu.org; 22 Oct 2023 05:27:45 +0000 Received: from localhost ([127.0.0.1]:45382 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quR04-0000qf-W8 for submit@debbugs.gnu.org; Sun, 22 Oct 2023 01:27:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38172) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quR01-0000qS-U0 for 65902@debbugs.gnu.org; Sun, 22 Oct 2023 01:27:43 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1quQzT-0002Uq-Gv; Sun, 22 Oct 2023 01:27:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=zmiTO2nS6G492+ORnrZKdv240D1ePVIO5aMJGMBF8Qo=; b=QMjeF2FeWZbT uqfbPNSb6BNW9ugc2BoenQ/D6L0pwSaoAIrJvXddGcziz4AoTNpDOOzRwAldmvHkBH8IMa76eCwYn qFTRglEsI7mZRhot2ts/1bfZnNwCOaFwONfuF8Bh5cQQ5RYDO+M/NMhYrN97dnb1MSafQGNVsNI8w /7zF6trRln0vhanAdJRcoIzoTKhTRW8qNk09H67mv2EdNwtiM64meXXBl6d7gq2y39QpBOuON0YfF Nhydh4EYBId5sLlW23xbETXHe7lMankvbSFGhQqbePVyNuupgVFMC2EJIyxvCTM+uMKcfPpZ/lPNI HMaBMY1yTu4/wMxMo+cAtg==; Date: Sun, 22 Oct 2023 08:27:07 +0300 Message-Id: <83wmvfp6qc.fsf@gnu.org> From: Eli Zaretskii To: sbaugh@catern.com In-Reply-To: <87o7gsroib.fsf@catern.com> (sbaugh@catern.com) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> <835y4290kf.fsf@gnu.org> <87zg1cprix.fsf@catern.com> <83a5tc4096.fsf@gnu.org> <87wmwfps9s.fsf@catern.com> <87o7gsroib.fsf@catern.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, jporterbugs@gmail.com, sbaugh@janestreet.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: sbaugh@catern.com > Date: Sat, 21 Oct 2023 15:20:13 +0000 (UTC) > Cc: jporterbugs@gmail.com, sbaugh@janestreet.com, 65902@debbugs.gnu.org > > > Any remaining concerns about this patch? It would be nice to install > it. It no longer applies, so please rebase and repost. TIA. From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 22 01:40:05 2023 Received: (at 65902) by debbugs.gnu.org; 22 Oct 2023 05:40:05 +0000 Received: from localhost ([127.0.0.1]:45392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quRBw-0001Eo-Jn for submit@debbugs.gnu.org; Sun, 22 Oct 2023 01:40:05 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:49422) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quRBp-0001EU-3s for 65902@debbugs.gnu.org; Sun, 22 Oct 2023 01:39:58 -0400 Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-27d3c886671so1924735a91.3 for <65902@debbugs.gnu.org>; Sat, 21 Oct 2023 22:39:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697953159; x=1698557959; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=qH4z31VWSJPpryD/M0GPUSV8IYl+6jvq4Qn8VU2clyk=; b=j4hpP/R8pPZUsdoc5Kva7xw2pkMEak/1oIbkLdhOCYHHOlZs3roBlPpoLgCiuQTV1l XHdoVpUCDu85H0lQTR45MYeU/C9aiX5ctCS8BhrGHj1GiEABfqf8+3p7KmxOIS6gQcWa YLIXrAAdx0qU849JfCc/WpFuTeJDotzsU1xXdzQByzaGGKQ7sT2kVzxUxhVzJ2+oYtF1 GBSQjL8CTCGZJNgB1OwnQa4AEidRg719LtN28t0Jf2Dfwg5+xMP1xl0NN+aQc0FtoEoy 7DDWU7uSQ1pCY3Yr58rxac0U1PpdLhV4Ia07GAn8pbNdvtj9aPPFA2lg87yH/AbnH4UE RXJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697953159; x=1698557959; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qH4z31VWSJPpryD/M0GPUSV8IYl+6jvq4Qn8VU2clyk=; b=o8PlVVYcJ0fv98Aw5ylOiCmiySTaruv/oziOAi9mded2r52D4w8mtsfDG8dNsSSC4u zEtAzhS0PpWaGahK1srF+Fg4fnXOSSFgSHHOqjxYig+mHNzgXpth6HiMgq0rgwuSQ1m8 66n5BBJ37AfUYajgo92OiG4GaSYWNAo0s3DbjHq2KF8l6wguo8mlTCpI3Kqlp+tsxXGW NFctYmPbnxMscySD5l+pJeB91zhrOY8R6VY8EMmiV4HWaoW9gaNSmfuNVxIVcATQqIYi Rj4Kq8rulKrBAfmoRP9spGEYP8QiSXJL8kPlOnOthERQYofVccyVP91KIQ7wVcxi9Tzs Jd+g== X-Gm-Message-State: AOJu0YxQHBAUMJYXeXLe+lExtv8xvU2thG/++5STF/Q3VbeVwTz7jt9e hbCxBw5fEwjY4eZ100MGJhY= X-Google-Smtp-Source: AGHT+IH6jTJ15GSVB2P/HpCiz3KKTTlwj88fUbYjRuhFTT7p7S0K5mfz5rLv+b4xc9Yj3w6oAKh8bA== X-Received: by 2002:a17:902:e745:b0:1c7:7e00:8075 with SMTP id p5-20020a170902e74500b001c77e008075mr6611299plf.66.1697953158822; Sat, 21 Oct 2023 22:39:18 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id jw13-20020a170903278d00b001c9bfd20d0csm3942879plb.124.2023.10.21.22.39.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 21 Oct 2023 22:39:18 -0700 (PDT) Message-ID: Date: Sat, 21 Oct 2023 22:39:18 -0700 MIME-Version: 1.0 Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping To: sbaugh@catern.com, Eli Zaretskii References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> <835y4290kf.fsf@gnu.org> <87zg1cprix.fsf@catern.com> <83a5tc4096.fsf@gnu.org> <87wmwfps9s.fsf@catern.com> <87o7gsroib.fsf@catern.com> Content-Language: en-US From: Jim Porter In-Reply-To: <87o7gsroib.fsf@catern.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, sbaugh@janestreet.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 10/21/2023 8:20 AM, sbaugh@catern.com wrote: > > Any remaining concerns about this patch? It would be nice to install > it. From my perspective, I'm happy with this change. Thanks for all the effort on seeing this through. From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 22 10:16:34 2023 Received: (at 65902) by debbugs.gnu.org; 22 Oct 2023 14:16:34 +0000 Received: from localhost ([127.0.0.1]:47888 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quZFq-0004pC-02 for submit@debbugs.gnu.org; Sun, 22 Oct 2023 10:16:34 -0400 Received: from s.wrqvtbkv.outbound-mail.sendgrid.net ([149.72.123.24]:48384) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quZFm-0004oj-16 for 65902@debbugs.gnu.org; Sun, 22 Oct 2023 10:16:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=from:subject:in-reply-to:references:mime-version:to:cc:content-type: cc:content-type:from:subject:to; s=s1; bh=jQLNs2iRB4KD4/MZ9B7vkQsl8B/A37IC++EUIZxIxZg=; b=ipJnmnlRlJuyWYn7aZ0ELcByKidR7UX//3Ahu3bOMrCIc4+5hKD/qak2dSSJEJtV8FJ2 TiFfmyG8xbwUCUa1GJSB+dHOCLvmSCe9LdNYkk5d3xNvYnVphWZujD69wCrvgoA6filQ87 biOmvDgtHreISktEE0ane5qYwKtqy0mf4lv1G9/wMnGGmX65BZx51TS43N7DXLmZWjwoL4 GeCN1Gt4vmT2x9/DrVZiuERTsfyaE/57JranLTNYbGBo8N1WFAJkPGkkMuQXv54Qv2CiIc S/8iREzwPkrECzPVV2/YcGm7/iha0MlfSfMB/V/KBYtR0sM9D9m7PspbF14yUyVA== Received: by filterdrecv-656b5b4c75-gb89s with SMTP id filterdrecv-656b5b4c75-gb89s-1-65352E9B-39 2023-10-22 14:15:55.974235587 +0000 UTC m=+416164.770985231 Received: from earth.catern.com (unknown) by geopod-ismtpd-38 (SG) with ESMTP id SRabVXRNRrG8n573dIBiug Sun, 22 Oct 2023 14:15:55.923 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost; envelope-from=sbaugh@catern.com; receiver=gnu.org Received: from localhost (localhost [IPv6:::1]) by earth.catern.com (Postfix) with ESMTPSA id 67E20601BB; Sun, 22 Oct 2023 10:15:55 -0400 (EDT) From: sbaugh@catern.com Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <83wmvfp6qc.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 22 Oct 2023 08:27:07 +0300") References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> <835y4290kf.fsf@gnu.org> <87zg1cprix.fsf@catern.com> <83a5tc4096.fsf@gnu.org> <87wmwfps9s.fsf@catern.com> <87o7gsroib.fsf@catern.com> <83wmvfp6qc.fsf@gnu.org> Date: Sun, 22 Oct 2023 14:15:56 +0000 (UTC) Message-ID: <87h6mispyc.fsf@catern.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbIIVfzbSmzC1C+qGg9ULP?= =?us-ascii?Q?ihHJANLyM5ZQMB217rMLZpxt5DgEVhblVoGtebl?= =?us-ascii?Q?qfkGOA9h5JCM2biaOm2Ymxk1b72AZFoPAMKm+hQ?= =?us-ascii?Q?NWlOWZFhTjmAkVz3XF2BTANAHzuuj44dOsGKvEz?= =?us-ascii?Q?cH5iv6PipPw1MRUt0Ce=2FrRZhX5U9KO4nmqA=3D=3D?= To: Eli Zaretskii X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 65902 Cc: 65902@debbugs.gnu.org, sbaugh@janestreet.com, jporterbugs@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.5 (-) --=-=-= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Eli Zaretskii writes: >> From: sbaugh@catern.com >> Date: Sat, 21 Oct 2023 15:20:13 +0000 (UTC) >> Cc: jporterbugs@gmail.com, sbaugh@janestreet.com, 65902@debbugs.gnu.org >> >> >> Any remaining concerns about this patch? It would be nice to install >> it. > > It no longer applies, so please rebase and repost. TIA. Rebased --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Add-server-eval-args-left-to-server.el.patch >From bd49b918e57363593660f605c3e0efc3d0155c2b Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Thu, 21 Sep 2023 21:35:50 -0400 Subject: [PATCH] Add server-eval-args-left to server.el Passing arbitrary arguments to functions through emacsclient --eval requires complicated escaping to avoid them being parsed as Lisp (as seen in emacsclient-mail.desktop before this change). This new variable server-eval-args-left allows access to the arguments before they are parsed as Lisp. By removing arguments from the variable before they're parsed, a snippet of Lisp can consume arguments, as in emacsclient-mail.desktop. org-protocol might be able to use this as well, which might allow it to drop its current advice on server-visit-files. * etc/emacsclient-mail.desktop: Use server-eval-args-left. (bug#65902) * lisp/server.el (server-eval-args-left): Add. (server-process-filter, server-execute): Make -eval arguments available through server-eval-args-left. * lisp/startup.el (argv): Mention server-eval-args-left in docstring. * etc/NEWS: Announce server-eval-args-left. * doc/emacs/misc.texi (emacsclient Options): Document server-eval-args-left. --- doc/emacs/misc.texi | 9 +++++++++ etc/NEWS | 10 ++++++++++ etc/emacsclient-mail.desktop | 7 ++----- lisp/server.el | 27 ++++++++++++++++++++------- lisp/startup.el | 5 ++++- 5 files changed, 45 insertions(+), 13 deletions(-) diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 7a88b7ef5e0..1ce1713b01c 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -2078,6 +2078,15 @@ emacsclient Options @command{emacsclient} are interpreted as a list of expressions to evaluate, @emph{not} as a list of files to visit. +@vindex server-eval-args-left +If you have arbitrary data which you want to provide as input to one +of your expressions, you can pass the data as another argument to +@command{emacsclient} and use @var{server-eval-args-left} in the +expression to access the data. Be careful to have your expression +remove the data from @var{server-eval-args-left} regardless of whether +your code succeeds, such as by using @code{pop}, otherwise Emacs will +attempt to evaluate the data as a Lisp expression. + @item -f @var{server-file} @itemx --server-file=@var{server-file} Specify a server file (@pxref{TCP Emacs server}) for connecting to an diff --git a/etc/NEWS b/etc/NEWS index cd4c414a64c..de1d79fcb98 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -121,6 +121,16 @@ Anything following the symbol 'mode-line-format-right-align' in right-aligned to is controlled by the new user option 'mode-line-right-align-edge'. +** Emacs Server and Client + +--- +*** 'server-eval-args-left' can be used to pop subsequent eval args +When '--eval' is passed to emacsclient and Emacs is evaluating each +argument, this variable is set to those which have not yet been +evaluated. It can be used to 'pop' arguments to prevent them from +being evaluated, which is useful when those arguments contain +arbitrary data. + * Editing Changes in Emacs 30.1 diff --git a/etc/emacsclient-mail.desktop b/etc/emacsclient-mail.desktop index 0a2420ddead..5962fa1764c 100644 --- a/etc/emacsclient-mail.desktop +++ b/etc/emacsclient-mail.desktop @@ -1,10 +1,7 @@ [Desktop Entry] 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=$(echo "$1" | sed 's/[\"]/\\&/g'); exec emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"$u\")" -# Special chars '"', '$', and '\' must be escaped as '\\"', '\\$', and '\\\\'. -Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u +Exec=emacsclient --alternate-editor= --eval '(message-mailto (pop server-eval-args-left))' %u Icon=emacs Name=Emacs (Mail, Client) MimeType=x-scheme-handler/mailto; @@ -16,7 +13,7 @@ Actions=new-window;new-instance; [Desktop Action new-window] Name=New Window -Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --create-frame --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u +Exec=emacsclient --alternate-editor= --create-frame --eval '(message-mailto (pop server-eval-args-left))' %u [Desktop Action new-instance] Name=New Instance diff --git a/lisp/server.el b/lisp/server.el index c3325e5a24c..3970d7a7e81 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1189,6 +1189,7 @@ server-process-filter parent-id ; Window ID for XEmbed dontkill ; t if client should not be killed. commands + evalexprs dir use-current-frame frame-parameters ;parameters for newly created frame @@ -1319,8 +1320,7 @@ server-process-filter (let ((expr (pop args-left))) (if coding-system (setq expr (decode-coding-string expr coding-system))) - (push (lambda () (server-eval-and-print expr proc)) - commands) + (push expr evalexprs) (setq filepos nil))) ;; -env NAME=VALUE: An environment variable. @@ -1345,7 +1345,7 @@ server-process-filter ;; arguments, use an existing frame. (and nowait (not (eq tty-name 'window-system)) - (or files commands) + (or files commands evalexprs) (setq use-current-frame t)) (setq frame @@ -1394,7 +1394,7 @@ server-process-filter (let ((default-directory (if (and dir (file-directory-p dir)) dir default-directory))) - (server-execute proc files nowait commands + (server-execute proc files nowait commands evalexprs dontkill frame tty-name))))) (when (or frame files) @@ -1404,22 +1404,35 @@ server-process-filter ;; condition-case (t (server-return-error proc err)))) -(defun server-execute (proc files nowait commands dontkill frame tty-name) +(defvar server-eval-args-left nil + "List of eval args not yet processed. + +Adding or removing strings from this variable while the Emacs +server is processing a series of eval requests will affect what +Emacs evaluates. + +See also `argv' for a similar variable which works for +invocations of \"emacs\".") + +(defun server-execute (proc files nowait commands evalexprs dontkill frame tty-name) ;; This is run from timers and process-filters, i.e. "asynchronously". ;; But w.r.t the user, this is not really asynchronous since the timer ;; is run after 0s and the process-filter is run in response to the ;; user running `emacsclient'. So it is OK to override the - ;; inhibit-quit flag, which is good since `commands' (as well as + ;; inhibit-quit flag, which is good since `evalexprs' (as well as ;; find-file-noselect via the major-mode) can run arbitrary code, ;; including code that needs to wait. (with-local-quit (condition-case err (let ((buffers (server-visit-files files proc nowait))) (mapc 'funcall (nreverse commands)) + (let ((server-eval-args-left (nreverse evalexprs))) + (while server-eval-args-left + (server-eval-and-print (pop server-eval-args-left) proc))) ;; If we were told only to open a new client, obey ;; `initial-buffer-choice' if it specifies a file ;; or a function. - (unless (or files commands) + (unless (or files commands evalexprs) (let ((buf (cond ((stringp initial-buffer-choice) (find-file-noselect initial-buffer-choice)) diff --git a/lisp/startup.el b/lisp/startup.el index 7f601668369..f2c84751211 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -120,7 +120,10 @@ command-switch-alist "List of command-line args not yet processed. This is a convenience alias, so that one can write (pop argv) inside of --eval command line arguments in order to access -following arguments.")) +following arguments. + +See also `server-eval-args-left' for a similar variable which +works for invocations of \"emacsclient --eval\".")) (internal-make-var-non-special 'argv) (defvar command-line-args-left nil -- 2.41.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 22 12:10:14 2023 Received: (at 65902) by debbugs.gnu.org; 22 Oct 2023 16:10:15 +0000 Received: from localhost ([127.0.0.1]:47947 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qub1q-0000A0-Ds for submit@debbugs.gnu.org; Sun, 22 Oct 2023 12:10:14 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:35112) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qub1n-00009q-5t for 65902@debbugs.gnu.org; Sun, 22 Oct 2023 12:10:12 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4SD3Dh6z5bz1r2Z3; Sun, 22 Oct 2023 18:09:40 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 4SD3Dh4cxNz1qqlS; Sun, 22 Oct 2023 18:09:40 +0200 (CEST) X-Virus-Scanned: amavis at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavis, port 10024) with ESMTP id ny8-Tth_oCFP; Sun, 22 Oct 2023 18:09:38 +0200 (CEST) X-Auth-Info: Nj7eGiApFQKSg/QoBcBL6C3wKf3FQA+Ldlr/ekcYV5IWA6tzc6esTD9F1FxTfnR3 Received: from igel.home (aftr-62-216-205-174.dynamic.mnet-online.de [62.216.205.174]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sun, 22 Oct 2023 18:09:38 +0200 (CEST) Received: by igel.home (Postfix, from userid 1000) id 6BB682C12E9; Sun, 22 Oct 2023 18:09:38 +0200 (CEST) From: Andreas Schwab To: sbaugh@catern.com Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <87h6mispyc.fsf@catern.com> (sbaugh@catern.com's message of "Sun, 22 Oct 2023 14:15:56 +0000 (UTC)") References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> <835y4290kf.fsf@gnu.org> <87zg1cprix.fsf@catern.com> <83a5tc4096.fsf@gnu.org> <87wmwfps9s.fsf@catern.com> <87o7gsroib.fsf@catern.com> <83wmvfp6qc.fsf@gnu.org> <87h6mispyc.fsf@catern.com> X-Yow: PIZZA!! Date: Sun, 22 Oct 2023 18:09:38 +0200 Message-ID: <87h6mimyf1.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 3.1 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: On Okt 22 2023, sbaugh@catern.com wrote: > +Exec=emacsclient --alternate-editor= --eval '(message-mailto (pop server-eval-args-left))' %u This line is not valid according to the specs. Content analysis details: (3.1 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [62.216.205.174 listed in zen.spamhaus.org] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.18.0.9 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [212.18.0.9 listed in wl.mailspike.net] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-Debbugs-Envelope-To: 65902 Cc: jporterbugs@gmail.com, 65902@debbugs.gnu.org, Eli Zaretskii , sbaugh@janestreet.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 2.1 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: On Okt 22 2023, sbaugh@catern.com wrote: > +Exec=emacsclient --alternate-editor= --eval '(message-mailto (pop server-eval-args-left))' %u This line is not valid according to the specs. Content analysis details: (2.1 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [62.216.205.174 listed in zen.spamhaus.org] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.18.0.9 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [212.18.0.9 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager On Okt 22 2023, sbaugh@catern.com wrote: > +Exec=emacsclient --alternate-editor= --eval '(message-mailto (pop server-eval-args-left))' %u This line is not valid according to the specs. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 22 15:53:53 2023 Received: (at 65902) by debbugs.gnu.org; 22 Oct 2023 19:53:54 +0000 Received: from localhost ([127.0.0.1]:48259 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1queWH-0006rJ-LW for submit@debbugs.gnu.org; Sun, 22 Oct 2023 15:53:53 -0400 Received: from s.wrqvtbkv.outbound-mail.sendgrid.net ([149.72.123.24]:37502) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1queWD-0006r0-3u for 65902@debbugs.gnu.org; Sun, 22 Oct 2023 15:53:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=from:subject:in-reply-to:references:mime-version:to:cc:content-type: content-transfer-encoding:cc:content-type:from:subject:to; s=s1; bh=eLaiZjrKkm1IWJtRrs2MR7TqDOsN3ipzZGlNp5tNwXc=; b=Jd/dG4VE7qrPxkmalLobyCLVnctSHcB48NzzHif1lrvLQ3KJuB+VhluIuje6FglGmfaf MfJblyVZFcv0v+TmlB/cMoghz1AYosI9Z2N89QuoseL3SFAwU1+MbiSo57R1jmTvY4yUm2 w9bmDREYif5V6WuTeah5mFO6wQVVSUV/i5J4F3APCouvcxCLqxhnx4lpxQQY1QN7ZrQYRa hRvClkeKXD15PYkaWr+GpB3GanYCn90PAnZWYQrcrdCXDW2hoS6MlP8Rin991/jDUpdJNE gzy2qcjfSYYdboB8a+0SU0FjC/x3z/X1mamur0K/0lVWSjkE82Y+HmEscX2cd40w== Received: by filterdrecv-5bbdbb56cd-hwvxf with SMTP id filterdrecv-5bbdbb56cd-hwvxf-1-65357DAB-A 2023-10-22 19:53:15.143036544 +0000 UTC m=+436404.358018831 Received: from earth.catern.com (unknown) by geopod-ismtpd-8 (SG) with ESMTP id W5qd2r9mTESgbYXRnIXJpw Sun, 22 Oct 2023 19:53:15.111 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost; envelope-from=sbaugh@catern.com; receiver=linux-m68k.org Received: from localhost (localhost [IPv6:::1]) by earth.catern.com (Postfix) with ESMTPSA id B5AA36360E; Sun, 22 Oct 2023 15:53:14 -0400 (EDT) From: sbaugh@catern.com Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <87h6mimyf1.fsf@igel.home> (Andreas Schwab's message of "Sun, 22 Oct 2023 18:09:38 +0200") References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> <835y4290kf.fsf@gnu.org> <87zg1cprix.fsf@catern.com> <83a5tc4096.fsf@gnu.org> <87wmwfps9s.fsf@catern.com> <87o7gsroib.fsf@catern.com> <83wmvfp6qc.fsf@gnu.org> <87h6mispyc.fsf@catern.com> <87h6mimyf1.fsf@igel.home> Date: Sun, 22 Oct 2023 19:53:15 +0000 (UTC) Message-ID: <87cyx6sac5.fsf@catern.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbI9tHSYvm7h+uB9x4ux0S?= =?us-ascii?Q?pt8gBuBZqoK2T+e1D2PIlFvqXLsdRZRmVtfEUUs?= =?us-ascii?Q?XeQydxlApC1OR0VwpYbAc1o+tLUSXLZUCpIJwjP?= =?us-ascii?Q?eo=2FiqYiuOvqFF5KAl2LjnFICDfJHDlQYuk+nLeg?= =?us-ascii?Q?HyM9w2T7dzAvpzbi2+KZWgknzw5r7cvb=2Fnw=3D=3D?= To: Andreas Schwab X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: 65902 Cc: jporterbugs@gmail.com, Eli Zaretskii , sbaugh@janestreet.com, 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.2 (/) Andreas Schwab writes: > On Okt 22 2023, sbaugh@catern.com wrote: > >> +Exec=emacsclient --alternate-editor= --eval '(message-mailto (pop server-eval-args-left))' %u > > This line is not valid according to the specs. Is that because of the single quotes surrounding spaces? Are quoted strings not permitted? Would the following be valid: Exec=emacsclient --alternate-editor= --eval '(message-mailto)' %u or perhaps Exec=emacsclient --alternate-editor= --eval (message-mailto) %u That's easily achievable. From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 23 12:39:19 2023 Received: (at 65902) by debbugs.gnu.org; 23 Oct 2023 16:39:19 +0000 Received: from localhost ([127.0.0.1]:51444 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quxxX-0003EX-5q for submit@debbugs.gnu.org; Mon, 23 Oct 2023 12:39:19 -0400 Received: from mail-out.m-online.net ([2001:a60:0:28:0:1:25:1]:44265) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quxxS-0003EK-SQ for 65902@debbugs.gnu.org; Mon, 23 Oct 2023 12:39:18 -0400 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4SDgql4tfvz1sDfp; Mon, 23 Oct 2023 18:38:43 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 4SDgql1sTGz1qqlS; Mon, 23 Oct 2023 18:38:43 +0200 (CEST) X-Virus-Scanned: amavis at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavis, port 10024) with ESMTP id b41wCFGuF8Ui; Mon, 23 Oct 2023 18:38:42 +0200 (CEST) X-Auth-Info: n/Qg9LmwgMEcE5S9kj2UAcam/gVhm2FltlQaHqXwuRrrN76728lhTITtCh8UnMbA Received: from igel.home (aftr-62-216-205-174.dynamic.mnet-online.de [62.216.205.174]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Mon, 23 Oct 2023 18:38:42 +0200 (CEST) Received: by igel.home (Postfix, from userid 1000) id 2B8272C1318; Mon, 23 Oct 2023 18:38:42 +0200 (CEST) From: Andreas Schwab To: sbaugh@catern.com Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: <87cyx6sac5.fsf@catern.com> (sbaugh@catern.com's message of "Sun, 22 Oct 2023 19:53:15 +0000 (UTC)") References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> <835y4290kf.fsf@gnu.org> <87zg1cprix.fsf@catern.com> <83a5tc4096.fsf@gnu.org> <87wmwfps9s.fsf@catern.com> <87o7gsroib.fsf@catern.com> <83wmvfp6qc.fsf@gnu.org> <87h6mispyc.fsf@catern.com> <87h6mimyf1.fsf@igel.home> <87cyx6sac5.fsf@catern.com> X-Yow: Remember, if you try to ESCAPE, many APARTMENT HOPPING ALCOHOLICS will SIMONIZE your HALLWAYS!! This is your LAST WARNING!! Date: Mon, 23 Oct 2023 18:38:42 +0200 Message-ID: <87y1ft70q5.fsf@igel.home> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 3.1 (+++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: All of them contain unquoted occurences of reserved characters. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." Content analysis details: (3.1 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [62.216.205.174 listed in zen.spamhaus.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2001:a60:0:28:0:1:25:1 listed in] [list.dnswl.org] X-Debbugs-Envelope-To: 65902 Cc: jporterbugs@gmail.com, Eli Zaretskii , sbaugh@janestreet.com, 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 2.1 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: All of them contain unquoted occurences of reserved characters. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." Content analysis details: (2.1 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 3.6 RCVD_IN_SBL_CSS RBL: Received via a relay in Spamhaus SBL-CSS [62.216.205.174 listed in zen.spamhaus.org] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [2001:a60:0:28:0:1:25:1 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager All of them contain unquoted occurences of reserved characters. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 23 12:52:55 2023 Received: (at 65902) by debbugs.gnu.org; 23 Oct 2023 16:52:55 +0000 Received: from localhost ([127.0.0.1]:51473 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quyAh-0003ek-0a for submit@debbugs.gnu.org; Mon, 23 Oct 2023 12:52:55 -0400 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:45511) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1quyAf-0003eX-E1 for 65902@debbugs.gnu.org; Mon, 23 Oct 2023 12:52:54 -0400 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1c9c5a1b87bso21296125ad.3 for <65902@debbugs.gnu.org>; Mon, 23 Oct 2023 09:52:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698079938; x=1698684738; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=JdSTWLrhD/QFSMPFlpRNj1BsSd1Zkmk71VGV1R9ryIE=; b=kZAN/FO9ZZeI/qBOzeFTsdV5bHJuvfPmjFMO4OmAtKDFXi1fXibj9l34ghmhLnDoGG NkbCbLqizwR0MlsPocHxMX/OHpAhotcyFtOWEDhFHyUsqXslV1Lmg4EsLbBakUHLsYEd hXp06VegEinlO8XfASihLVOU17FhH4pgRDQmVsmXTnDw8018V+8sQMDHXGuRznZ1Wrzk 3ZanNg3Q7ZCs8IDI6T9AmH/ooUqZhzXWANpwSbuZ1pBndcA+BjEmpaas0r3DmGOXuR6k tbW2U1hJ0JQRH5SOi14ZhPaJeJBG6mAfwMR260rneuiK66BlncelGezgkBHjxfO5ZMqL Hfyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698079938; x=1698684738; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=JdSTWLrhD/QFSMPFlpRNj1BsSd1Zkmk71VGV1R9ryIE=; b=D/Ef9wUTBqTIY1hzyzcoP7y5M/DUFMYMzzyBp9jU16MJKv/gYU9Zaf3kSksIlzgId4 FEVPrsLCGx39Zc407tnpg9zK8PSpijXG4ahEUSuB6/Ne7Jl4M2Mhb9laI/hUysMvQtwh wqKKpQWiyLg/dISLfUt2VfMmeLKwFjsXizd/QYfSPdVCrRdYurbLRsTbF2lx2C15c2CO tS7VKFJVNdINv45s2PGbh0wRrCVD6jXpLkT5wQ5z/Mc4+KGg0w9jHTGw5S0Zvo02nkz7 lldURKftyS7LDIR2KLusJAtlvI7wqrzMVJ9jOAp7og9hpjTtq0/f5Y42bVrXkPeJEs2f ahwA== X-Gm-Message-State: AOJu0YxmN5mkEQA1JoHjjWzWGLqag44KeyR8LWRkdH0kyFtpsWJY1ARO DcWMTztpbYaRSi8AHq3m9Po= X-Google-Smtp-Source: AGHT+IGUqEbLFZxJh+/AVbTN1V9hHD6+8DGdYJc7CWx9D53RGyVPzrF95K2mDUnmWTgS7yJqmd/z1w== X-Received: by 2002:a17:903:124e:b0:1c9:ea71:8032 with SMTP id u14-20020a170903124e00b001c9ea718032mr7834936plh.31.1698079938374; Mon, 23 Oct 2023 09:52:18 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id jk4-20020a170903330400b001c5fd2a28d3sm6116309plb.28.2023.10.23.09.52.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Oct 2023 09:52:17 -0700 (PDT) Message-ID: Date: Mon, 23 Oct 2023 09:52:19 -0700 MIME-Version: 1.0 Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping Content-Language: en-US To: sbaugh@catern.com, Andreas Schwab References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> <835y4290kf.fsf@gnu.org> <87zg1cprix.fsf@catern.com> <83a5tc4096.fsf@gnu.org> <87wmwfps9s.fsf@catern.com> <87o7gsroib.fsf@catern.com> <83wmvfp6qc.fsf@gnu.org> <87h6mispyc.fsf@catern.com> <87h6mimyf1.fsf@igel.home> <87cyx6sac5.fsf@catern.com> From: Jim Porter In-Reply-To: <87cyx6sac5.fsf@catern.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 65902 Cc: sbaugh@janestreet.com, Eli Zaretskii , 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 10/22/2023 12:53 PM, sbaugh@catern.com wrote: > Andreas Schwab writes: > >> On Okt 22 2023, sbaugh@catern.com wrote: >> >>> +Exec=emacsclient --alternate-editor= --eval '(message-mailto (pop server-eval-args-left))' %u >> >> This line is not valid according to the specs. > > Is that because of the single quotes surrounding spaces? Are quoted > strings not permitted? According to the spec[1], you should use double quotes instead: > Quoting must be done by enclosing the argument between double quotes and escaping the double quote character, backtick character ("`"), dollar sign ("$") and backslash character ("\") by preceding it with an additional backslash character. Otherwise, I think what you have above is ok. [1] https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s07.html From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 24 12:28:14 2023 Received: (at 65902) by debbugs.gnu.org; 24 Oct 2023 16:28:14 +0000 Received: from localhost ([127.0.0.1]:56516 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qvKGL-0005Qh-D7 for submit@debbugs.gnu.org; Tue, 24 Oct 2023 12:28:14 -0400 Received: from s.wrqvwxzv.outbound-mail.sendgrid.net ([149.72.154.232]:5416) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qvKGG-0005QR-SE for 65902@debbugs.gnu.org; Tue, 24 Oct 2023 12:28:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=from:subject:in-reply-to:references:mime-version:to:cc:content-type: cc:content-type:from:subject:to; s=s1; bh=9wJE/XPSHlRj0Ry94xUbicyHbMmApA/O/CC9akFL7Vo=; b=aNLFch3e0MzRThek5YFrTaNXdsTbSch1dNcsJgL+n5ezGlyJJrtkUQSuCRQZC+mZEIbA uZupCNlimwi/FSteaKPiyp40kUd80tX331/uY51i6ICtlkvBgypUIbXux2y8NUzsgytk5Z FvTRn5NLmYqfOA7eL0E2fBgBmKSequUTEqLG+ObVFTvh2XH+bDQaCCvB7fhJfI9O22V3lP /uEstvmu8zyyc39uP1P8EroE3WYVttd8dhPUvatX3XlACwAvexvLOeYHMAKp/uvAOEwpmc /mjsPoV8ZwWZ8c0BzHcT97Y8nY+e9qhppho18WJ92AdXw24PmK4qFS42nTLx1UMQ== Received: by filterdrecv-655bd866f5-w9hhg with SMTP id filterdrecv-655bd866f5-w9hhg-1-6537F075-2B 2023-10-24 16:27:33.587568757 +0000 UTC m=+596792.229216560 Received: from earth.catern.com (unknown) by geopod-ismtpd-6 (SG) with ESMTP id LlklUmIiTWubODRmcuU8gQ Tue, 24 Oct 2023 16:27:33.551 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost; envelope-from=sbaugh@catern.com; receiver=gmail.com Received: from localhost (localhost [IPv6:::1]) by earth.catern.com (Postfix) with ESMTPSA id 263786360E; Tue, 24 Oct 2023 12:27:33 -0400 (EDT) From: sbaugh@catern.com Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping In-Reply-To: (Jim Porter's message of "Mon, 23 Oct 2023 09:52:19 -0700") References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> <835y4290kf.fsf@gnu.org> <87zg1cprix.fsf@catern.com> <83a5tc4096.fsf@gnu.org> <87wmwfps9s.fsf@catern.com> <87o7gsroib.fsf@catern.com> <83wmvfp6qc.fsf@gnu.org> <87h6mispyc.fsf@catern.com> <87h6mimyf1.fsf@igel.home> <87cyx6sac5.fsf@catern.com> Date: Tue, 24 Oct 2023 16:27:33 +0000 (UTC) Message-ID: <87v8awq93f.fsf@catern.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-SG-EID: =?us-ascii?Q?ZgbRq7gjGrt0q=2FPjvxk7wM0yQFRdOkTJAtEbkjCkHbIvBvmWltcy4G24cWE8Mn?= =?us-ascii?Q?Xc84KAqMAEJXVGnT071Gywv=2Fv9AB3MqgmQ5rSxB?= =?us-ascii?Q?Qqn4n68zYpvu1IojUmCIBy=2FbYVEuevjfXGrajVj?= =?us-ascii?Q?LmriuK6qEG+xq3b61TSB8fLYvasGuLooAH=2FWJlQ?= =?us-ascii?Q?9Zod+WQ=2FfkCjT1TtXf7N2lJgvq2MqN1+Gxg=3D=3D?= To: Jim Porter X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Jim Porter writes: > On 10/22/2023 12:53 PM, sbaugh@catern.com wrote: >> Andreas Schwab writes: >> >>> On Okt 22 2023, sbaugh@catern.com wrote: >>> >>>> [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: linux-m68k.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net [Blocked - see ] 1.3 RCVD_IN_VALIDITY_RPBL RBL: Relay in Validity RPBL, https://senderscore.org/blocklistlookup/ [149.72.154.232 listed in bl.score.senderscore.com] -0.5 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [149.72.154.232 listed in wl.mailspike.net] 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-Debbugs-Envelope-To: 65902 Cc: sbaugh@janestreet.com, Eli Zaretskii , Andreas Schwab , 65902@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) --=-=-= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Jim Porter writes: > On 10/22/2023 12:53 PM, sbaugh@catern.com wrote: >> Andreas Schwab writes: >> >>> On Okt 22 2023, sbaugh@catern.com wrote: >>> >>>> +Exec=emacsclient --alternate-editor= --eval '(message-mailto (pop server-eval-args-left))' %u >>> >>> This line is not valid according to the specs. >> Is that because of the single quotes surrounding spaces? Are quoted >> strings not permitted? > > According to the spec[1], you should use double quotes instead: > >> Quoting must be done by enclosing the argument between double quotes and escaping the double quote character, backtick character ("`"), dollar sign ("$") and backslash character ("\") by preceding it with an additional backslash character. > > Otherwise, I think what you have above is ok. > > [1] > https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s07.html Thanks. OK, spec-compliant version: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Add-server-eval-args-left-to-server.el.patch >From 59d780f3297134d97cd39a8a4b0fb722d3d42765 Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Thu, 21 Sep 2023 21:35:50 -0400 Subject: [PATCH] Add server-eval-args-left to server.el Passing arbitrary arguments to functions through emacsclient --eval requires complicated escaping to avoid them being parsed as Lisp (as seen in emacsclient-mail.desktop before this change). This new variable server-eval-args-left allows access to the arguments before they are parsed as Lisp. By removing arguments from the variable before they're parsed, a snippet of Lisp can consume arguments, as in emacsclient-mail.desktop. org-protocol might be able to use this as well, which might allow it to drop its current advice on server-visit-files. * etc/emacsclient-mail.desktop: Use server-eval-args-left. (bug#65902) * lisp/server.el (server-eval-args-left): Add. (server-process-filter, server-execute): Make -eval arguments available through server-eval-args-left. * lisp/startup.el (argv): Mention server-eval-args-left in docstring. * etc/NEWS: Announce server-eval-args-left. * doc/emacs/misc.texi (emacsclient Options): Document server-eval-args-left. --- doc/emacs/misc.texi | 9 +++++++++ etc/NEWS | 10 ++++++++++ etc/emacsclient-mail.desktop | 7 ++----- lisp/server.el | 27 ++++++++++++++++++++------- lisp/startup.el | 5 ++++- 5 files changed, 45 insertions(+), 13 deletions(-) diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index d7168fa1ca0..9c7c5dcd5da 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -2078,6 +2078,15 @@ emacsclient Options @command{emacsclient} are interpreted as a list of expressions to evaluate, @emph{not} as a list of files to visit. +@vindex server-eval-args-left +If you have arbitrary data which you want to provide as input to one +of your expressions, you can pass the data as another argument to +@command{emacsclient} and use @var{server-eval-args-left} in the +expression to access the data. Be careful to have your expression +remove the data from @var{server-eval-args-left} regardless of whether +your code succeeds, such as by using @code{pop}, otherwise Emacs will +attempt to evaluate the data as a Lisp expression. + @item -f @var{server-file} @itemx --server-file=@var{server-file} Specify a server file (@pxref{TCP Emacs server}) for connecting to an diff --git a/etc/NEWS b/etc/NEWS index e6c47660522..75da416c5f3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -212,6 +212,16 @@ to enter the file you want to modify. It can be used to customize the look of the appointment notification displayed on the mode line when 'appt-display-mode-line' is non-nil. +** Emacs Server and Client + +--- +*** 'server-eval-args-left' can be used to pop subsequent eval args +When '--eval' is passed to emacsclient and Emacs is evaluating each +argument, this variable is set to those which have not yet been +evaluated. It can be used to 'pop' arguments to prevent them from +being evaluated, which is useful when those arguments contain +arbitrary data. + * Editing Changes in Emacs 30.1 diff --git a/etc/emacsclient-mail.desktop b/etc/emacsclient-mail.desktop index 0a2420ddead..4f7f00ebefd 100644 --- a/etc/emacsclient-mail.desktop +++ b/etc/emacsclient-mail.desktop @@ -1,10 +1,7 @@ [Desktop Entry] 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=$(echo "$1" | sed 's/[\"]/\\&/g'); exec emacsclient --alternate-editor= --display="$DISPLAY" --eval "(message-mailto \"$u\")" -# Special chars '"', '$', and '\' must be escaped as '\\"', '\\$', and '\\\\'. -Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --display=\\"\\$DISPLAY\\" --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u +Exec=emacsclient --alternate-editor= --eval "(message-mailto (pop server-eval-args-left))" %u Icon=emacs Name=Emacs (Mail, Client) MimeType=x-scheme-handler/mailto; @@ -16,7 +13,7 @@ Actions=new-window;new-instance; [Desktop Action new-window] Name=New Window -Exec=sh -c "u=\\$(echo \\"\\$1\\" | sed 's/[\\\\\\"]/\\\\\\\\&/g'); exec emacsclient --alternate-editor= --create-frame --eval \\"(message-mailto \\\\\\"\\$u\\\\\\")\\"" sh %u +Exec=emacsclient --alternate-editor= --create-frame --eval "(message-mailto (pop server-eval-args-left))" %u [Desktop Action new-instance] Name=New Instance diff --git a/lisp/server.el b/lisp/server.el index ce68e9aebc9..a2671165bfc 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1199,6 +1199,7 @@ server-process-filter parent-id ; Window ID for XEmbed dontkill ; t if client should not be killed. commands + evalexprs dir use-current-frame frame-parameters ;parameters for newly created frame @@ -1332,8 +1333,7 @@ server-process-filter (let ((expr (pop args-left))) (if coding-system (setq expr (decode-coding-string expr coding-system))) - (push (lambda () (server-eval-and-print expr proc)) - commands) + (push expr evalexprs) (setq filepos nil))) ;; -env NAME=VALUE: An environment variable. @@ -1358,7 +1358,7 @@ server-process-filter ;; arguments, use an existing frame. (and nowait (not (eq tty-name 'window-system)) - (or files commands) + (or files commands evalexprs) (setq use-current-frame t)) (setq frame @@ -1407,7 +1407,7 @@ server-process-filter (let ((default-directory (if (and dir (file-directory-p dir)) dir default-directory))) - (server-execute proc files nowait commands + (server-execute proc files nowait commands evalexprs dontkill frame tty-name))))) (when (or frame files) @@ -1417,22 +1417,35 @@ server-process-filter ;; condition-case (t (server-return-error proc err)))) -(defun server-execute (proc files nowait commands dontkill frame tty-name) +(defvar server-eval-args-left nil + "List of eval args not yet processed. + +Adding or removing strings from this variable while the Emacs +server is processing a series of eval requests will affect what +Emacs evaluates. + +See also `argv' for a similar variable which works for +invocations of \"emacs\".") + +(defun server-execute (proc files nowait commands evalexprs dontkill frame tty-name) ;; This is run from timers and process-filters, i.e. "asynchronously". ;; But w.r.t the user, this is not really asynchronous since the timer ;; is run after 0s and the process-filter is run in response to the ;; user running `emacsclient'. So it is OK to override the - ;; inhibit-quit flag, which is good since `commands' (as well as + ;; inhibit-quit flag, which is good since `evalexprs' (as well as ;; find-file-noselect via the major-mode) can run arbitrary code, ;; including code that needs to wait. (with-local-quit (condition-case err (let ((buffers (server-visit-files files proc nowait))) (mapc 'funcall (nreverse commands)) + (let ((server-eval-args-left (nreverse evalexprs))) + (while server-eval-args-left + (server-eval-and-print (pop server-eval-args-left) proc))) ;; If we were told only to open a new client, obey ;; `initial-buffer-choice' if it specifies a file ;; or a function. - (unless (or files commands) + (unless (or files commands evalexprs) (let ((buf (cond ((stringp initial-buffer-choice) (find-file-noselect initial-buffer-choice)) diff --git a/lisp/startup.el b/lisp/startup.el index 6329e3ea8d0..37843eab176 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -120,7 +120,10 @@ command-switch-alist "List of command-line args not yet processed. This is a convenience alias, so that one can write (pop argv) inside of --eval command line arguments in order to access -following arguments.")) +following arguments. + +See also `server-eval-args-left' for a similar variable which +works for invocations of \"emacsclient --eval\".")) (internal-make-var-non-special 'argv) (defvar command-line-args-left nil -- 2.41.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 29 08:21:56 2023 Received: (at 65902-done) by debbugs.gnu.org; 29 Oct 2023 12:21:56 +0000 Received: from localhost ([127.0.0.1]:40647 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qx4nk-0000rP-9b for submit@debbugs.gnu.org; Sun, 29 Oct 2023 08:21:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42648) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qx4ni-0000rC-GK for 65902-done@debbugs.gnu.org; Sun, 29 Oct 2023 08:21:55 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qx4n5-0007cJ-1G; Sun, 29 Oct 2023 08:21:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=+XSDIpzrxSGPlP28BfLFS+vnf6ZHBVg/AXqPWnZzSbU=; b=BktbtD6ZEBZY tDL3+5RMgey6AtaS/lgZ6yBlwFW0LeS88ganmoqkI8M67dJMOWo3lG9wiUCpr5/OmSJSupTsrh2KC RPylIv/uCcED2N4J2ZnGqQQkn9JRBVDg53hR3jpAJt9w+GHHMsCiNUt00GxQnTA/D9gx+wGbq4tXJ b3hmsi28mzdQGV1K3YbzDcP8Y+6iVvYevphVqG5h8f2k4WlwIv2QZOP6OAC1FPSjzXOcn+E0rEl+F Vo6SXmkWBWosHmYGNjghWLpOssDMl+YQtU6CNGNtX1nH59zGt3hINsCQYFiWwRMrNFVIfe81EWnUg 7oGwH/FHqTA0SzPx9twqjw==; Date: Sun, 29 Oct 2023 14:20:58 +0200 Message-Id: <83h6m9bowl.fsf@gnu.org> From: Eli Zaretskii To: sbaugh@catern.com In-Reply-To: <87v8awq93f.fsf@catern.com> (sbaugh@catern.com) Subject: Re: bug#65902: 29.0.92; emacsclient-mail.desktop fails due to complicated escaping References: <80d8aeb0-c9f1-410f-b83d-60f83ca5b3af@email.android.com> <83led8ls3z.fsf@gnu.org> <835y4ckkzu.fsf@gnu.org> <874jjnvvip.fsf@catern.com> <835y4290kf.fsf@gnu.org> <87zg1cprix.fsf@catern.com> <83a5tc4096.fsf@gnu.org> <87wmwfps9s.fsf@catern.com> <87o7gsroib.fsf@catern.com> <83wmvfp6qc.fsf@gnu.org> <87h6mispyc.fsf@catern.com> <87h6mimyf1.fsf@igel.home> <87cyx6sac5.fsf@catern.com> <87v8awq93f.fsf@catern.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 65902-done Cc: jporterbugs@gmail.com, 65902-done@debbugs.gnu.org, schwab@linux-m68k.org, sbaugh@janestreet.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: sbaugh@catern.com > Date: Tue, 24 Oct 2023 16:27:33 +0000 (UTC) > Cc: Andreas Schwab , sbaugh@janestreet.com, > Eli Zaretskii , 65902@debbugs.gnu.org > > Thanks. OK, spec-compliant version: Thanks, installed on master, and closing the bug. From unknown Sat Jun 21 10:40:09 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 26 Nov 2023 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator