unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 23453@debbugs.gnu.org, dgutov@yandex.ru
Subject: bug#23453: 25.0.93; dired-do-find-regexp does not work on Windows even after installing GNU find and grep
Date: Wed, 04 May 2016 21:14:35 +0000	[thread overview]
Message-ID: <CAFyQvY3qNwGsBSSY5SRDNDYuWXV0BuQ1ch3kf9xBkCAiGquYNQ@mail.gmail.com> (raw)
In-Reply-To: <CAFyQvY2_=hhPVv7h8xyCUzw_5Mb5c9t5QtaOPu0QXNiv4YymBg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2648 bytes --]

I have verified the below patch to solve this issue:
Can you please review/fix/commit as needed?

From a20c0f42dbbecb356b286875b684f01fd25c6ebb Mon Sep 17 00:00:00 2001
From: Kaushal Modi <kaushal.modi@gmail.com>
Date: Wed, 4 May 2016 17:06:44 -0400
Subject: [PATCH] Shell escape arguments for find cmd used by xref

* lisp/progmodes/xref.el (xref-collect-matches): When the dir has
  characters like spaces (e.g. /tmp/some dir/), those need to be escaped
  before passing it as an argument to the shell command like `find'.
  The escaping is done using `shell-quote-argument' (bug#23453).
---
 lisp/progmodes/xref.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 62cef23..ff87bc3 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -890,7 +890,7 @@ xref-collect-matches
          (grep-highlight-matches nil)
          (command (xref--rgrep-command (xref--regexp-to-extended regexp)
                                        files
-                                       (expand-file-name dir)
+                                       (shell-quote-argument
(expand-file-name dir))
                                        ignores))
          (buf (get-buffer-create " *xref-grep*"))
          (grep-re (caar grep-regexp-alist))
-- 
2.6.0.rc0.24.gec371ff




On Wed, May 4, 2016 at 4:24 PM Kaushal Modi <kaushal.modi@gmail.com> wrote:

> Oh, as it turns out, the bug is there but not related to not finding
> find/grep.
>
> It IS actually finding the find.exe and grep.exe correctly using the
> exec-path and/or (setenv "PATH" ..) hacks.
>
> The problem was that the file was in a path with spaces in it:
>
> C:\Users\kmodi\Desktop\_keep this folder empty\NEWS.txt
>
> When I try using `A' in dired with above file marked and search for
> "Emacs", I get "No matches for: Emacs". Note the spaces in the directory
> name: "_keep this folder empty"
>
> But when I copied NEWS.txt to C:\Users\kmodi\Desktop\NEWS.txt and then
> did the same "Emacs" search using `A' in dired, it worked!
>
> I can recreate this bug in RHEL too!
>
> (1) mkdir -p /tmp/some\ dir
> (2) Download http://git.savannah.gnu.org/cgit/emacs.git/plain/etc/NEWS as
> /tmp/some\ dir/NEWS.txt
> (3) In emacs -Q, use C-x d to open dired in /tmp/some\ dir/
> (4) Mark NEWS.txt using `m' key
> (5) Then I do `A' and search for "Emacs" (or probably anything else too)
> (6) You should get "No matches for: Emacs"
>
> Can you please rename the bug title to "25.0.93; dired-do-find-regexp
> does not work when path contains spaces"?
>
> Blocking bug?
> --
>
> --
> Kaushal Modi
>
-- 

-- 
Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 4572 bytes --]

  reply	other threads:[~2016-05-04 21:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-04 19:39 bug#23453: 25.0.93; dired-do-find-regexp does not work on Windows even after installing GNU find and grep Kaushal Modi
2016-05-04 19:49 ` Eli Zaretskii
2016-05-04 19:56   ` Kaushal Modi
2016-05-04 20:24     ` Kaushal Modi
2016-05-04 21:14       ` Kaushal Modi [this message]
2016-05-04 21:39         ` Kaushal Modi
2016-05-04 22:15           ` Dmitry Gutov
2016-05-04 22:30             ` Kaushal Modi
2016-05-05  1:18               ` Dmitry Gutov
2016-05-05 16:23                 ` Kaushal Modi
2016-05-05  2:44             ` Eli Zaretskii
2016-05-05  2:37     ` Eli Zaretskii
2016-05-05 16:36       ` Kaushal Modi
2016-05-05 16:52         ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=CAFyQvY3qNwGsBSSY5SRDNDYuWXV0BuQ1ch3kf9xBkCAiGquYNQ@mail.gmail.com \
    --to=kaushal.modi@gmail.com \
    --cc=23453@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=eliz@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).