Subject: bug#33006: 27.0.50; `dired-do-find-regexp' doesn't work for remote directories

From: Michael Albinus <[email-masked]>
Date: Fri, 26 Oct 2018 17:18:03 +0200

Dmitry Gutov <[email-masked]> writes:

> Hi Michael,

Hi Dmitry,

> The patch doesn't look dangerous to me, so you can go ahead and
> install, thank you.

Thanks for reviewing.

> There is, however, a possible inconsistency: it touches
> xref--collect-matches-1, which is used both in xref-collect-matches
> and xref-collect-references. And you only changed the former function.
>
> Could you check that M-x xref-find-references didn't work on remote
> directories before your patch anyway? If it did, though, please make
> sure that it continues to do so.
>
> Bonus points for fixing it, at least when Grep is used (the relevant
> file is lisp/cedet/semantic/symref/grep.el).

It doesn't work, indeed. symref/grep.el isn't aware of remote processes
(it uses call-process, for example). I've fixed this with the appended
additional patch.

Is it OK now to commit?

Best regards, Michael.

diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el
index 93bda6ab29..661e101520 100644
--- a/lisp/cedet/semantic/symref/grep.el
+++ b/lisp/cedet/semantic/symref/grep.el
@@ -173,14 +173,16 @@ semantic-symref-grep-shell
 	  ;; find . -type f -print0 | xargs -0 -e grep -nH -e
 	  ;; Note : I removed -e as it is not posix, nor necessary it seems.
 
-	  (let ((cmd (concat "find " default-directory " -type f " filepattern " -print0 "
+	  (let ((cmd (concat "find " (file-local-name rootdir)
+                             " -type f " filepattern " -print0 "
 			     "| xargs -0 grep -H " grepflags "-e " greppat)))
 	    ;;(message "Old command: %s" cmd)
-	    (call-process semantic-symref-grep-shell nil b nil
+	    (process-file semantic-symref-grep-shell nil b nil
                           shell-command-switch cmd)
 	    )
-	(let ((cmd (semantic-symref-grep-use-template rootdir filepattern grepflags greppat)))
-	  (call-process semantic-symref-grep-shell nil b nil
+	(let ((cmd (semantic-symref-grep-use-template
+                    (file-local-name rootdir) filepattern grepflags greppat)))
+	  (process-file semantic-symref-grep-shell nil b nil
                         shell-command-switch cmd))
 	))
     (setq ans (semantic-symref-parse-tool-output tool b))