unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Nikander via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Dmitry Gutov <dmitry@gutov.dev>
Cc: 62735-done@debbugs.gnu.org
Subject: bug#62735: 30.0.50; project.el project-search errors because project-files returns directories
Date: Sun, 9 Apr 2023 17:25:07 -0600	[thread overview]
Message-ID: <EED299F2-36A4-425C-B605-7303E2DEDC59@icloud.com> (raw)
In-Reply-To: <8ff8a1a3-a307-39e5-00c1-0934acbef058@gutov.dev>

Hi Dmitry,

I don’t think it’s a submodule anymore. The directory does have a .git folder in it though (like a submodule). The directory was simply copied into the project tree like that, as part of moving it between projects. There is no '.gitmodules' file anywhere. So my guess is this bug was being triggered by the mere existence of the .git directory nested a few layers down in my project. That .git directory is not going to stay there, it’s going to get deleted, but of course it still shouldn’t crash the emacs command.

Rob

> On Apr 9, 2023, at 5:15 PM, Dmitry Gutov <dmitry@gutov.dev> wrote:
> 
> Version: 29.1
> 
> Hi!
> 
> On 09/04/2023 00:45, Robert Nikander via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote:
>> Hi,
>> I tried to run the command `project-search`, documented in "29.2.1 Project Commands That Operate on Files”. It threw an error because it tried to process a directory. The backtrace from debugger is below.
>> The function defined right below `project-search` in project.el is `project-query-replace-regexp`. It has this comment and line:
>>     ;; XXX: Filter out Git submodules, which are not regular files.
>>     ;; `project-files' can return those, which is arguably suboptimal,
>>     ;; but removing them eagerly has performance cost.
>>     (cl-delete-if-not #'file-regular-p (project-files (project-current t)))
>> I added the same to `project-search` and it seems to have “fixed” it. I don’t know how `project-files` works, but probably it would be better to fix that.
>> This directory “…/SomeDir/“ has a .git directory inside it. That appears to be why project-files picked it up, because deleting that .git subdir also avoids the error. But projects should be able to have nested .git directories, depending on how the ‘project’ is defined.
> 
> Thanks for the report. Am I correct to understand that the directory is a submodule? This is the main case which triggers this problem that I know about.
> 
> I've pushed a similar fix just like you suggested. 'project-search' should be okay now.
> 
> Note that 'project-find-regexp' (bound to 'C-x p g' by default) is usually a more efficient command to use rather than 'project-search' -- faster, works remotely, etc. But it has a very different interface.






  reply	other threads:[~2023-04-09 23:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-08 21:45 bug#62735: 30.0.50; project.el project-search errors because project-files returns directories Robert Nikander via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-04-09 23:15 ` Dmitry Gutov
2023-04-09 23:25   ` Robert Nikander via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-04-09 23:32     ` 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=EED299F2-36A4-425C-B605-7303E2DEDC59@icloud.com \
    --to=bug-gnu-emacs@gnu.org \
    --cc=62735-done@debbugs.gnu.org \
    --cc=dmitry@gutov.dev \
    --cc=robert.nikander@icloud.com \
    /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).