unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Sean Whitton <spwhitton@spwhitton.name>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 53518@debbugs.gnu.org, Michael Albinus <michael.albinus@gmx.de>,
	Jim Porter <jporterbugs@gmail.com>
Subject: bug#53518: 29.0.50; em-extpipe breaks input of sharp-quoted Lisp symbols
Date: Tue, 25 Jan 2022 09:48:16 -0700	[thread overview]
Message-ID: <875yq7223z.fsf@athena.silentflame.com> (raw)
In-Reply-To: <87sftcxap8.fsf@gnus.org>

[-- Attachment #1: Type: text/plain, Size: 348 bytes --]

Hello,

On Tue 25 Jan 2022 at 01:26pm +01, Lars Ingebrigtsen wrote:

> This leads to the following compilation warning:
>
>   ELC      eshell/em-extpipe.elc
> In end of data:
> eshell/em-extpipe.el:107:38: Warning: the function `eshell-parse-lisp-argument' is not known to be defined.

Apologies for this.  Here is a fixed patch.

-- 
Sean Whitton

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: v2-0001-Fix-input-of-sharp-quoted-symbols-in-Eshell-with-.patch --]
[-- Type: text/x-diff, Size: 3009 bytes --]

From 7981a5de5f06fd8879e57ac4d780370965999d7b Mon Sep 17 00:00:00 2001
From: Sean Whitton <spwhitton@spwhitton.name>
Date: Mon, 24 Jan 2022 22:39:15 -0700
Subject: [PATCH v2] Fix input of sharp-quoted symbols in Eshell with
 em-extpipe

* lisp/eshell/em-extpipe.el (eshell-parse-external-pipeline): Fix
misinterpreting sharp-quoted symbols as the beginning of single-quoted
strings (Bug#53518).  Add protection against a possible infinite loop.
* test/lisp/eshell/em-extpipe-tests.el (em-extpipe-test-17): New test.
---
 lisp/eshell/em-extpipe.el            | 13 ++++++++++---
 test/lisp/eshell/em-extpipe-tests.el |  4 ++++
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/lisp/eshell/em-extpipe.el b/lisp/eshell/em-extpipe.el
index 57aeec38ff..eb5b3bfe1d 100644
--- a/lisp/eshell/em-extpipe.el
+++ b/lisp/eshell/em-extpipe.el
@@ -30,6 +30,7 @@
 
 (require 'cl-lib)
 (require 'esh-arg)
+(require 'esh-cmd)
 (require 'esh-io)
 (require 'esh-util)
 
@@ -97,15 +98,21 @@ eshell-parse-external-pipeline
                    (while (> bound (point))
                      (let* ((found
                              (save-excursion
-                               (re-search-forward "['\"\\]" bound t)))
+                               (re-search-forward
+                                "\\(?:#?'\\|\"\\|\\\\\\)" bound t)))
                             (next (or (and found (match-beginning 0))
                                       bound)))
                        (if (re-search-forward pat next t)
                            (throw 'found (match-beginning 1))
                          (goto-char next)
-                         (while (or (eshell-parse-backslash)
+                         (while (or (eshell-parse-lisp-argument)
+                                    (eshell-parse-backslash)
                                     (eshell-parse-double-quote)
-                                    (eshell-parse-literal-quote)))))))))
+                                    (eshell-parse-literal-quote)))
+                         ;; Guard against an infinite loop if none of
+                         ;; the parsers moved us forward.
+                         (unless (or (> (point) next) (eobp))
+                           (forward-char 1))))))))
            (goto-char (if (and result go) (match-end 0) start))
            result)))
     (unless (or eshell-current-argument eshell-current-quoted)
diff --git a/test/lisp/eshell/em-extpipe-tests.el b/test/lisp/eshell/em-extpipe-tests.el
index 1283b6b361..0879ad5b0c 100644
--- a/test/lisp/eshell/em-extpipe-tests.el
+++ b/test/lisp/eshell/em-extpipe-tests.el
@@ -202,4 +202,8 @@ em-extpipe-test-16
       (eshell-command-result-p input "rab")
       (eshell-command-result-p "echo \"bar\" | rev" "nonsense"))))
 
+;; Confirm we don't break input of sharp-quoted symbols (Bug#53518).
+(em-extpipe-tests--deftest em-extpipe-test-17 "funcall #'upcase foo"
+  (eshell-command-result-p input "FOO"))
+
 ;;; em-extpipe-tests.el ends here
-- 
2.30.2


  reply	other threads:[~2022-01-25 16:48 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-06 20:06 bug#46351: 28.0.50; Add convenient way to bypass Eshell's own pipelining Sean Whitton
2021-02-07  9:17 ` Michael Albinus
2021-02-07 19:01   ` Sean Whitton
2021-02-08 10:28     ` Michael Albinus
2021-02-08 18:07       ` Sean Whitton
2021-02-10 11:33         ` Michael Albinus
2021-12-24 21:20       ` Sean Whitton
2021-12-25 13:51         ` Michael Albinus
2021-12-25 22:45           ` Sean Whitton
2021-12-27 14:42             ` Michael Albinus
2021-12-27 18:13               ` Sean Whitton
2021-12-27 18:22                 ` Eli Zaretskii
2021-12-27 19:21                   ` Sean Whitton
2021-12-27 19:35                     ` Eli Zaretskii
2021-12-27 19:53                       ` Sean Whitton
2021-12-27 19:37                     ` Michael Albinus
2021-12-27 19:54                       ` Sean Whitton
2021-12-28  8:58                         ` Michael Albinus
2022-01-18  5:19                           ` Sean Whitton
2022-01-18  9:49                             ` Robert Pluim
2022-01-18 18:27                               ` Sean Whitton
2022-01-18 14:45                             ` Eli Zaretskii
2022-01-18 18:40                               ` Sean Whitton
2022-01-18 19:38                                 ` Eli Zaretskii
2022-01-18 23:16                                   ` Sean Whitton
2022-01-19  7:34                                     ` Eli Zaretskii
2022-01-19 20:39                                       ` Sean Whitton
2022-01-20  6:53                                         ` Eli Zaretskii
2022-01-20 22:16                                           ` Sean Whitton
2022-01-21  6:54                                             ` Eli Zaretskii
2022-01-22  0:16                                               ` Sean Whitton
2022-01-18 18:42                               ` Sean Whitton
2022-01-19 15:52                             ` Michael Albinus
2022-01-19 20:54                               ` Sean Whitton
2022-01-20 18:41                                 ` Michael Albinus
2022-01-20 22:17                                   ` Sean Whitton
2022-01-23 22:39                             ` Sean Whitton
2022-01-24  9:55                               ` Lars Ingebrigtsen
2022-01-24 14:18                               ` Michael Albinus
2022-01-24 20:32                                 ` Sean Whitton
2022-01-24 20:44                                   ` Sean Whitton
2022-01-24 20:48                                     ` Lars Ingebrigtsen
2022-01-24 21:42                                       ` Sean Whitton
2022-01-24 21:51                                         ` Lars Ingebrigtsen
2022-01-24 22:48                                           ` Sean Whitton
2022-01-24 20:46                                   ` Lars Ingebrigtsen
2022-01-25  2:39                                     ` Jim Porter
2022-01-25  5:33                                       ` bug#53518: 29.0.50; em-extpipe breaks input of sharp-quoted Lisp symbols Sean Whitton
2022-01-25  8:50                                       ` Sean Whitton
2022-01-25 12:26                                         ` Lars Ingebrigtsen
2022-01-25 16:48                                           ` Sean Whitton [this message]
2022-01-26  5:38                                             ` Jim Porter
2022-01-26 13:13                                             ` Lars Ingebrigtsen
2022-01-25 18:14                                         ` Jim Porter
2022-01-25 20:01                                           ` Sean Whitton
2022-01-25 20:52                                             ` Jim Porter
2022-01-25 22:38                                               ` Sean Whitton
2022-01-25  8:54                                       ` bug#46351: 28.0.50; Add convenient way to bypass Eshell's own pipelining Michael Albinus
2022-01-25 18:22                                         ` Jim Porter
2021-12-27 18:26                 ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875yq7223z.fsf@athena.silentflame.com \
    --to=spwhitton@spwhitton.name \
    --cc=53518@debbugs.gnu.org \
    --cc=jporterbugs@gmail.com \
    --cc=larsi@gnus.org \
    --cc=michael.albinus@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).