bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#23959: 25.0.94; find: missing argument to `-exec'


From: Eli Zaretskii
Subject: bug#23959: 25.0.94; find: missing argument to `-exec'
Date: Wed, 13 Jul 2016 17:45:00 +0300

> From: Tino Calancha <tino.calancha@gmail.com>
> Date: Wed, 13 Jul 2016 13:45:15 +0900 (JST)
> 
> 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 ";")))

But shell-quote-argument is not documented to support fish shell, is
it?  I think the problem is that the OP somehow sets up that shell as
the one used by Emacs when invoking shell commands, which is not a
recommended practice.

> -                           (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 

I'm not sure we can assume a quoted argument can be safely
concatenated to an unquoted one.  (Yes, I know the original code used
that for the semi-colon.)

I can't say I'm happy with this solution, sorry.  But thanks for
working on this problem.





reply via email to

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