all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#50240: 28.0.50; incorrect handling of ignore files in project-files
@ 2021-08-28 16:52 Omar Polo
  2021-08-29  1:17 ` Dmitry Gutov
  0 siblings, 1 reply; 6+ messages in thread
From: Omar Polo @ 2021-08-28 16:52 UTC (permalink / raw)
  To: 50240

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.

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.)

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

Thanks,


In GNU Emacs 28.0.50 (build 12, x86_64-unknown-openbsd7.0, X toolkit, cairo version 1.16.0, Xaw scroll bars)
 of 2021-08-23 built on venera
Windowing system distributor 'The X.Org Foundation', version 11.0.12010000
System Description: OpenBSD venera 7.0 GENERIC.MP#194 amd64

Configured using:
 'configure --prefix=/home/op/opt/emacs --with-x-toolkit=lucid CC=cc'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GNUTLS GSETTINGS HARFBUZZ JPEG JSON LCMS2
LIBOTF LIBXML2 M17N_FLT MODULES NOTIFY KQUEUE PDUMPER PNG RSVG THREADS
TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM LUCID ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
  semantic-minor-modes-format: ((:eval (if (or semantic-highlight-edits-mode semantic-show-unmatched-syntax-mode)  S)))
  nameless-mode: t
  whitespace-mode: t
  smartparens-strict-mode: t
  smartparens-mode: t
  checkdoc-minor-mode: t
  flymake-mode: t
  auto-insert-mode: t
  org-roam-db-autosync-mode: t
  global-edit-server-edit-mode: t
  shell-dirtrack-mode: t
  eros-mode: t
  show-paren-mode: t
  pdf-occur-global-minor-mode: t
  winner-mode: t
  shackle-mode: t
  corfu-global-mode: t
  corfu-mode: t
  selectrum-mode: t
  marginalia-mode: t
  global-form-feed-mode: t
  form-feed-mode: t
  recentf-mode: t
  savehist-mode: t
  save-place-mode: t
  override-global-mode: t
  straight-use-package-mode: t
  straight-package-neutering-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  prettify-symbols-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  auto-fill-function: do-auto-fill
  transient-mark-mode: t
  auto-save-visited-mode: t
  abbrev-mode: t
  hs-minor-mode: t

Load-path shadows:
~/.emacs.d/lisp/sndio.el/sndio hides /home/op/.emacs.d/lisp/sndio
/home/op/.emacs.d/straight/build/jsonrpc/jsonrpc hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/jsonrpc
/home/op/.emacs.d/straight/build/flymake/flymake hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/progmodes/flymake
/home/op/.emacs.d/straight/build/xref/xref hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/progmodes/xref
/home/op/.emacs.d/straight/build/project/project hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/progmodes/project
/home/op/.emacs.d/straight/build/org/ox-latex hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ox-latex
/home/op/.emacs.d/straight/build/org/ox-icalendar hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ox-icalendar
/home/op/.emacs.d/straight/build/org/org-inlinetask hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-inlinetask
/home/op/.emacs.d/straight/build/org/org-attach-git hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-attach-git
/home/op/.emacs.d/straight/build/org/org-attach hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-attach
/home/op/.emacs.d/straight/build/org/ol-gnus hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ol-gnus
/home/op/.emacs.d/straight/build/org/ol-eww hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ol-eww
/home/op/.emacs.d/straight/build/org/ol-docview hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ol-docview
/home/op/.emacs.d/straight/build/org/ob-processing hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-processing
/home/op/.emacs.d/straight/build/org/ob-matlab hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-matlab
/home/op/.emacs.d/straight/build/org/ob-gnuplot hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-gnuplot
/home/op/.emacs.d/straight/build/org/ob-eshell hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-eshell
/home/op/.emacs.d/straight/build/org/ob-dot hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-dot
/home/op/.emacs.d/straight/build/org/ob-asymptote hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-asymptote
/home/op/.emacs.d/straight/build/org/ox-org hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ox-org
/home/op/.emacs.d/straight/build/org/ox-publish hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ox-publish
/home/op/.emacs.d/straight/build/org/ox-odt hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ox-odt
/home/op/.emacs.d/straight/build/org/ox-texinfo hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ox-texinfo
/home/op/.emacs.d/straight/build/org/ox hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ox
/home/op/.emacs.d/straight/build/org/ox-md hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ox-md
/home/op/.emacs.d/straight/build/org/ox-man hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ox-man
/home/op/.emacs.d/straight/build/org/org hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org
/home/op/.emacs.d/straight/build/org/ox-html hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ox-html
/home/op/.emacs.d/straight/build/org/ox-beamer hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ox-beamer
/home/op/.emacs.d/straight/build/org/ox-ascii hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ox-ascii
/home/op/.emacs.d/straight/build/org/org-timer hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-timer
/home/op/.emacs.d/straight/build/org/org-tempo hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-tempo
/home/op/.emacs.d/straight/build/org/org-plot hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-plot
/home/op/.emacs.d/straight/build/org/org-lint hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-lint
/home/op/.emacs.d/straight/build/org/org-mouse hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-mouse
/home/op/.emacs.d/straight/build/org/org-mobile hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-mobile
/home/op/.emacs.d/straight/build/org/org-protocol hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-protocol
/home/op/.emacs.d/straight/build/org/org-refile hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-refile
/home/op/.emacs.d/straight/build/org/org-table hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-table
/home/op/.emacs.d/straight/build/org/org-src hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-src
/home/op/.emacs.d/straight/build/org/org-pcomplete hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-pcomplete
/home/op/.emacs.d/straight/build/org/org-num hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-num
/home/op/.emacs.d/straight/build/org/org-list hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-list
/home/op/.emacs.d/straight/build/org/org-macs hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-macs
/home/op/.emacs.d/straight/build/org/org-macro hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-macro
/home/op/.emacs.d/straight/build/org/org-habit hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-habit
/home/op/.emacs.d/straight/build/org/org-element hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-element
/home/op/.emacs.d/straight/build/org/org-keys hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-keys
/home/op/.emacs.d/straight/build/org/org-goto hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-goto
/home/op/.emacs.d/straight/build/org/org-feed hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-feed
/home/op/.emacs.d/straight/build/org/org-datetree hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-datetree
/home/op/.emacs.d/straight/build/org/org-ctags hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-ctags
/home/op/.emacs.d/straight/build/org/org-colview hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-colview
/home/op/.emacs.d/straight/build/org/org-footnote hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-footnote
/home/op/.emacs.d/straight/build/org/org-faces hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-faces
/home/op/.emacs.d/straight/build/org/org-capture hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-capture
/home/op/.emacs.d/straight/build/org/org-entities hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-entities
/home/op/.emacs.d/straight/build/org/org-clock hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-clock
/home/op/.emacs.d/straight/build/org/org-duration hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-duration
/home/op/.emacs.d/straight/build/org/org-crypt hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-crypt
/home/op/.emacs.d/straight/build/org/org-compat hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-compat
/home/op/.emacs.d/straight/build/org/org-id hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-id
/home/op/.emacs.d/straight/build/org/org-agenda hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-agenda
/home/op/.emacs.d/straight/build/org/org-archive hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-archive
/home/op/.emacs.d/straight/build/org/org-indent hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-indent
/home/op/.emacs.d/straight/build/org/ob-fortran hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-fortran
/home/op/.emacs.d/straight/build/org/ol hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ol
/home/op/.emacs.d/straight/build/org/ol-w3m hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ol-w3m
/home/op/.emacs.d/straight/build/org/ol-mhe hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ol-mhe
/home/op/.emacs.d/straight/build/org/ol-rmail hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ol-rmail
/home/op/.emacs.d/straight/build/org/ol-bibtex hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ol-bibtex
/home/op/.emacs.d/straight/build/org/ol-irc hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ol-irc
/home/op/.emacs.d/straight/build/org/ol-info hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ol-info
/home/op/.emacs.d/straight/build/org/ol-bbdb hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ol-bbdb
/home/op/.emacs.d/straight/build/org/ol-eshell hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ol-eshell
/home/op/.emacs.d/straight/build/org/ob-vala hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-vala
/home/op/.emacs.d/straight/build/org/ob-tangle hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-tangle
/home/op/.emacs.d/straight/build/org/ob-shell hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-shell
/home/op/.emacs.d/straight/build/org/ob-sqlite hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-sqlite
/home/op/.emacs.d/straight/build/org/ob-stan hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-stan
/home/op/.emacs.d/straight/build/org/ob hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob
/home/op/.emacs.d/straight/build/org/ob-table hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-table
/home/op/.emacs.d/straight/build/org/ob-python hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-python
/home/op/.emacs.d/straight/build/org/ob-sql hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-sql
/home/op/.emacs.d/straight/build/org/ob-shen hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-shen
/home/op/.emacs.d/straight/build/org/ob-sass hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-sass
/home/op/.emacs.d/straight/build/org/ob-scheme hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-scheme
/home/op/.emacs.d/straight/build/org/ob-plantuml hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-plantuml
/home/op/.emacs.d/straight/build/org/ob-sed hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-sed
/home/op/.emacs.d/straight/build/org/ob-screen hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-screen
/home/op/.emacs.d/straight/build/org/ob-ruby hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-ruby
/home/op/.emacs.d/straight/build/org/ob-ref hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-ref
/home/op/.emacs.d/straight/build/org/ob-C hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-C
/home/op/.emacs.d/straight/build/org/ob-org hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-org
/home/op/.emacs.d/straight/build/org/ob-picolisp hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-picolisp
/home/op/.emacs.d/straight/build/org/ob-ocaml hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-ocaml
/home/op/.emacs.d/straight/build/org/ob-octave hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-octave
/home/op/.emacs.d/straight/build/org/ob-perl hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-perl
/home/op/.emacs.d/straight/build/org/ob-lob hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-lob
/home/op/.emacs.d/straight/build/org/ob-maxima hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-maxima
/home/op/.emacs.d/straight/build/org/ob-lua hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-lua
/home/op/.emacs.d/straight/build/org/ob-makefile hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-makefile
/home/op/.emacs.d/straight/build/org/ob-ledger hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-ledger
/home/op/.emacs.d/straight/build/org/ob-lisp hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-lisp
/home/op/.emacs.d/straight/build/org/ob-io hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-io
/home/op/.emacs.d/straight/build/org/ob-lilypond hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-lilypond
/home/op/.emacs.d/straight/build/org/ob-latex hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-latex
/home/op/.emacs.d/straight/build/org/ob-js hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-js
/home/op/.emacs.d/straight/build/org/ob-java hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-java
/home/op/.emacs.d/straight/build/org/ob-hledger hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-hledger
/home/op/.emacs.d/straight/build/org/ob-forth hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-forth
/home/op/.emacs.d/straight/build/org/ob-groovy hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-groovy
/home/op/.emacs.d/straight/build/org/ob-haskell hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-haskell
/home/op/.emacs.d/straight/build/org/ob-ebnf hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-ebnf
/home/op/.emacs.d/straight/build/org/ob-exp hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-exp
/home/op/.emacs.d/straight/build/org/ob-core hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-core
/home/op/.emacs.d/straight/build/org/ob-eval hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-eval
/home/op/.emacs.d/straight/build/org/ob-css hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-css
/home/op/.emacs.d/straight/build/org/ob-emacs-lisp hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-emacs-lisp
/home/op/.emacs.d/straight/build/org/ob-ditaa hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-ditaa
/home/op/.emacs.d/straight/build/org/ob-mscgen hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-mscgen
/home/op/.emacs.d/straight/build/org/ob-comint hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-comint
/home/op/.emacs.d/straight/build/org/ob-coq hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-coq
/home/op/.emacs.d/straight/build/org/ob-calc hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-calc
/home/op/.emacs.d/straight/build/org/ob-abc hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-abc
/home/op/.emacs.d/straight/build/org/ob-clojure hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-clojure
/home/op/.emacs.d/straight/build/org/ob-awk hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-awk
/home/op/.emacs.d/straight/build/org/ob-R hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-R
/home/op/.emacs.d/straight/build/org/org-loaddefs hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-loaddefs
/home/op/.emacs.d/straight/build/org/ob-J hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/ob-J
/home/op/.emacs.d/straight/build/org/org-version hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-version
/home/op/.emacs.d/straight/build/org/org-install hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/org/org-install
/home/op/.emacs.d/straight/build/soap-client/soap-client hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/net/soap-client
/home/op/.emacs.d/straight/build/soap-client/soap-inspect hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/net/soap-inspect
/home/op/.emacs.d/straight/build/let-alist/let-alist hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/emacs-lisp/let-alist
/home/op/.emacs.d/straight/build/eldoc/eldoc hides /home/op/opt/emacs/share/emacs/28.0.50/lisp/emacs-lisp/eldoc

Features:
(shadow guess-language flyspell ispell emacsbug gnus-async gnus-bcklg
gnus-agent gnus-srvr gnus-score score-mode nnvirtual nntp gnus-ml
gnus-msg disp-table nndoc gnus-cache gnus-dup gnutls network-stream
url-cache debbugs-gnu debbugs soap-client rng-xsd xsd-regexp
debbugs-autoloads soap-client-autoloads autoload consult-imenu shortdoc
debug edebug backtrace etags fileloop reposition pulse color help-fns
radix-tree consult-xref misearch multi-isearch cl-print ielm smerge-mode
diff flymake-cc cap-words superword subword dired-aux xref find-dired
vc-mtn vc-hg vc-git diff-mode vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs
vc-got vc-dir log-edit pcvs-util add-log vc-annotate vc vc-dispatcher
cursor-sensor project mm-archive qp sort gnus-cite mail-extr nameless
whitespace hideshow smartparens-config smartparens-org smartparens-text
smartparens-python smartparens-c smartparens checkdoc flymake-proc
flymake warnings ol-eww ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect
gnus-search eieio-opt speedbar ezimage dframe ol-docview ol-bibtex
ol-bbdb ol-w3m oc-basic bibtex oc loadhist autoinsert org-roam-migrate
org-roam-mode inline org-roam-capture org-roam-node org-roam-db
org-roam-utils org-roam pcase org-roam-compat org-capture org-id
emacsql-sqlite url-http url-auth url-gw nsm emacsql emacsql-compiler
magit-section f dash edit-server edit-server-autoloads elfeed-autoloads
telega-autoloads rainbow-identifiers-autoloads
visual-fill-column-autoloads toxe toxe-chat ewoc nov-autoloads
esxml-autoloads kv-autoloads pq pq-core elpher-autoloads eww xdg
url-queue mm-url emms-autoloads pass-autoloads
password-store-otp-autoloads password-store-autoloads
with-editor-autoloads mu4e mu4e-org mu4e-main mu4e-view mu4e-view-gnus
gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum gnus-group
gnus-undo gnus-start gnus-dbus dbus gnus-cloud nnimap nnmail mail-source
utf7 netrc nnoo gnus-spec gnus-int gnus-range gnus-win gnus nnheader
mu4e-view-common mu4e-headers mu4e-compose mu4e-context mu4e-draft
mu4e-actions ido rfc2368 smtpmail sendmail mu4e-mark mu4e-proc
mu4e-utils doc-view mu4e-lists mu4e-message shr kinsoku svg xml dom
flow-fill mule-util hl-line mu4e-vars message rmc puny rfc822 mml
mml-sec epa derived epg epg-config gnus-util rmail rmail-loaddefs
mm-decode mm-bodies mm-encode mailabbrev mail-utils gmm-utils mailheader
mu4e-meta keycast keycast-autoloads literate-calc-mode s calc
calc-loaddefs calc-macs literate-calc-mode-autoloads vterm-autoloads sam
markdown-mode-autoloads ox-gemini ox-odt rng-loc rng-uri rng-parse
rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok
nxml-util ox-latex ox-icalendar org-agenda org-refile ox-html table
ox-ascii ox-publish ox org-element org-tree-slide org-timer org-clock
org-tree-slide-autoloads org-roam-autoloads magit-section-autoloads
emacsql-sqlite-autoloads emacsql-autoloads f-autoloads ob-gnuplot
ob-python python tramp-sh tramp tramp-loaddefs trampver
tramp-integration files-x tramp-compat parse-time iso8601 ls-lisp
ob-sqlite ob-shell shell ob-lisp ob-sql ob-R ob-C cc-mode cc-fonts
cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
org-protocol org ob ob-tangle ob-ref ob-lob ob-table org-macro
org-footnote org-src ob-comint org-pcomplete pcomplete org-list
org-faces org-entities time-date noutline outline org-version
ob-emacs-lisp org-table org-keys org-loaddefs cal-menu calendar
cal-loaddefs avl-tree generator ol ob-exp ob-core org-compat ob-eval
org-macs ox-gemini-autoloads gemini-mode-autoloads toml-mode-autoloads
yaml-mode-autoloads gdscript-mode-autoloads lua-mode-autoloads sh-script
smie executable perl-mode go-mode-autoloads web-mode-autoloads
es-mode-autoloads request-autoloads s-autoloads spark-autoloads geiser
geiser-autoloads cider-autoloads sesman-autoloads spinner-autoloads
queue-autoloads pkg-info-autoloads epl-autoloads parseedn-autoloads
parseclj-autoloads a-autoloads clojure-mode-autoloads sly-autoloads
package-lint rx finder lisp-mnt mail-parse rfc2231 rfc2047 rfc2045
mm-util ietf-drums mail-prsvr package-lint-autoloads nameless-autoloads
eros eros-autoloads eglot-autoloads project-autoloads xref-autoloads
flymake-autoloads eldoc-autoloads jsonrpc-autoloads paren
iedit-autoloads pdf-occur ibuf-ext ibuffer ibuffer-loaddefs tablist
tablist-filter semantic/wisent/comp semantic/wisent
semantic/wisent/wisent semantic/util-modes semantic/util semantic
semantic/tag semantic/lex semantic/fw mode-local find-func cedet
pdf-isearch let-alist pdf-misc imenu pdf-tools package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap url-handlers url-parse auth-source eieio
eieio-core eieio-loaddefs json map url-vars compile comint ansi-color
cus-edit cus-load pdf-view password-cache jka-compr pdf-cache pdf-info
tq pdf-util advice format-spec pdf-macs image-mode dired-x dired
dired-loaddefs exif pdf-tools-autoloads let-alist-autoloads
tablist-autoloads my-abbrev olivetti-autoloads typo-autoloads
guess-language-autoloads smartparens-autoloads dash-autoloads
loccur-autoloads ace-window-autoloads avy-autoloads
transpose-frame-autoloads winner shackle trace shackle-autoloads corfu
corfu-autoloads embark-autoloads consult-selectrum selectrum
minibuf-eldef crm selectrum-autoloads affe server consult bookmark
text-property-search pp affe-autoloads consult-autoloads orderless
orderless-autoloads marginalia marginalia-autoloads form-feed
form-feed-autoloads thingatpt recentf tree-widget wid-edit hydra ring lv
hydra-autoloads lv-autoloads finder-inf savehist saveplace
valign-autoloads htmlize htmlize-autoloads edmacro kmacro
use-package-bind-key bind-key easy-mmode use-package-core
use-package-autoloads bind-key-autoloads straight-autoloads info cl-seq
cl-extra help-mode seq byte-opt straight subr-x cl-macs gv bytecomp
byte-compile cconv cl-loaddefs cl-lib minimal-light-theme my-modeline
iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
kqueue lcms2 dynamic-setting system-font-setting font-render-setting
cairo x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 895495 136128)
 (symbols 48 63645 8)
 (strings 32 224778 41016)
 (string-bytes 1 7913312)
 (vectors 16 106677)
 (vector-slots 8 2140779 96967)
 (floats 8 3555 1005)
 (intervals 56 21195 2565)
 (buffers 992 58))

-- 
/Omar Polo





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#50240: 28.0.50; incorrect handling of ignore files in project-files
  2021-08-28 16:52 bug#50240: 28.0.50; incorrect handling of ignore files in project-files Omar Polo
@ 2021-08-29  1:17 ` Dmitry Gutov
  2021-08-29  8:30   ` Omar Polo
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2021-08-29  1:17 UTC (permalink / raw)
  To: Omar Polo, 50240

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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#50240: 28.0.50; incorrect handling of ignore files in project-files
  2021-08-29  1:17 ` Dmitry Gutov
@ 2021-08-29  8:30   ` Omar Polo
  2021-08-30  2:22     ` Dmitry Gutov
  0 siblings, 1 reply; 6+ messages in thread
From: Omar Polo @ 2021-08-29  8:30 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 50240


Dmitry Gutov <dgutov@yandex.ru> writes:

> 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?

Yes, with "./foo" the issue is resolved, but I think a more general fix
in project.el is warranted.

It's quite common (at least for C and Go which I use frequently) to
produce a binary in the root directory of the project with the same name
of the project, for example

	/home/op/w/foo/    <- project root
	/home/op/w/foo/foo <- the binary produced

and I expect users to have "foo" in their ignore file, not "./foo", as
they do for e.g. when using git and vc-git.

Also, if one day in the future someone decides to remove the specific
treatment of Git and Hg from project-files this issue will bite
vc-git/hg users too.

I guess I can hack something in my custom vc backend to replace an
ignore entry called "<projectname>" with "./<projectname>", but this
would probably need to be done on every vc backend, excluding git and
hg.

For the time being, I'm using the following patch, but I don't
particularly like it.


diff --git a/project.el b/project.el
index ae9bf03..176947e 100644
--- a/project.el
+++ b/project.el
@@ -302,6 +302,12 @@ to find the list of ignores for each directory."
          ;; expanded and not left for the shell command
          ;; to interpret.
          (localdir (file-name-unquote (file-local-name (expand-file-name dir))))
+         (projectname (file-name-nondirectory (directory-file-name dir)))
+         (ignores (mapcar (lambda (e)
+                            (if (string= projectname e)
+                                (concat "./" e)
+                              e))
+                          ignores))
          (command (format "%s -H %s %s -type f %s -print0"
                           find-program
                           (shell-quote-argument





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#50240: 28.0.50; incorrect handling of ignore files in project-files
  2021-08-29  8:30   ` Omar Polo
@ 2021-08-30  2:22     ` Dmitry Gutov
  2021-08-30  7:48       ` Omar Polo
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2021-08-30  2:22 UTC (permalink / raw)
  To: Omar Polo; +Cc: 50240

On 29.08.2021 11:30, Omar Polo wrote:

> Yes, with "./foo" the issue is resolved, but I think a more general fix
> in project.el is warranted.
> 
> It's quite common (at least for C and Go which I use frequently) to
> produce a binary in the root directory of the project with the same name
> of the project, for example
> 
> 	/home/op/w/foo/    <- project root
> 	/home/op/w/foo/foo <- the binary produced
> 
> and I expect users to have "foo" in their ignore file, not "./foo", as
> they do for e.g. when using git and vc-git.

Fair enough.

> Also, if one day in the future someone decides to remove the specific
> treatment of Git and Hg from project-files this issue will bite
> vc-git/hg users too.

Unlikely: the special treatment is there foremost for performance. But 
perhaps we'll get a faster universal method for listing files, who knows.

> I guess I can hack something in my custom vc backend to replace an
> ignore entry called "<projectname>" with "./<projectname>", but this
> would probably need to be done on every vc backend, excluding git and
> hg.
> 
> For the time being, I'm using the following patch, but I don't
> particularly like it.
> 
> 
> diff --git a/project.el b/project.el
> index ae9bf03..176947e 100644
> --- a/project.el
> +++ b/project.el
> @@ -302,6 +302,12 @@ to find the list of ignores for each directory."
>            ;; expanded and not left for the shell command
>            ;; to interpret.
>            (localdir (file-name-unquote (file-local-name (expand-file-name dir))))
> +         (projectname (file-name-nondirectory (directory-file-name dir)))
> +         (ignores (mapcar (lambda (e)
> +                            (if (string= projectname e)
> +                                (concat "./" e)
> +                              e))
> +                          ignores))
>            (command (format "%s -H %s %s -type f %s -print0"
>                             find-program
>                             (shell-quote-argument

Please try this patch instead:

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index ae9bf03571..b267185ab0 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -302,10 +302,9 @@ project--files-in-directory
           ;; expanded and not left for the shell command
           ;; to interpret.
           (localdir (file-name-unquote (file-local-name 
(expand-file-name dir))))
-         (command (format "%s -H %s %s -type f %s -print0"
+         (dfn (directory-file-name localdir))
+         (command (format "%s -H . %s -type f %s -print0"
                            find-program
-                          (shell-quote-argument
-                           (directory-file-name localdir)) ; Bug#48471
                            (xref--find-ignores-arguments ignores localdir)
                            (if files
                                (concat (shell-quote-argument "(")
@@ -324,8 +323,9 @@ project--files-in-directory
                         (unless (zerop status)
                           (error "File listing failed: %s" 
(buffer-string))))))))
      (project--remote-file-names
-     (sort (split-string output "\0" t)
-           #'string<))))
+     (mapcar (lambda (s) (concat dfn (substring s 1)))
+             (sort (split-string output "\0" t)
+                   #'string<)))))

  (defun project--remote-file-names (local-files)
    "Return LOCAL-FILES as if they were on the system of 
`default-directory'.






^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#50240: 28.0.50; incorrect handling of ignore files in project-files
  2021-08-30  2:22     ` Dmitry Gutov
@ 2021-08-30  7:48       ` Omar Polo
  2021-09-06  2:06         ` Dmitry Gutov
  0 siblings, 1 reply; 6+ messages in thread
From: Omar Polo @ 2021-08-30  7:48 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 50240


Dmitry Gutov <dgutov@yandex.ru> writes:

> On 29.08.2021 11:30, Omar Polo wrote:
>
> [...]
>
>> Also, if one day in the future someone decides to remove the specific
>> treatment of Git and Hg from project-files this issue will bite
>> vc-git/hg users too.
>
> Unlikely: the special treatment is there foremost for performance. But
> perhaps we'll get a faster universal method for listing files, who
> knows.

Indeed, it was only for the argument sake.

> [...]
>
> Please try this patch instead:

patch(1) failed to apply the diff, so I had to apply it by hand, but it
works!  Thanks!





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#50240: 28.0.50; incorrect handling of ignore files in project-files
  2021-08-30  7:48       ` Omar Polo
@ 2021-09-06  2:06         ` Dmitry Gutov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Gutov @ 2021-09-06  2:06 UTC (permalink / raw)
  To: Omar Polo; +Cc: 50240-done

Version: 28.1

On 30.08.2021 10:48, Omar Polo wrote:
>> [...]
>>
>> Please try this patch instead:
> patch(1) failed to apply the diff, so I had to apply it by hand, but it
> works!  Thanks!

Thanks for checking, I have pushed the fix to master as commit 
71f8b55f46, together with some related changes.

Let me know if you have any further problems.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-09-06  2:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-28 16:52 bug#50240: 28.0.50; incorrect handling of ignore files in project-files Omar Polo
2021-08-29  1:17 ` Dmitry Gutov
2021-08-29  8:30   ` Omar Polo
2021-08-30  2:22     ` Dmitry Gutov
2021-08-30  7:48       ` Omar Polo
2021-09-06  2:06         ` Dmitry Gutov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.