From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <834madioy0.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113ce01c1643eb05320ab75b X-Trace: ger.gmane.org 1462396669 24332 80.91.229.3 (4 May 2016 21:17:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 4 May 2016 21:17:49 +0000 (UTC) Cc: 23453@debbugs.gnu.org, dgutov@yandex.ru To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 04 23:17:42 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ay4Av-0005J3-Mf for geb-bug-gnu-emacs@m.gmane.org; Wed, 04 May 2016 23:17:41 +0200 Original-Received: from localhost ([::1]:50340 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ay4Ar-0003Ut-Qf for geb-bug-gnu-emacs@m.gmane.org; Wed, 04 May 2016 17:17:37 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48666) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ay4AZ-00031O-7g for bug-gnu-emacs@gnu.org; Wed, 04 May 2016 17:17:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ay4AN-0003oN-1v for bug-gnu-emacs@gnu.org; Wed, 04 May 2016 17:17:13 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54261) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ay4AL-0003lZ-RT for bug-gnu-emacs@gnu.org; Wed, 04 May 2016 17:17:06 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ay4AI-00086c-GI for bug-gnu-emacs@gnu.org; Wed, 04 May 2016 17:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Kaushal Modi Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 04 May 2016 21:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23453 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org, dgutov@yandex.ru Original-Received: via spool by submit@debbugs.gnu.org id=B.146239657831090 (code B ref -1); Wed, 04 May 2016 21:17:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 May 2016 21:16:18 +0000 Original-Received: from localhost ([127.0.0.1]:38356 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ay49a-00085K-9y for submit@debbugs.gnu.org; Wed, 04 May 2016 17:16:18 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:57109) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ay49X-00084s-Lx for submit@debbugs.gnu.org; Wed, 04 May 2016 17:16:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ay49I-0003D8-B3 for submit@debbugs.gnu.org; Wed, 04 May 2016 17:16:07 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:51675) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ay49H-0003C8-30 for submit@debbugs.gnu.org; Wed, 04 May 2016 17:16:00 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ay494-0000yd-8P for bug-gnu-emacs@gnu.org; Wed, 04 May 2016 17:15:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ay48p-00035k-VZ for bug-gnu-emacs@gnu.org; Wed, 04 May 2016 17:15:38 -0400 Original-Received: from mail-oi0-x22f.google.com ([2607:f8b0:4003:c06::22f]:33419) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ay48c-0002e0-PA; Wed, 04 May 2016 17:15:20 -0400 Original-Received: by mail-oi0-x22f.google.com with SMTP id v145so81069973oie.0; Wed, 04 May 2016 14:14:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+VA+z4TlK4czOegsITDL/py7QH4lZjRFTL6SszA/B2A=; b=SLGaeKU0DzUJO0JbP9DuF3Te9DAkGQ+2LFFEuga7Y5IgHtlH7ghgTjtJD/7zNdlmu/ dLqsYYO6WUZBTTY1CSlxquCg20zDVL/uvJWQ34/rXmkxDx6zcxcGkxU5kMo1ROavFsqY 8lkmknEnVKJW6FsYy9wulz+r00L+/ZryzQomOnQAbajnRwy6gCIFs/OnBks3XJbLDCk3 efLWUQqkcFXEvDb/h1XB8o+ZdF5CCvLdmmSzasZfjy2bP/iSuexpjs50+HsmyvoLVMeI q34bQ+jtSJ7mkrPJRouC1NZnuho9NdudSghkScNGD2MYHFixsPJxw/qtluGyMgtTTtDq 5m1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+VA+z4TlK4czOegsITDL/py7QH4lZjRFTL6SszA/B2A=; b=hsV1m5aI9nOzDvBgoUMDcFFp7f7PZv8Pnz/5/yqNBazw8dFUhHMLeoJwRKbYt0oN6t 4bU/rIXjxCf8R+gUDxVHwVLfUoU9CO2YTmC9odPROhW/PT2ke5aBFG7nLYS5qG8HdFAF t0OYn7fNAg68C93a4pq3f3pJVFy4ew2Qo32oFrXXF312Pq/mid5wtMm9EvJ4bhJJPZF+ hbgk7ZXrGg4cY4twgEGOXSH7RB7l2/tqN4+bN8mJMeMee7iDOHiQgPXH7PLWHnKCOyIA iHFykPlHFk7tcKGImJcB63qR5sEWXpTetqq093Fj6VurnhWaaLiNf6PspvznEEJY5NEt xdZw== X-Gm-Message-State: AOPr4FX6qqu1onNiIEJuWPI2oeSnGCHpws/3V2Dj97NXjCmOtzoCmtoAtDVrF+FNpN6i/ktX0wmYoZghTTtSGw== X-Received: by 10.202.60.194 with SMTP id j185mr4715348oia.197.1462396486302; Wed, 04 May 2016 14:14:46 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:117803 Archived-At: --001a113ce01c1643eb05320ab75b Content-Type: text/plain; charset=UTF-8 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 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 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 --001a113ce01c1643eb05320ab75b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I have verified the below patch to solve this issue:
C= an you please review/fix/commit as needed?

Fr= om a20c0f42dbbecb356b286875b684f01fd25c6ebb Mon Sep 17 00:00:00 2001
<= div>From: Kaushal Modi <kausha= l.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): Whe= n the dir has
=C2=A0 characters like spaces (e.g. /tmp/some dir/)= , those need to be escaped
=C2=A0 before passing it as an argumen= t to the shell command like `find'.
=C2=A0 The escaping is do= ne using `shell-quote-argument' (bug#23453).
---
= =C2=A0lisp/progmodes/xref.el | 2 +-
=C2=A01 file changed, 1 inser= tion(+), 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.e= l
@@ -890,7 +890,7 @@ xref-collect-matches
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 (grep-highlight-matches nil)
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 (command (xref--rgrep-command (xref--regexp-to-ext= ended regexp)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 files
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 (expand-file-name dir)
+ =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (shell-quote-argument (expand-fil= e-name dir))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 ignores))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (buf (= get-buffer-create " *xref-grep*"))
=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 (grep-re (caar grep-regexp-alist))
--=C2=A0
<= div>2.6.0.rc0.24.gec371ff




On Wed, May 4, 2016 at 4:2= 4 PM Kaushal Modi <kaushal.mod= i@gmail.com> wrote:
Oh, as it turns out, the bug is there but not related to not findi= ng find/grep.

It IS actually finding the find.exe and gr= ep.exe correctly using the exec-path and/or (setenv "PATH" ..) ha= cks.

The problem was that the file was in a path w= ith spaces in it:

C:\Users\kmodi\Desktop\_keep thi= s folder empty\NEWS.txt

When I try using `A= 9; in dired with above file marked and search for "Emacs", I get = "No matches for: Emacs". Note the spaces in the directory name: &= quot;_keep this folder empty"

But when I copied NEWS.txt to=C2=A0C:\Users\kmodi\Desktop\NEWS.txt=C2=A0and then did the same "Emacs" search using `A= 9; in dired, it worked!
I can recreate this bug= in RHEL too!

<= /div>
(1) mkdir -p /tmp/some\ dir
(2) Download= =C2=A0http://git.savannah.gnu.org/cgit/emacs.git/plain/etc/NEW= S=C2=A0as /tmp/some\ dir/NEWS.txt
(3) In emacs -Q, use C-x d to open dired in=C2=A0/tmp/some\ dir/
(4) Mark NEWS.tx= t 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;=C2=A0dired-do-fin= d-regexp does not work when path contains spaces"?
Blocking bug?
--

--
Kaushal Modi

--

--
Kaushal Modi

--001a113ce01c1643eb05320ab75b--