GNU bug report logs - #62735
30.0.50; project.el project-search errors because project-files returns directories

Previous Next

Package: emacs;

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 #10 received at 62735-done <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Robert Nikander <robert.nikander <at> icloud.com>, 62735-done <at> debbugs.gnu.org
Subject: Re: bug#62735: 30.0.50; project.el project-search errors because
 project-files returns directories
Date: Mon, 10 Apr 2023 02:15:29 +0300
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 99 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.