[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master afd1fdf6bb: Fix input of sharp-quoted symbols in Eshell with em-e
From: |
Lars Ingebrigtsen |
Subject: |
master afd1fdf6bb: Fix input of sharp-quoted symbols in Eshell with em-extpipe |
Date: |
Wed, 26 Jan 2022 08:16:46 -0500 (EST) |
branch: master
commit afd1fdf6bb85600e6d7fafcdbff367c0f964a576
Author: Sean Whitton <spwhitton@spwhitton.name>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
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 (bug#53518).
---
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 @@ as though it were Eshell syntax."
(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 @@
(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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master afd1fdf6bb: Fix input of sharp-quoted symbols in Eshell with em-extpipe,
Lars Ingebrigtsen <=