GNU bug report logs -
#73801
31.0.50; project-try-vc sometimes set wrong cache project-vc-extra-root-markers
Previous Next
Reported by: Zhengyi Fu <i <at> fuzy.me>
Date: Mon, 14 Oct 2024 08:16:03 UTC
Severity: normal
Found in version 31.0.50
Fixed in version 30.1
Done: Dmitry Gutov <dmitry <at> gutov.dev>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Fri, 1 Nov 2024 02:49:24 +0200
with message-id <f7957dc7-3ded-433d-a0d9-27f20235b461 <at> gutov.dev>
and subject line Re: bug#73801: 31.0.50; project-try-vc sometimes set wrong cache project-vc-extra-root-markers
has caused the debbugs.gnu.org bug report #73801,
regarding 31.0.50; project-try-vc sometimes set wrong cache project-vc-extra-root-markers
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
73801: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73801
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
Consider the following project:
test-project/
├── .git/
└── subproject/
├── marker
└── subdir/
If `project-vc-extra-root-markers' is set to `("marker")' and
`project-try-vc' is invoked with `test-project/subproject/subdir', it will set the `project-vc'
VC property of the `test-project/subproject' directory to
`(".../test-project" project-vc nil)', so if later `project-try-vc' is
invoked with that directory, it will return a wrong result.
This is because project-vc tries to detect the VC backend by invoking
`project-try-vc' on the subproject while let binding
`project-vc-extra-root-markers' to nil and the result is cached.
The following patch can fix the problem:
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -595,7 +595,7 @@ project-try-vc
(let* ((project-vc-extra-root-markers nil)
;; Avoid submodules scan.
(enable-dir-local-variables nil)
- (parent (project-try-vc root)))
+ (parent (project-try-vc dir)))
(and parent (setq backend (nth 1 parent)))))
(setq project (list 'vc backend root))
;; FIXME: Cache for a shorter time.
[Message part 3 (message/rfc822, inline)]
Version: 30.1
On 31/10/2024 12:06, Eli Zaretskii wrote:
>>> How do we know that catering to this corner case will not screw
>>> other corner cases?
>> Difficult to guarantee that 100%, but this specific case seems important
>> enough, while at the same time we can infer that the change won't affect
>> the majority scenario because the code is guarded by these conditions:
>>
>> (when root
>> (when (not backend)
>> ...
> FWIW, I have a bad feeling about this, but if you are confident, feel
> free to backport.
Thanks, I've cherry-picked the longer (but more transparent) fix and a
new regression test as well, to the release branch.
And thanks to Zhengyi Fu for trying it out.
This bug report was last modified 204 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.