Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cscope-index-files doesn't work with paths using whitespaces #14

Closed
andyjh92 opened this issue Jun 26, 2017 · 5 comments
Closed

cscope-index-files doesn't work with paths using whitespaces #14

andyjh92 opened this issue Jun 26, 2017 · 5 comments

Comments

@andyjh92
Copy link

Hi,

cscope-index-files doesn't work with paths using whitespaces. They should be enclosed in double quotes.

Regards,
Andy

cscope version: 20160628.2324

@dkogan
Copy link
Owner

dkogan commented Jul 18, 2017 via email

@bertogg
Copy link
Contributor

bertogg commented Aug 27, 2020

Hi, from the cscope(1) manual page:

Filenames  in the namefile that contain whitespace have to be
enclosed in "double quotes".   Inside  such  quoted  filenames,
any double-quote and backslash characters have to be escaped
by backslashes.

(this is from cscope version 15.9)

I tried this quick change to xcscope.el and I confirm that it works:

--- xcscope.el.orig     2020-08-27 12:59:35.756439407 +0200
+++ xcscope.el  2020-08-27 12:59:42.340456818 +0200
@@ -2736,7 +2736,7 @@
                     "(" "-type" "f" "-o" "-type" "l" ")"
 
                     ;; if we made it here, take the result
-                    "-print"))))
+                    "-printf" "\"%p\"\n"))))
 
     (let ((findcmds
            (concat "echo 'Creating list of files to index ...'\n"

This also removes all the annoying "cannot find file ..." that I was getting all the time.

Problems:

  • This works for white spaces but if the file name contains other special characters they would need to be escaped. I don't care about e.g double quotes or backslashes on file names (I think they are extremely rare), but white spaces are relatively common.
  • xcscope still cannot parse the output so if I use cscope-find-global-definition I get the results on the Emacs buffer but I cannot click on them ("File does not have expected format"). In my particular case I don't care so much about those files so my goal is simply to remove the "cannot find file" warnings.

@dkogan
Copy link
Owner

dkogan commented Aug 28, 2020 via email

@bertogg
Copy link
Contributor

bertogg commented Aug 28, 2020

I was having a closer look at this and I created a new patch that hopefully quotes all filenames correctly.

I gave it a try with files named one two.c , one"two"three.c and one\two.c and it seems to work fine now.

Now the index is generated correctly. If you search a symbol that is inside a file with a whitespace in the name cscope still complains a bit and does not work 100%, but at least it does work partially (that's a cscope bug, not a problem with the Emacs elisp file). Files with double quotes or backslashes seem to work fine.

See #23 for more details.

And here are related discussion for cscope: https://sourceforge.net/p/cscope/bugs/282/ and https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=579531

@dkogan
Copy link
Owner

dkogan commented Oct 25, 2020

This was merged a while back in b9bd846. Closing.

@dkogan dkogan closed this as completed Oct 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants