Subject: Re: bug#55016: 28.1; xref-find-references finds no matches if project dir contains a space

From: Eli Zaretskii <[email-masked]>
Date: Tue, 19 Apr 2022 10:13:31 +0300

> From: Peter Povinec <[email-masked]>
> Date: Mon, 18 Apr 2022 21:52:49 -0700
> 
> Here is a contrived scenario to reproduce the issue:
> 1. create two symlinks like
> ln -s ~/Applications/Emacs.app/Contents/Resources/lisp/progmodes
> ~/space\ dir
> ln -s ~/Applications/Emacs.app/Contents/Resources/lisp/progmodes
> ~/nospacedir
> 2. C-x C-f ~/space dir/xref.el
> 3. M-? on xref-location-marker, specify default project and default
> directory ~/space dir
> 4. Observe "No references found for: xref-location-marker"
> 5. Close the xref.el buffer with C-x k
> 6. Repeat steps 2-3, but using  ~/nospacedir instead
> 7. Observe that references are shown correctly

I'm running half-blind here, because you didn't tell which Xref
backend is being used for this (do you have ID Utils or GNU Global or
Cscope installed and used for the above recipe?).  My guess is that
Emacs uses the default "find | grep" to do the search, in which case
the patch below should help; does it?

diff --git a/lisp/cedet/semantic/symref/grep.el b/lisp/cedet/semantic/symref/grep.el
index 27ea80f..bc96505 100644
--- a/lisp/cedet/semantic/symref/grep.el
+++ b/lisp/cedet/semantic/symref/grep.el
@@ -124,7 +124,7 @@ semantic-symref-grep-use-template
                  grep-find-template)
                pattern
                filepattern
-               rootdir)))
+               (shell-quote-argument rootdir))))
     cmd))
 
 (defcustom semantic-symref-grep-shell shell-file-name