GNU bug report logs - #50240
28.0.50; incorrect handling of ignore files in project-files

Previous Next

Package: emacs;

Reported by: Omar Polo <op <at> omarpolo.com>

Date: Sat, 28 Aug 2021 16:53:02 UTC

Severity: normal

Found in version 28.0.50

Fixed in version 28.1

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Omar Polo <op <at> omarpolo.com>, 50240 <at> debbugs.gnu.org
Subject: bug#50240: 28.0.50; incorrect handling of ignore files in project-files
Date: Sun, 29 Aug 2021 04:17:11 +0300
Hi!

On 28.08.2021 19:52, Omar Polo wrote:
> Hello,
> 
> I'm working on a custom VC backend and noticed something strange
> regarding the handling of ignore files in project-files: ignoring a file
> that has the same name of the project makes project-files return nil.
> 
> To reproduce:
> 
> 1. create a directory structure as follows:
> 
> 	mkdir /tmp/foo
> 	touch /tmp/foo/{foo,bar}
> 
> 2. define a trivial project:
> 
> 	(cl-defmethod project-roots ((_ (eql foo)))
> 	  '("/tmp/foo/"))
> 
> 	(cl-defmethod project-ignores ((_ (eql foo)) _)
> 	  '("foo"))
> 
> 3. invoke project-files
> 
> 	(project-files 'foo)
> 	;; => nil

> 
> This is because project--files-in-directory directory-file-name.  The
> find command build is
> 
> 	find -H /tmp/foo \( -path \*/foo \) -prune -o  -type f  -print0
> 
> and no files are found because are all pruned.

It might be doing the correct thing, depending on how we define the 
exact semantics of ignores. I guess it will really depend on how this is 
going to be to fix without breaking the previous advancements. ;-)

Try returning "./foo" instead of "foo". Would that work for you? Or does 
your usage require a more general fix?

> If I edit project--files-in-directory to use file-name-as-directory,
> then the command becomes
> 
> 	find -H /tmp/foo/ \( -path \*/foo \) -prune -o  -type f  -print0
> 	# note the final slash!
> 
> and project-files successfully returns the files
> 
> 	(project-files 'foo)
> 	;; => ("/tmp/foo/bar")
> 
>  From what I see, project.el used to call file-name-as-directory, but was
> changed to directory-file-name due to bug#48471 (which I can't reproduce
> with OpenBSD find.)

Yeah, for all I know it only happens with 'find' distributed with macOS. 
Which is unfortunate, since it's a relatively popular OS.

> NB: This is can't be reproduced using a vc-git or vc-hg backed project
> because project-files treats those backend specially.

Correct.




This bug report was last modified 3 years and 256 days ago.

Previous Next


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