diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2022-01-26 14:13:00 +0100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-01-26 14:16:40 +0100 |
commit | afd1fdf6bb85600e6d7fafcdbff367c0f964a576 (patch) | |
tree | 2a00071aeea36c0c95e996d70e4a9b168cbf1a67 /lisp | |
parent | fc8875be071a2a7f32ce6ffc9d3d3511cab5f73b (diff) | |
download | emacs-afd1fdf6bb85600e6d7fafcdbff367c0f964a576.tar.gz emacs-afd1fdf6bb85600e6d7fafcdbff367c0f964a576.tar.bz2 emacs-afd1fdf6bb85600e6d7fafcdbff367c0f964a576.zip |
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).
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/eshell/em-extpipe.el | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/eshell/em-extpipe.el b/lisp/eshell/em-extpipe.el index 57aeec38ff6..eb5b3bfe1df 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) |