GNU bug report logs -
#62735
30.0.50; project.el project-search errors because project-files returns directories
Previous Next
Reported by: Robert Nikander <robert.nikander <at> icloud.com>
Date: Sun, 9 Apr 2023 04:12:03 UTC
Severity: normal
Found in version 30.0.50
Fixed in version 29.1
Done: Dmitry Gutov <dmitry <at> gutov.dev>
Bug is archived. No further changes may be made.
Full log
Message #13 received at 62735-done <at> debbugs.gnu.org (full text, mbox):
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 <at> 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.
This bug report was last modified 2 years and 100 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.