From: Jim Porter <jporterbugs@gmail.com>
To: 48247@debbugs.gnu.org
Subject: bug#48247: [PATCH] `project--files-in-directory' fails when directory contains spaces
Date: Wed, 5 May 2021 16:10:03 -0700 [thread overview]
Message-ID: <CANh=_JEAMT=uSpR49Vp6kgSZ5hrkUDN-5gQerwirzKxEgKxzaQ@mail.gmail.com> (raw)
[-- 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
next reply other threads:[~2021-05-05 23:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-05 23:10 Jim Porter [this message]
2021-05-06 17:45 ` bug#48247: [PATCH] `project--files-in-directory' fails when directory contains spaces Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CANh=_JEAMT=uSpR49Vp6kgSZ5hrkUDN-5gQerwirzKxEgKxzaQ@mail.gmail.com' \
--to=jporterbugs@gmail.com \
--cc=48247@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).