diff options
| author | Sean Whitton | 2022-01-26 14:13:00 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-01-26 14:16:40 +0100 |
| commit | afd1fdf6bb85600e6d7fafcdbff367c0f964a576 (patch) | |
| tree | 2a00071aeea36c0c95e996d70e4a9b168cbf1a67 /lisp/eshell | |
| parent | fc8875be071a2a7f32ce6ffc9d3d3511cab5f73b (diff) | |
| download | emacs-afd1fdf6bb85600e6d7fafcdbff367c0f964a576.tar.gz 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/eshell')
| -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 @@ | |||
| 30 | 30 | ||
| 31 | (require 'cl-lib) | 31 | (require 'cl-lib) |
| 32 | (require 'esh-arg) | 32 | (require 'esh-arg) |
| 33 | (require 'esh-cmd) | ||
| 33 | (require 'esh-io) | 34 | (require 'esh-io) |
| 34 | (require 'esh-util) | 35 | (require 'esh-util) |
| 35 | 36 | ||
| @@ -97,15 +98,21 @@ as though it were Eshell syntax." | |||
| 97 | (while (> bound (point)) | 98 | (while (> bound (point)) |
| 98 | (let* ((found | 99 | (let* ((found |
| 99 | (save-excursion | 100 | (save-excursion |
| 100 | (re-search-forward "['\"\\]" bound t))) | 101 | (re-search-forward |
| 102 | "\\(?:#?'\\|\"\\|\\\\\\)" bound t))) | ||
| 101 | (next (or (and found (match-beginning 0)) | 103 | (next (or (and found (match-beginning 0)) |
| 102 | bound))) | 104 | bound))) |
| 103 | (if (re-search-forward pat next t) | 105 | (if (re-search-forward pat next t) |
| 104 | (throw 'found (match-beginning 1)) | 106 | (throw 'found (match-beginning 1)) |
| 105 | (goto-char next) | 107 | (goto-char next) |
| 106 | (while (or (eshell-parse-backslash) | 108 | (while (or (eshell-parse-lisp-argument) |
| 109 | (eshell-parse-backslash) | ||
| 107 | (eshell-parse-double-quote) | 110 | (eshell-parse-double-quote) |
| 108 | (eshell-parse-literal-quote))))))))) | 111 | (eshell-parse-literal-quote))) |
| 112 | ;; Guard against an infinite loop if none of | ||
| 113 | ;; the parsers moved us forward. | ||
| 114 | (unless (or (> (point) next) (eobp)) | ||
| 115 | (forward-char 1)))))))) | ||
| 109 | (goto-char (if (and result go) (match-end 0) start)) | 116 | (goto-char (if (and result go) (match-end 0) start)) |
| 110 | result))) | 117 | result))) |
| 111 | (unless (or eshell-current-argument eshell-current-quoted) | 118 | (unless (or eshell-current-argument eshell-current-quoted) |