[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#23959: 25.0.94; find: missing argument to `-exec'
From: |
Tino Calancha |
Subject: |
bug#23959: 25.0.94; find: missing argument to `-exec' |
Date: |
Wed, 13 Jul 2016 13:45:15 +0900 (JST) |
User-agent: |
Alpine 2.20 (DEB 67 2015-01-07) |
Thank you for the report.
I believe this is because the fish shell interprets the "{}" as a brace
expansion -- see
http://fishshell.com/docs/current/index.html#expand-brace -- and needs
the braces to be escaped. Editing the grep command using C-u and
inserting quotes around the braces makes it work as expected.
Yes, braces should be escaped in commands to be processed by a shell.
I am going to apply following patch to the master branch:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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 @@ grep-compute-defaults
(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 @@ grep-compute-defaults
"")))
(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 @@ grep-compute-defaults
(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))))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
In GNU Emacs 25.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.20.6)
of 2016-07-13
Repository revision: 54b7eb0dee2397f1430e81b7356f8efb19946ba0