all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: 23959@debbugs.gnu.org
Subject: bug#23959: 25.0.94; find: missing argument to `-exec'
Date: Wed, 13 Jul 2016 13:45:15 +0900 (JST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1607131337490.26858@calancha-pc> (raw)
In-Reply-To: <87r3ayodw4.fsf@betacantrips.com>


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






  reply	other threads:[~2016-07-13  4:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-12 19:27 bug#23959: 25.0.94; find: missing argument to `-exec' Ethan Glasser-Camp
2016-07-13  4:45 ` Tino Calancha [this message]
2016-07-13 14:45   ` Eli Zaretskii
2016-07-13  4:53 ` bug#23959: (no subject) Tino Calancha
2016-07-13 14:46   ` Eli Zaretskii
2016-07-13 14:52     ` Tino Calancha
2016-07-13 15:15       ` Eli Zaretskii
2016-07-13 15:55         ` Clément Pit--Claudel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.20.1607131337490.26858@calancha-pc \
    --to=tino.calancha@gmail.com \
    --cc=23959@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.