GNU bug report logs -
#47168
28.0.50; Infinite recursion in project-root
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Mon, 15 Mar 2021 17:11:03 UTC
Severity: normal
Found in version 28.0.50
Done: Dmitry Gutov <dgutov <at> yandex.ru>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 47168 in the body.
You can then email your comments to 47168 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#47168
; Package
emacs
.
(Mon, 15 Mar 2021 17:11:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> linkov.net>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 15 Mar 2021 17:11:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
When for some reason the argument of 'project-root' becomes nil,
for example, when the current buffer is not under version control,
then
(project-root (project-current))
goes into infinite recursion:
Debugger entered--Lisp error: (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
project-root(nil)
project-roots(nil)
...
project-root(nil)
project-roots(nil)
...
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#47168
; Package
emacs
.
(Wed, 17 Mar 2021 02:48:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 47168 <at> debbugs.gnu.org (full text, mbox):
Hi Juri,
On 15.03.2021 19:04, Juri Linkov wrote:
> When for some reason the argument of 'project-root' becomes nil,
> for example, when the current buffer is not under version control,
> then
>
> (project-root (project-current))
>
> goes into infinite recursion:
>
> Debugger entered--Lisp error: (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
> project-root(nil)
> project-roots(nil)
> ...
> project-root(nil)
> project-roots(nil)
> ...
Note that the right way to write this code is either
(project-root (project-current t))
or
(when-let ((project (project-current)))
(project-root project))
so we only see this when the programmer failed to account for the
absence of current project.
Still, it would be nice to never show a backtrace like this, even in
those cases.
The idea here was to keep compatibility with backends which implement
project-roots and not project-root (perhaps the built-in vc backend in
Emacs 27), as well as let the clients call either project-root or
project-roots, also for backward compatibility purposes. Worst case, we
can give up on that and require all 3rd party code standardize on
project-root and have all users install the latest project.el from ELPA.
But perhaps we still can have it both ways?
Stefan, any chance there's a relatively non-dirty way we can check
whether there is a non-default implementation for the generic function
with given args, before calling it? That would allow us to break recursion.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#47168
; Package
emacs
.
(Wed, 17 Mar 2021 03:55:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 47168 <at> debbugs.gnu.org (full text, mbox):
> Stefan, any chance there's a relatively non-dirty way we can check whether
> there is a non-default implementation for the generic function with given
> args, before calling it?
Not really, no. We could refrain from providing a default
implementation, and instead add a method to `cl-no-next-method` or
something like that, but I'm not sure it would make much difference.
> That would allow us to break recursion.
But we could use some dynamically-scoped
`project--within-roots-fallback` variable to break such recursion ;-)
Stefan
Reply sent
to
Dmitry Gutov <dgutov <at> yandex.ru>
:
You have taken responsibility.
(Wed, 17 Mar 2021 16:52:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Juri Linkov <juri <at> linkov.net>
:
bug acknowledged by developer.
(Wed, 17 Mar 2021 16:52:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 47168-done <at> debbugs.gnu.org (full text, mbox):
On 17.03.2021 05:54, Stefan Monnier wrote:
> But we could use some dynamically-scoped
> `project--within-roots-fallback` variable to break such recursion;-)
Good idea, thanks!
Applied and pushed.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 15 Apr 2021 11:24:11 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 127 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.