emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master cff2f46: Escape meta chars in commands processed by


From: Tino Calancha
Subject: [Emacs-diffs] master cff2f46: Escape meta chars in commands processed by shell
Date: Wed, 13 Jul 2016 04:53:04 +0000 (UTC)

branch: master
commit cff2f4606dfbc83f8e38a6b7a48eedcc47009a3b
Author: Tino Calancha <address@hidden>
Commit: Tino Calancha <address@hidden>

    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).
---
 lisp/progmodes/grep.el |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 2b44b58..f7f097b 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -543,7 +543,9 @@ This function is called from `compilation-filter-hook'."
   (let* ((host-id
          (intern (or (file-remote-p default-directory) "localhost")))
         (host-defaults (assq host-id grep-host-defaults-alist))
-        (defaults (assq nil grep-host-defaults-alist)))
+        (defaults (assq nil grep-host-defaults-alist))
+         (quot-braces (shell-quote-argument "{}"))
+         (quot-scolon (shell-quote-argument ";")))
     ;; There are different defaults on different hosts.  They must be
     ;; computed for every host once.
     (dolist (setting '(grep-command grep-template
@@ -637,9 +639,8 @@ This function is called from `compilation-filter-hook'."
                                     "")))
                         (cons
                          (if (eq grep-find-use-xargs 'exec-plus)
-                             (format "%s %s{} +" cmd0 null)
-                           (format "%s {} %s%s" cmd0 null
-                                   (shell-quote-argument ";")))
+                             (format "%s %s%s +" cmd0 null quot-braces)
+                           (format "%s %s %s%s" cmd0 quot-braces null 
quot-scolon))
                          (1+ (length cmd0)))))
                      (t
                       (format "%s . -type f -print | \"%s\" %s"
@@ -655,12 +656,11 @@ This function is called from `compilation-filter-hook'."
                         (format "%s <D> <X> -type f <F> -print0 | \"%s\" -0 %s"
                                 find-program xargs-program gcmd))
                        ((eq grep-find-use-xargs 'exec)
-                        (format "%s <D> <X> -type f <F> -exec %s {} %s%s"
-                                find-program gcmd null
-                                (shell-quote-argument ";")))
+                        (format "%s <D> <X> -type f <F> -exec %s %s %s%s"
+                                find-program gcmd quot-braces null 
quot-scolon))
                        ((eq grep-find-use-xargs 'exec-plus)
-                        (format "%s <D> <X> -type f <F> -exec %s %s{} +"
-                                find-program gcmd null))
+                        (format "%s <D> <X> -type f <F> -exec %s %s%s +"
+                                find-program gcmd null quot-braces))
                        (t
                         (format "%s <D> <X> -type f <F> -print | \"%s\" %s"
                                 find-program xargs-program gcmd))))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]