diff options
| author | Tino Calancha | 2016-07-13 13:27:33 +0900 |
|---|---|---|
| committer | Tino Calancha | 2016-07-13 13:27:33 +0900 |
| commit | cff2f4606dfbc83f8e38a6b7a48eedcc47009a3b (patch) | |
| tree | 92195d2cee232c7be9c53997cdd83475d5ff5dd5 | |
| parent | 54b7eb0dee2397f1430e81b7356f8efb19946ba0 (diff) | |
| download | emacs-cff2f4606dfbc83f8e38a6b7a48eedcc47009a3b.tar.gz emacs-cff2f4606dfbc83f8e38a6b7a48eedcc47009a3b.zip | |
Escape meta chars in commands processed by shell
* lisp/progmodes/grep.el (grep-compute-defaults): Quote braces
in all commands to be passed to a shell (Bug#23959).
| -rw-r--r-- | lisp/progmodes/grep.el | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 2b44b58f245..f7f097b6beb 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el | |||
| @@ -543,7 +543,9 @@ This function is called from `compilation-filter-hook'." | |||
| 543 | (let* ((host-id | 543 | (let* ((host-id |
| 544 | (intern (or (file-remote-p default-directory) "localhost"))) | 544 | (intern (or (file-remote-p default-directory) "localhost"))) |
| 545 | (host-defaults (assq host-id grep-host-defaults-alist)) | 545 | (host-defaults (assq host-id grep-host-defaults-alist)) |
| 546 | (defaults (assq nil grep-host-defaults-alist))) | 546 | (defaults (assq nil grep-host-defaults-alist)) |
| 547 | (quot-braces (shell-quote-argument "{}")) | ||
| 548 | (quot-scolon (shell-quote-argument ";"))) | ||
| 547 | ;; There are different defaults on different hosts. They must be | 549 | ;; There are different defaults on different hosts. They must be |
| 548 | ;; computed for every host once. | 550 | ;; computed for every host once. |
| 549 | (dolist (setting '(grep-command grep-template | 551 | (dolist (setting '(grep-command grep-template |
| @@ -637,9 +639,8 @@ This function is called from `compilation-filter-hook'." | |||
| 637 | ""))) | 639 | ""))) |
| 638 | (cons | 640 | (cons |
| 639 | (if (eq grep-find-use-xargs 'exec-plus) | 641 | (if (eq grep-find-use-xargs 'exec-plus) |
| 640 | (format "%s %s{} +" cmd0 null) | 642 | (format "%s %s%s +" cmd0 null quot-braces) |
| 641 | (format "%s {} %s%s" cmd0 null | 643 | (format "%s %s %s%s" cmd0 quot-braces null quot-scolon)) |
| 642 | (shell-quote-argument ";"))) | ||
| 643 | (1+ (length cmd0))))) | 644 | (1+ (length cmd0))))) |
| 644 | (t | 645 | (t |
| 645 | (format "%s . -type f -print | \"%s\" %s" | 646 | (format "%s . -type f -print | \"%s\" %s" |
| @@ -655,12 +656,11 @@ This function is called from `compilation-filter-hook'." | |||
| 655 | (format "%s <D> <X> -type f <F> -print0 | \"%s\" -0 %s" | 656 | (format "%s <D> <X> -type f <F> -print0 | \"%s\" -0 %s" |
| 656 | find-program xargs-program gcmd)) | 657 | find-program xargs-program gcmd)) |
| 657 | ((eq grep-find-use-xargs 'exec) | 658 | ((eq grep-find-use-xargs 'exec) |
| 658 | (format "%s <D> <X> -type f <F> -exec %s {} %s%s" | 659 | (format "%s <D> <X> -type f <F> -exec %s %s %s%s" |
| 659 | find-program gcmd null | 660 | find-program gcmd quot-braces null quot-scolon)) |
| 660 | (shell-quote-argument ";"))) | ||
| 661 | ((eq grep-find-use-xargs 'exec-plus) | 661 | ((eq grep-find-use-xargs 'exec-plus) |
| 662 | (format "%s <D> <X> -type f <F> -exec %s %s{} +" | 662 | (format "%s <D> <X> -type f <F> -exec %s %s%s +" |
| 663 | find-program gcmd null)) | 663 | find-program gcmd null quot-braces)) |
| 664 | (t | 664 | (t |
| 665 | (format "%s <D> <X> -type f <F> -print | \"%s\" %s" | 665 | (format "%s <D> <X> -type f <F> -print | \"%s\" %s" |
| 666 | find-program xargs-program gcmd)))))))) | 666 | find-program xargs-program gcmd)))))))) |