Subject: 29.0.50; project-find-file don't work on a project with many submodules
From: Eason Huang <[email-masked]>
To: [email-masked]
Date: Fri, 13 May 2022 20:56:12 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

I try to use `M-x project-find-file` in my `.emacs.d` config project. It
takes a long time(about 1 minutes), and finally get a error as bellow:

```
process-file: Variable binding depth exceeds max-specpdl-size
```

The .emacs.d project include 95 submudules of Git, is this too huge for
project.el?
You can visit my config: https://github.com/Eason0210/emacs.d

On other git project with a few submodules(about 14), it works well.
For exmaple this one: https://github.com/emacscollective/emacs.g

And I try to start emacs with `emacs -q`, set `(setq debug-on-errort)`.
Then reproduce the issue, will get the following debug error:

Debugger entered--Lisp error: (excessive-variable-binding)
  call-process("git" nil (t nil) nil "--no-pager" "ls-files" "-z" "-c" "-o" "--exclude-standard")
  process-file("git" nil (t nil) nil "--no-pager" "ls-files" "-z" "-c" "-o" "--exclude-standard")
  vc-git--call((t nil) "ls-files" "-z" "-c" "-o" "--exclude-standard")
  vc-git--out-ok("ls-files" "-z" "-c" "-o" "--exclude-standard")
  vc-git--run-command-string(nil "ls-files" "-z" "-c" "-o" "--exclude-standard")
  project--vc-list-files("/Users/eason/.emacs.d/lib/aggressive-indent" Git nil)
  #f(compiled-function (module) #<bytecode 0xfc6c01609385f70>)("lib/aggressive-indent")
  project--vc-list-files("/Users/eason/.emacs.d/." Git nil)
  #f(compiled-function (module) #<bytecode 0xfc6c01609385f70>)(".")
  project--vc-list-files("/Users/eason/.emacs.d/." Git nil)
  #f(compiled-function (module) #<bytecode 0xfc6c01609385f70>)(".")
  project--vc-list-files("/Users/eason/.emacs.d/." Git nil)
  #f(compiled-function (module) #<bytecode 0xfc6c01609385f70>)(".")
  project--vc-list-files("/Users/eason/.emacs.d/." Git nil)
  #f(compiled-function (module) #<bytecode 0xfc6c01609385f70>)(".")
  project--vc-list-files("/Users/eason/.emacs.d/." Git nil)
  #f(compiled-function (module) #<bytecode 0xfc6c01609385f70>)(".")
  project--vc-list-files("/Users/eason/.emacs.d/." Git nil)
  #f(compiled-function (module) #<bytecode 0xfc6c01609385f70>)(".")

  .... there are 1100 lines more here ...

  project--vc-list-files("/Users/eason/.emacs.d/." Git nil)
  #f(compiled-function (module) #<bytecode 0xfc6c01609385f70>)(".")
  project--vc-list-files("/Users/eason/.emacs.d/." Git nil)
  #f(compiled-function (module) #<bytecode 0xfc6c01609385f70>)(".")
  project--vc-list-files("~/.emacs.d/" Git nil)
  #f(compiled-function (dir) #<bytecode -0x1a2f966d7f3875dc>)("~/.emacs.d/")
  mapcan(#f(compiled-function (dir) #<bytecode -0x1a2f966d7f3875dc>) ("~/.emacs.d/"))
  #f(compiled-function (project &optional dirs) #<bytecode -0x13f4e1776db2687e>)((vc Git "~/.emacs.d/") ("~/.emacs.d/"))
  apply(#f(compiled-function (project &optional dirs) #<bytecode -0x13f4e1776db2687e>) (vc Git "~/.emacs.d/") ("~/.emacs.d/"))
  project-files((vc Git "~/.emacs.d/") ("~/.emacs.d/"))
  project-find-file-in(#("init.el" 0 7 (fontified t help-echo "mouse-2: visit this file in other window" mouse-face highlight dired-filename t)) ("~/.emacs.d/") (vc Git "~/.emacs.d/") nil)
  project-find-file(nil)
  funcall-interactively(project-find-file nil)
  command-execute(project-find-file record)
  execute-extended-command(nil "project-find-file" "project-find-fi")
  funcall-interactively(execute-extended-command nil "project-find-file" "project-find-fi")
  command-execute(execute-extended-command)

My platfrom informations:

In GNU Emacs 29.0.50 (build 1, x86_64-apple-darwin21.4.0, NS appkit-2113.40 Version 12.3.1 (Build 21E258))
 of 2022-05-09 built on macbook
Repository revision: 4f1e748df208ced08c7cda8f96e6a5638ad14240
Repository branch: master
Windowing system distributor 'Apple', version 10.3.2113
System Description:  macOS 12.3.1

Configured using:
 'configure --with-ns --with-modules
 '--enable-locallisppath=/Library/Application
 Support/Emacs/${version}/site-lisp:/Library/Application
 Support/Emacs/site-lisp:/usr/local/share/emacs/site-lisp'
 --with-xwidgets --with-native-compilation
 'CFLAGS=-I/usr/local/opt/gcc/include -I/usr/local/opt/libgccjit/include
 -O2' 'LDFLAGS=-L/usr/local/opt/gcc/lib/gcc/11
 -L/usr/local/opt/gcc/lib/gcc/11/gcc/x86_64-apple-darwin21/11
 -L/usr/local/opt/libgccjit/lib/gcc/11 -I/usr/local/opt/gcc/include
 -I/usr/local/opt/libgccjit/include -Wl,-headerpad_max_install_names''

Configured features:
ACL DBUS GIF GLIB GMP GNUTLS JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS WEBP XIM XWIDGETS ZLIB

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

Major mode: ELisp/d

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media rmc puny
rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config
gnus-util text-property-search time-date mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils help-fns radix-tree
cl-print debug backtrace help-mode find-func thingatpt vc-mtn vc-hg
vc-git diff-mode vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs log-view
easy-mmode pcvs-util vc vc-dispatcher project seq gv subr-x byte-opt
bytecomp byte-compile cconv dired-aux cl-loaddefs cl-lib dired
dired-loaddefs iso-transl tooltip eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/ns-win ns-win
ucs-normalize mule-util term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-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 nadvice simple 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 emoji-zwj charscript charprop
case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads
xwidget-internal dbusbind kqueue cocoa ns lcms2 multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 765142 20103)
 (symbols 48 9014 0)
 (strings 32 215443 3200)
 (string-bytes 1 8854733)
 (vectors 16 21867)
 (vector-slots 8 482129 32483)
 (floats 8 30 306)
 (intervals 56 31551 79)
 (buffers 992 17))

-- 
Eason Huang