unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#48247: [PATCH] `project--files-in-directory' fails when directory contains spaces
@ 2021-05-05 23:10 Jim Porter
  2021-05-06 17:45 ` Dmitry Gutov
  0 siblings, 1 reply; 2+ messages in thread
From: Jim Porter @ 2021-05-05 23:10 UTC (permalink / raw)
  To: 48247

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

The following happens on Emacs 28.0.50 (or when project.el 0.6.0 has
been installed via GNU ELPA).

Steps to reproduce:

  mkdir "some project"
  cd "some project"
  echo "foobar" > file.txt
  emacs -Q
  C-u C-x p g foo RET RET RET RET

Result:

  project--files-in-directory: File listing failed: find:
‘/home/jim/some’: No such file or directory
  find: ‘project/’: No such file or directory

I think the directory passed to `find' should be shell-quoted. See the
attached patch.

[-- Attachment #2: 0001-Shell-quote-the-directory-when-finding-a-project-s-f.patch --]
[-- Type: application/octet-stream, Size: 1271 bytes --]

From 0eb74cafbc8abdabdca49bf35879b8cadc92aa26 Mon Sep 17 00:00:00 2001
From: Jim Porter <jporterbugs@gmail.com>
Date: Wed, 5 May 2021 16:05:25 -0700
Subject: [PATCH] Shell-quote the directory when finding a project's files

* lisp/progmodes/project.el (project--files-in-directory): Shell-quote the
directory.
---
 lisp/progmodes/project.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index d47d9d77e6..94a4af78e1 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -299,8 +299,9 @@ project--files-in-directory
          (localdir (file-name-unquote (file-local-name (expand-file-name dir))))
          (command (format "%s %s %s -type f %s -print0"
                           find-program
-                          ;; In case DIR is a symlink.
-                          (file-name-as-directory localdir)
+                          (shell-quote-argument
+                           ;; In case DIR is a symlink.
+                           (file-name-as-directory localdir))
                           (xref--find-ignores-arguments ignores localdir)
                           (if files
                               (concat (shell-quote-argument "(")
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#48247: [PATCH] `project--files-in-directory' fails when directory contains spaces
  2021-05-05 23:10 bug#48247: [PATCH] `project--files-in-directory' fails when directory contains spaces Jim Porter
@ 2021-05-06 17:45 ` Dmitry Gutov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Gutov @ 2021-05-06 17:45 UTC (permalink / raw)
  To: Jim Porter, 48247-done

On 06.05.2021 02:10, Jim Porter wrote:
> I think the directory passed to `find' should be shell-quoted. See the
> attached patch.

Installed. Thanks!





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-06 17:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-05 23:10 bug#48247: [PATCH] `project--files-in-directory' fails when directory contains spaces Jim Porter
2021-05-06 17:45 ` Dmitry Gutov

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).