From unknown Sun Jun 22 00:28:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#73801: 31.0.50; project-try-vc sometimes set wrong cache project-vc-extra-root-markers Resent-From: Zhengyi Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Oct 2024 08:16:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 73801 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 73801@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17288937629883 (code B ref -1); Mon, 14 Oct 2024 08:16:03 +0000 Received: (at submit) by debbugs.gnu.org; 14 Oct 2024 08:16:02 +0000 Received: from localhost ([127.0.0.1]:35233 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0GFF-0002Z7-Lo for submit@debbugs.gnu.org; Mon, 14 Oct 2024 04:16:02 -0400 Received: from lists.gnu.org ([209.51.188.17]:54462) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0Edj-0003g7-MY for submit@debbugs.gnu.org; Mon, 14 Oct 2024 02:33:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t0EdN-0001yq-Jc for bug-gnu-emacs@gnu.org; Mon, 14 Oct 2024 02:32:51 -0400 Received: from relay1-d.mail.gandi.net ([2001:4b98:dc4:8::221]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t0EdK-00013f-Qk for bug-gnu-emacs@gnu.org; Mon, 14 Oct 2024 02:32:49 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 9CC50240004 for ; Mon, 14 Oct 2024 06:32:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fuzy.me; s=gm1; t=1728887561; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pMeIpjz9IDxcjvYnYSeWGcLBeIJNUAJsNUErBIkOv1s=; b=ZC+eqmemVGO/YDt1cByG+b63FMs4uyeCNawrrLSRrnBCXILjp0OhbsLE8zrlOxMs3k2zLP bgvTiJjdMFoM8kDYbhIQEItpXd3NyUUVclC8R4bXEqiNGoDbgV0usw8J/UvSVZ1QKr8QP9 WyNf6ffl0uQ+LCg/afHC9+Izh8LPpbzPE6anmu4bOx4xec/U721HTr4e/XKLy7SQ/rmxGs ZeaR+6/1HzL9EtZuEFCGO5aaFwbYuUyzs5cQl2vhznJDJ6AuAiaE84lBaorGIsVx5VLDKt iiZO9knTPlkmFwYseK4jmQ5NpQ7eZ4qL7CJfXl0A7Y6h4YVgXhI9FkYWM9u9fg== From: Zhengyi Fu Date: Mon, 14 Oct 2024 14:29:48 +0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: id@fuzy.me Received-SPF: pass client-ip=2001:4b98:dc4:8::221; envelope-from=i@fuzy.me; helo=relay1-d.mail.gandi.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Mailman-Approved-At: Mon, 14 Oct 2024 04:15:59 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) Consider the following project: test-project/ =E2=94=9C=E2=94=80=E2=94=80 .git/ =E2=94=94=E2=94=80=E2=94=80 subproject/ =E2=94=9C=E2=94=80=E2=94=80 marker =E2=94=94=E2=94=80=E2=94=80 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. From unknown Sun Jun 22 00:28:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#73801: 31.0.50; project-try-vc sometimes set wrong cache project-vc-extra-root-markers Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 27 Oct 2024 10:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73801 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Zhengyi Fu , Philip Kaludercic Cc: 73801@debbugs.gnu.org Received: via spool by 73801-submit@debbugs.gnu.org id=B73801.173002514924564 (code B ref 73801); Sun, 27 Oct 2024 10:33:02 +0000 Received: (at 73801) by debbugs.gnu.org; 27 Oct 2024 10:32:29 +0000 Received: from localhost ([127.0.0.1]:43942 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t50ZQ-0006O8-QY for submit@debbugs.gnu.org; Sun, 27 Oct 2024 06:32:29 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40578) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t50ZO-0006Nt-Pf for 73801@debbugs.gnu.org; Sun, 27 Oct 2024 06:32:27 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t50Yh-0004WZ-KV; Sun, 27 Oct 2024 06:31:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=Jkpo3Mvg0nZt2GpgvLzllAQuZkY3QudkwQl0pPVF8WA=; b=DYlMnDe6fLimbQIrwJjO kcLtt3vZW5wmype23PnZAQxgkArHJPELf9KWpwcdSzVwq4lPre2pRHnMAASnbuvwUmmTBcpkjQ+gv pedient1iVriZZClAMgsXdONxNE61HzLLLSS8erl5Cwzx8abmDXOFimh3tX6XSgwdgyd7Luz8XkI5 C+L9lF3LwvcQBwZ5zFMiJed3jKXoqqXjYCtE97mtv/ka+B1GOn5TgCn08h/Se1c3IESlcgAOVUP36 nJUnatHf7VDbsfaH7bFyRtPhmQJtU2Lw/X3bRjHwbvc1tBkLyz2oa/MWxr+vxhrPsBDSvHZEOkJB4 jzmY+r5aZtXCxQ==; Date: Sun, 27 Oct 2024 12:31:40 +0200 Message-Id: <86iktdalbn.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Zhengyi Fu on Mon, 14 Oct 2024 14:29:48 +0800) References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Zhengyi Fu > Date: Mon, 14 Oct 2024 14:29:48 +0800 > > 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. Philip, could you please look into this? From unknown Sun Jun 22 00:28:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#73801: 31.0.50; project-try-vc sometimes set wrong cache project-vc-extra-root-markers Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 28 Oct 2024 04:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73801 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Zhengyi Fu , 73801@debbugs.gnu.org Received: via spool by 73801-submit@debbugs.gnu.org id=B73801.173008842415793 (code B ref 73801); Mon, 28 Oct 2024 04:08:02 +0000 Received: (at 73801) by debbugs.gnu.org; 28 Oct 2024 04:07:04 +0000 Received: from localhost ([127.0.0.1]:50071 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5H1z-00046f-FI for submit@debbugs.gnu.org; Mon, 28 Oct 2024 00:07:03 -0400 Received: from fout-a5-smtp.messagingengine.com ([103.168.172.148]:60997) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5H1w-00045o-Uv for 73801@debbugs.gnu.org; Mon, 28 Oct 2024 00:07:01 -0400 Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfout.phl.internal (Postfix) with ESMTP id EC2D913801B5; Mon, 28 Oct 2024 00:06:19 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-10.internal (MEProxy); Mon, 28 Oct 2024 00:06:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1730088379; x=1730174779; bh=B3aUW/u9jVzAbzazR2LxoF0lLmU91Aio7OnzmgO4d90=; b= kgoEOisHctyKXavPkZk6Ys0S66ul/srqhW1CuCrUHDCSvyS+N1LuZwAhEnVEzm4C 9btXZbi3PoF7u3MSLPqeH/U59Q+btiewGYyUZv23fS7ohOgq9B10URuzs+xYaO1i bAxGKfFBSpxv0QaNGyQcjdRt3R0PJZvAj4BSKgTkdFc0npSfv7qjAF1IgQSvrdeS 8txPgUEORQuWWVOf/j4U7EpamN/IXHtwjoAtH60a/9l00z7ugOiMBfiJ/Fc7qgZX cNPYM/MuL0M9KPw1dYCHBbqBNlfuAWo7wCdD6EOEtGmzXPmTZwP3yIsOuRzRSi6t ZgykmeEYwKnFFvq+6L6YnA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1730088379; x= 1730174779; bh=B3aUW/u9jVzAbzazR2LxoF0lLmU91Aio7OnzmgO4d90=; b=W bMfW2SM/jpELfhi+zi36iEuXISzQdXglJu+z11CP/jiAuSOGZNuXUgNKW32rA/8o hzgzJ7WLu+TuDTYp0lCT+QBhh0h8YzlmueRwCk4RP3ZiZX5/eiKRT4ANlGMtpDB3 RAbnGPlYZaCFHSWBcdfVROYwN3xBHaVCocF6rSZ0XEdOQ7gdStftNs73hTsRpvSx O07VEV8if3SUfoXW+evT7nMVOYCJP3oxn8ha539jPwEJutWeo5V9psHeHYVQwaiB nT75Nd4/PEBly1oMBm0yTkXTGQFFarde9FetCSTsiD4hTOlm8rVFhtU+8X9AREPv r1yq1/TukwLVIEXVe3HSA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdejjedgieekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefkffggfg fuvfhfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeffmhhithhrhicuifhuthhovhcu oegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrthhtvghrnhepgeeugeetff duvdejvedvleeliedtfedtudfhfeefffejudekveejvdeffffgveegnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepughmihhtrhihsehguhhtoh hvrdguvghvpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphht thhopehisehfuhiihidrmhgvpdhrtghpthhtohepjeefkedtudesuggvsggsuhhgshdrgh hnuhdrohhrgh X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 28 Oct 2024 00:06:18 -0400 (EDT) Message-ID: <3b9816c7-bec3-4743-ad1a-49332c158099@gutov.dev> Date: Mon, 28 Oct 2024 06:06:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird References: Content-Language: en-US From: Dmitry Gutov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi! Thanks for the report. On 14/10/2024 09:29, Zhengyi Fu wrote: > 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)) I've pushed a different fix in commit 29b30eb49f8 (with slightly better performance, I think). Please try it when you can. It would be nice to get either of the patches into Emacs 30, too, but it might be a little late given where it is in the pretest. From unknown Sun Jun 22 00:28:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#73801: 31.0.50; project-try-vc sometimes set wrong cache project-vc-extra-root-markers Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Oct 2024 02:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73801 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 73801@debbugs.gnu.org, Eli Zaretskii Cc: Zhengyi Fu Received: via spool by 73801-submit@debbugs.gnu.org id=B73801.173016986512458 (code B ref 73801); Tue, 29 Oct 2024 02:45:01 +0000 Received: (at 73801) by debbugs.gnu.org; 29 Oct 2024 02:44:25 +0000 Received: from localhost ([127.0.0.1]:55376 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5cDY-0003Es-To for submit@debbugs.gnu.org; Mon, 28 Oct 2024 22:44:25 -0400 Received: from fhigh-b3-smtp.messagingengine.com ([202.12.124.154]:38781) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5cDW-0003EY-JL for 73801@debbugs.gnu.org; Mon, 28 Oct 2024 22:44:22 -0400 Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfhigh.stl.internal (Postfix) with ESMTP id F3719254017A; Mon, 28 Oct 2024 22:44:16 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Mon, 28 Oct 2024 22:44:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1730169856; x=1730256256; bh=51m8FdSSuK8obC3MNrCYpYx6E8K+jasjNiqU9vEX7KI=; b= lLzBxxIrnfau8nx/YpmN4H9DGwcehHXIya6/PY9CLOKbN1JJ9hgshF8xQMo9UN4+ UJGtG18xRcxNSrw9GvnIphgw4CFSQdjRfNatdE94R2H/3KSbPBJ2L4eMtAFK0YXL k3iuRfTDXyJgkoMMC1hR319lFtR0/CFmMIft3IdTDHRcJyOiJz0kItUU/Xw2dHh8 dJIuGz0LIgyNn4RWNBB5wE5e/FbfP/85UEf+LQSU1/CQHzlhEsnJ2j0yT60ToEM+ +l38yglcfdov+ULF7nHca0x5u8sIqXsfzQPQa/7KWo4Ki1z5RytSbCM+ZwR5Qh+P HunBroJW0nb57FEfXSOmAA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1730169856; x= 1730256256; bh=51m8FdSSuK8obC3MNrCYpYx6E8K+jasjNiqU9vEX7KI=; b=C Zd7dFVg8bJuw+HUUSI11XpuC4KGyJfAuixOpbH5bmplfI6zHO02JXuu0+sksLrb/ 00H+2Ytb8nqINYpNMlQJl28zAmyzlL/xsdTSvNyIadSPzXIMM9e7sSRztQ7wlWBK 2+23+Hyzui6MIGbc7wbK6o3JU7zEdtz8JMjocH6QCluBaJ5CIzSev4i8n13oT8p3 QG+5/nfYp8VXL5jRFAawMdMJ0gWWpZ94s7dAyNTIItVpHzb/9e9V2UbI1fzKPAJH IDaTpK6cr4nzEM62XdMW6k9Ixxb7q2IzLpGZcugNF+5oXpuM7qv92qVQSURLeZFG pOKa/8a4e7QuMyojgD1DA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdektddggeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepkfffgggfuffhvfhfvegjtgfgsehtjeertddtvdej necuhfhrohhmpeffmhhithhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdrug gvvheqnecuggftrfgrthhtvghrnhepkedufeegjeeuudeuffefffdugeduffeltdeufeel geeiueehleelhedvveekueetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepughmihhtrhihsehguhhtohhvrdguvghvpdhnsggprhgtphhtthho peefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopeejfeektdduseguvggssghugh hsrdhgnhhurdhorhhgpdhrtghpthhtohepvghlihiisehgnhhurdhorhhgpdhrtghpthht ohepihesfhhuiiihrdhmvg X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 28 Oct 2024 22:44:15 -0400 (EDT) Message-ID: <1a2ab2c3-272a-41c8-af6f-6ed7348189df@gutov.dev> Date: Tue, 29 Oct 2024 04:44:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Dmitry Gutov References: <3b9816c7-bec3-4743-ad1a-49332c158099@gutov.dev> Content-Language: en-US In-Reply-To: <3b9816c7-bec3-4743-ad1a-49332c158099@gutov.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Since I see some changes added to the release branch still, On 28/10/2024 06:06, Dmitry Gutov wrote: > It would be nice to get either of the patches into Emacs 30, too, but it > might be a little late given where it is in the pretest. Eli, could we install either of the fixes for this bug to emacs-30 too? The one I installed on master is longer but should result in less I/O, while the patch by Zhengyi Fu is a one-liner, which might feel a little safer. From unknown Sun Jun 22 00:28:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#73801: 31.0.50; project-try-vc sometimes set wrong cache project-vc-extra-root-markers Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Oct 2024 13:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73801 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov Cc: i@fuzy.me, 73801@debbugs.gnu.org Received: via spool by 73801-submit@debbugs.gnu.org id=B73801.173020887919168 (code B ref 73801); Tue, 29 Oct 2024 13:35:01 +0000 Received: (at 73801) by debbugs.gnu.org; 29 Oct 2024 13:34:39 +0000 Received: from localhost ([127.0.0.1]:56423 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5mMp-0004z6-AW for submit@debbugs.gnu.org; Tue, 29 Oct 2024 09:34:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:40976) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5mMm-0004yw-OA for 73801@debbugs.gnu.org; Tue, 29 Oct 2024 09:34:38 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t5mMe-0000jX-8n; Tue, 29 Oct 2024 09:34:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=SzMSTDVeNA7BvwCrZzUU3X0TOt2QlrQ+3TgYUzdJFIw=; b=pMC+UyHPXhD5 JLGojQbVdxY+O2/rp7/5ugw4mvvmC4fCn4ABgB7u0GyvxWLGq55g33czkt93ry49xgzl9TzoirbeO +tfLEYcK7CZdIC0fUsASjwH9uEQrSGY8mZmcvY1qFsatGG68+9tbFZh2oGcC2kKexcJsf0C6F5WN5 weB5t7h2SqkpiGy73cVNERH+pIg+rNuy3nJjTPPpio+1KO+qEBecZlKMHPgeGLEK1/ZFBW7KXeoK6 wAVeCm+8UYP9qlWJCwqbO8cq3ItwoH3j4GqB2/WOa2Wg1gkeFUXI8j/kkIogy1D257o1LYYSYd7Do 6TkwFPURJV8RXBOVSzDY3g==; Date: Tue, 29 Oct 2024 15:33:36 +0200 Message-Id: <86sesf58zz.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <1a2ab2c3-272a-41c8-af6f-6ed7348189df@gutov.dev> (message from Dmitry Gutov on Tue, 29 Oct 2024 04:44:13 +0200) References: <3b9816c7-bec3-4743-ad1a-49332c158099@gutov.dev> <1a2ab2c3-272a-41c8-af6f-6ed7348189df@gutov.dev> X-Spam-Score: -1.6 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) > Date: Tue, 29 Oct 2024 04:44:13 +0200 > From: Dmitry Gutov > Cc: Zhengyi Fu > > Since I see some changes added to the release branch still, > > On 28/10/2024 06:06, Dmitry Gutov wrote: > > It would be nice to get either of the patches into Emacs 30, too, but it > > might be a little late given where it is in the pretest. > > Eli, could we install either of the fixes for this bug to emacs-30 too? > > The one I installed on master is longer but should result in less I/O, > while the patch by Zhengyi Fu is a one-liner, which might feel a little > safer. I don't understand the implications of that one-line (nor, TBH, the analysis of the original problem), so I'm not sure these changes are safe. How do we know that catering to this corner case will not screw other corner cases? It isn't the first time project.el needs to tiptoe between several valid outcomes using some pretty ad-hoc heuristic. From unknown Sun Jun 22 00:28:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#73801: 31.0.50; project-try-vc sometimes set wrong cache project-vc-extra-root-markers Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Oct 2024 20:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73801 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: i@fuzy.me, 73801@debbugs.gnu.org Received: via spool by 73801-submit@debbugs.gnu.org id=B73801.17302338764675 (code B ref 73801); Tue, 29 Oct 2024 20:32:01 +0000 Received: (at 73801) by debbugs.gnu.org; 29 Oct 2024 20:31:16 +0000 Received: from localhost ([127.0.0.1]:58625 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5ss0-0001DL-DG for submit@debbugs.gnu.org; Tue, 29 Oct 2024 16:31:16 -0400 Received: from fhigh-a2-smtp.messagingengine.com ([103.168.172.153]:36047) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5srx-0001DD-7U for 73801@debbugs.gnu.org; Tue, 29 Oct 2024 16:31:14 -0400 Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfhigh.phl.internal (Postfix) with ESMTP id 27D4711401E5; Tue, 29 Oct 2024 16:31:08 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Tue, 29 Oct 2024 16:31:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1730233868; x=1730320268; bh=akAVmJvsuqWRPxVpq5gh118UT4LlUw28SDbsAPJUz6E=; b= FrKw+Fs0Dw67YhbXW4m471UU1VFaTbXhBkLsemKO1ccRwml5OFa3WWPJIhF8D5lh T+pKUTSwCIb8pv6pq05MgiSL9vjMFDjEZ3KTrkP7oDxlqwVCqwAtQZ5B5Dgsstjj l6l0/gasajjIbSQQWvfKwIx07rviwWg/GW2gW90fKLgf/vHDNN5DF+eteodJwL7B z6j7bTwFr2UxP+uCDpVo6z2CfGi6vFihBkoNnLjc7g1/0wm9VH7+ci/XorsenbjU b86kuyYOSeCYXfoRpW736zKE4rBUEybuLkNxSp2ub1K5hZa66w6zblJSq/dA1brC gykreD+XRQv3AMTcdvOgvA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1730233868; x= 1730320268; bh=akAVmJvsuqWRPxVpq5gh118UT4LlUw28SDbsAPJUz6E=; b=V R0EvBchHQCBwniZrJigtELneOK42rvX/fpZfgaexG2Kcvbe7tZ2XIj0UBE5RcF7P tYc7Amnm7hisS9tz6y/8tM89k1PSOnkPl68k3+AKWO0nQU57KGjbbe3Mt290BDEI 4/C6FyZA/xB6D0tlDAohjOTZ7PzFisfvyn3x1+pBJtcvvWDhHHcljHg6RR2qglhU t66e4p9L6ouGUV4aJkCZFAE+gCmE5GZ18fL3RkoGjuD7TKpxnQRlqJ3gbP8ca3SM HeiWnxB7Sk9o5WjW3Fi1ReYYf/PlR6BoJyyUqw/HkdezEOCxpNmvuc5snSZUSbaf Bf1b8c5FQNvlQSoGa5Bog== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdekuddgudeffecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddv jeenucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrd guvghvqeenucggtffrrghtthgvrhhnpeetudeljeegheetgfehgeejkeeuhedvveeikeeu fedtvddtveefhfdvveegudejheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvhdpnhgspghrtghpthht ohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepvghlihiisehgnhhurdhorh hgpdhrtghpthhtohepjeefkedtudesuggvsggsuhhgshdrghhnuhdrohhrghdprhgtphht thhopehisehfuhiihidrmhgv X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 29 Oct 2024 16:31:05 -0400 (EDT) Message-ID: <9dc6f220-1748-4ed0-9c36-fffed80071f0@gutov.dev> Date: Tue, 29 Oct 2024 22:31:04 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird References: <3b9816c7-bec3-4743-ad1a-49332c158099@gutov.dev> <1a2ab2c3-272a-41c8-af6f-6ed7348189df@gutov.dev> <86sesf58zz.fsf@gnu.org> Content-Language: en-US From: Dmitry Gutov In-Reply-To: <86sesf58zz.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 29/10/2024 15:33, Eli Zaretskii wrote: >> Date: Tue, 29 Oct 2024 04:44:13 +0200 >> From: Dmitry Gutov >> Cc: Zhengyi Fu >> >> Since I see some changes added to the release branch still, >> >> On 28/10/2024 06:06, Dmitry Gutov wrote: >>> It would be nice to get either of the patches into Emacs 30, too, but it >>> might be a little late given where it is in the pretest. >> >> Eli, could we install either of the fixes for this bug to emacs-30 too? >> >> The one I installed on master is longer but should result in less I/O, >> while the patch by Zhengyi Fu is a one-liner, which might feel a little >> safer. > > I don't understand the implications of that one-line (nor, TBH, the > analysis of the original problem), so I'm not sure these changes are > safe. The original problem was due to project-try-vc being invoked recursively on a parent directory while a variable that affects its computation is bound to nil. The function itself (project-try-vc) memoizes its return value. As a result, any subsequent call to it with the same argument outside of the said binding could return wrong result. The first fix (one-liner) made sure that we're calling it with the same argument that is passed to the current call, ensuring that the cache will be rewritten after it returns. The second fix (mine) was to extract the value computation into a helper function, making the recursive call to not be memoized. > 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) ... From unknown Sun Jun 22 00:28:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#73801: 31.0.50; project-try-vc sometimes set wrong cache project-vc-extra-root-markers Resent-From: Zhengyi Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 31 Oct 2024 05:23:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73801 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov Cc: Zhengyi Fu , 73801@debbugs.gnu.org Received: via spool by 73801-submit@debbugs.gnu.org id=B73801.17303521333601 (code B ref 73801); Thu, 31 Oct 2024 05:23:03 +0000 Received: (at 73801) by debbugs.gnu.org; 31 Oct 2024 05:22:13 +0000 Received: from localhost ([127.0.0.1]:39862 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6NdM-0000vw-7N for submit@debbugs.gnu.org; Thu, 31 Oct 2024 01:22:13 -0400 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:42979) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6Lhr-0004iN-Go for 73801@debbugs.gnu.org; Wed, 30 Oct 2024 23:18:45 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id F30EAC0003; Thu, 31 Oct 2024 03:18:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fuzy.me; s=gm1; t=1730344697; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=vrwEEd4UdVUhfydtpMzbH2FILoH0eqodfJhfW38ohrg=; b=QWlWj0Dh1agDJ3e3S+mKmOqWqQnIfR7OlCnpI24zbg4UrFBQ+TWuv6SjAZEraeHFTHWzz3 lypCr4TJafZz8Q073q7WZHA6BKDIdXvoCwI/1rNaGZgCKKfff/28JrKr4LOJJFariy0Ssj uXM0okw2bcVchoQHe1GWIbLqf9LlueByyE4KcscL5fRa3dr2N29DFutFUUtxrtwzmq37s8 7MurlxqIlbrXIZrrOWPEwJ77duZEQ0cztHv6exQFz/wljAG+ewhvE8conneHY7Hpp6EFHt mR6+VV+hMlL6zisw35uUvHmO3FqWGqV4SOlSCspFxCok4xYZHdYbEkzQzigA4A== From: Zhengyi Fu In-Reply-To: <3b9816c7-bec3-4743-ad1a-49332c158099@gutov.dev> (Dmitry Gutov's message of "Mon, 28 Oct 2024 06:06:17 +0200") References: <3b9816c7-bec3-4743-ad1a-49332c158099@gutov.dev> Date: Thu, 31 Oct 2024 11:15:09 +0800 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: id@fuzy.me X-Spam-Score: -0.7 (/) X-Mailman-Approved-At: Thu, 31 Oct 2024 01:22:10 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi! I've tried your patch and it works for me. Thanks! From unknown Sun Jun 22 00:28:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#73801: 31.0.50; project-try-vc sometimes set wrong cache project-vc-extra-root-markers Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 31 Oct 2024 10:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73801 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov Cc: i@fuzy.me, 73801@debbugs.gnu.org Received: via spool by 73801-submit@debbugs.gnu.org id=B73801.17303692037525 (code B ref 73801); Thu, 31 Oct 2024 10:07:02 +0000 Received: (at 73801) by debbugs.gnu.org; 31 Oct 2024 10:06:43 +0000 Received: from localhost ([127.0.0.1]:41358 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6S4g-0001xJ-RV for submit@debbugs.gnu.org; Thu, 31 Oct 2024 06:06:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51092) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6S4e-0001xA-Dg for 73801@debbugs.gnu.org; Thu, 31 Oct 2024 06:06:41 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6S4Y-0003tp-2X; Thu, 31 Oct 2024 06:06:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=VQ9msztdjgpmEGlpzum3S92zEwBsBgMgFi7GfL3kL6c=; b=VmlM6v0fjVcT 7Su4xTkMZoJkO/uyzDfSR58ejNpJmANqGYVQQm6xPvoIzNFlgsJp0A1fRgU5kwBPr/lEr8DYn0f2h O2Bm/mvFhruUHRiRKNNu0FP0Pfx/sbvutNhlIDkCev9LXCWhGsv3u5JEa9IremmFdpdt/R1DlvHw7 WiVvV7hmMtfFyS3eQrdoGQj9Xr1WJ5W0ek5vaX1TuR+cVMj5V/bsJ+Sfl3zzpM5BswNRfUNicdIDI R7M9LSxaJXrPWdLA7vi8iUgpeGk81OBq9YmQnL2J1u6yWfMRJ6Oncqewy4y+/wgdL6kA2o5fzjVuY 8Dae7t7qjUWHGT83SHfe5g==; Date: Thu, 31 Oct 2024 12:06:31 +0200 Message-Id: <86r07w37tk.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <9dc6f220-1748-4ed0-9c36-fffed80071f0@gutov.dev> (message from Dmitry Gutov on Tue, 29 Oct 2024 22:31:04 +0200) References: <3b9816c7-bec3-4743-ad1a-49332c158099@gutov.dev> <1a2ab2c3-272a-41c8-af6f-6ed7348189df@gutov.dev> <86sesf58zz.fsf@gnu.org> <9dc6f220-1748-4ed0-9c36-fffed80071f0@gutov.dev> X-Spam-Score: -1.6 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) > Date: Tue, 29 Oct 2024 22:31:04 +0200 > Cc: 73801@debbugs.gnu.org, i@fuzy.me > From: Dmitry Gutov > > On 29/10/2024 15:33, Eli Zaretskii wrote: > >> Date: Tue, 29 Oct 2024 04:44:13 +0200 > >> From: Dmitry Gutov > >> Cc: Zhengyi Fu > >> > >> Since I see some changes added to the release branch still, > >> > >> On 28/10/2024 06:06, Dmitry Gutov wrote: > >>> It would be nice to get either of the patches into Emacs 30, too, but it > >>> might be a little late given where it is in the pretest. > >> > >> Eli, could we install either of the fixes for this bug to emacs-30 too? > >> > >> The one I installed on master is longer but should result in less I/O, > >> while the patch by Zhengyi Fu is a one-liner, which might feel a little > >> safer. > > > > I don't understand the implications of that one-line (nor, TBH, the > > analysis of the original problem), so I'm not sure these changes are > > safe. > > The original problem was due to project-try-vc being invoked recursively > on a parent directory while a variable that affects its computation is > bound to nil. The function itself (project-try-vc) memoizes its return > value. As a result, any subsequent call to it with the same argument > outside of the said binding could return wrong result. > > The first fix (one-liner) made sure that we're calling it with the same > argument that is passed to the current call, ensuring that the cache > will be rewritten after it returns. > > The second fix (mine) was to extract the value computation into a helper > function, making the recursive call to not be memoized. > > > 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. From unknown Sun Jun 22 00:28:46 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Zhengyi Fu Subject: bug#73801: closed (Re: bug#73801: 31.0.50; project-try-vc sometimes set wrong cache project-vc-extra-root-markers) Message-ID: References: X-Gnu-PR-Message: they-closed 73801 X-Gnu-PR-Package: emacs Reply-To: 73801@debbugs.gnu.org Date: Fri, 01 Nov 2024 00:50:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1730422202-1926-1" This is a multi-part message in MIME format... ------------=_1730422202-1926-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #73801: 31.0.50; project-try-vc sometimes set wrong cache project-vc-extra-= root-markers which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 73801@debbugs.gnu.org. --=20 73801: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D73801 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1730422202-1926-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 73801-done) by debbugs.gnu.org; 1 Nov 2024 00:49:37 +0000 Received: from localhost ([127.0.0.1]:45377 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6fr6-0000UV-VI for submit@debbugs.gnu.org; Thu, 31 Oct 2024 20:49:37 -0400 Received: from fout-a7-smtp.messagingengine.com ([103.168.172.150]:52641) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6fr3-0000UM-QX for 73801-done@debbugs.gnu.org; Thu, 31 Oct 2024 20:49:35 -0400 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfout.phl.internal (Postfix) with ESMTP id 71585138025A; Thu, 31 Oct 2024 20:49:28 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-12.internal (MEProxy); Thu, 31 Oct 2024 20:49:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm2; t=1730422168; x=1730508568; bh=eaVcy5T2oQ0wiygU5vCKi6f91EN5VpRwMn9EvmO0lCA=; b= iQun4PmaieUQ9vKqWj2c2mV9SKtoKcCVXXiTJiQrYRhydyjNFawLATvpNAAuQPJd 1+jblwRdt5zgJKjAq1FlqIUblNW0vgV9lwPntfX7+FeyVdoQGS80eBLLGxQWsXSx baS5ffcpGLSWg5BzKIMlAaNL/8bCLyIw9wV2hsIFjYbg+j6jSORj4POni5uTrJCI l72qGTPHKc7tW9W5F02+5JaK+aEiXdKT4nhNFB+WHnmTlBWSOdMeM9+xLZywla2g xzyw8KGplXYrKLeWAS84TylgHboYZBLGKlciKR7X1jSPgULZ15HqB6Xa4ZOIr4Qd j7+FrIIb4T9vscJ4lwk0zg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1730422168; x= 1730508568; bh=eaVcy5T2oQ0wiygU5vCKi6f91EN5VpRwMn9EvmO0lCA=; b=K pv1Ac8R2Q1bHjU4z2l2Q6P/Iy/z2td2mZ6BRZNt9Lepf0g9dufJ1MPD7IpjonzOz XDSit3gY42Jz/tOR7IBbsW0fh6KGzjfC+ngHIpfnnogdyWbfHnQYNsiFYoy1ARkG +bOvMgnlzIkbdjnOGkr2B640fjQp0RZn+XM8bDGu3QK39OS3csoCb/H3s8P+iHTW pfdxYG8Us0iS0NIDwYxGrYhgpVsOHMT4LTvrr1GgohbOqvYcZkeBH2ByElHJCHcQ 6cSxrFirIZ2/9CGP0aIQDSOr1pTHupEkJy2kKbBlY3kUKxRaLJfBA7/1DYfdRRmS QXSmTo6EGl18IprEMsJ7w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdekkedgvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtvdej necuhfhrohhmpeffmhhithhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdrug gvvheqnecuggftrfgrthhtvghrnhepteduleejgeehtefgheegjeekueehvdevieekueef tddvtdevfefhvdevgedujeehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepughmihhtrhihsehguhhtohhvrdguvghvpdhnsggprhgtphhtthho peefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegvlhhiiiesghhnuhdrohhrgh dprhgtphhtthhopeejfeektdduqdguohhnvgesuggvsggsuhhgshdrghhnuhdrohhrghdp rhgtphhtthhopehisehfuhiihidrmhgv X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 31 Oct 2024 20:49:27 -0400 (EDT) Message-ID: Date: Fri, 1 Nov 2024 02:49:24 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#73801: 31.0.50; project-try-vc sometimes set wrong cache project-vc-extra-root-markers To: Eli Zaretskii References: <3b9816c7-bec3-4743-ad1a-49332c158099@gutov.dev> <1a2ab2c3-272a-41c8-af6f-6ed7348189df@gutov.dev> <86sesf58zz.fsf@gnu.org> <9dc6f220-1748-4ed0-9c36-fffed80071f0@gutov.dev> <86r07w37tk.fsf@gnu.org> Content-Language: en-US From: Dmitry Gutov In-Reply-To: <86r07w37tk.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 73801-done Cc: i@fuzy.me, 73801-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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. ------------=_1730422202-1926-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 14 Oct 2024 08:16:02 +0000 Received: from localhost ([127.0.0.1]:35233 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0GFF-0002Z7-Lo for submit@debbugs.gnu.org; Mon, 14 Oct 2024 04:16:02 -0400 Received: from lists.gnu.org ([209.51.188.17]:54462) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t0Edj-0003g7-MY for submit@debbugs.gnu.org; Mon, 14 Oct 2024 02:33:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t0EdN-0001yq-Jc for bug-gnu-emacs@gnu.org; Mon, 14 Oct 2024 02:32:51 -0400 Received: from relay1-d.mail.gandi.net ([2001:4b98:dc4:8::221]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t0EdK-00013f-Qk for bug-gnu-emacs@gnu.org; Mon, 14 Oct 2024 02:32:49 -0400 Received: by mail.gandi.net (Postfix) with ESMTPSA id 9CC50240004 for ; Mon, 14 Oct 2024 06:32:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fuzy.me; s=gm1; t=1728887561; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pMeIpjz9IDxcjvYnYSeWGcLBeIJNUAJsNUErBIkOv1s=; b=ZC+eqmemVGO/YDt1cByG+b63FMs4uyeCNawrrLSRrnBCXILjp0OhbsLE8zrlOxMs3k2zLP bgvTiJjdMFoM8kDYbhIQEItpXd3NyUUVclC8R4bXEqiNGoDbgV0usw8J/UvSVZ1QKr8QP9 WyNf6ffl0uQ+LCg/afHC9+Izh8LPpbzPE6anmu4bOx4xec/U721HTr4e/XKLy7SQ/rmxGs ZeaR+6/1HzL9EtZuEFCGO5aaFwbYuUyzs5cQl2vhznJDJ6AuAiaE84lBaorGIsVx5VLDKt iiZO9knTPlkmFwYseK4jmQ5NpQ7eZ4qL7CJfXl0A7Y6h4YVgXhI9FkYWM9u9fg== From: Zhengyi Fu To: bug-gnu-emacs@gnu.org Subject: 31.0.50; project-try-vc sometimes set wrong cache project-vc-extra-root-markers X-Debbugs-Cc: Date: Mon, 14 Oct 2024 14:29:48 +0800 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: id@fuzy.me Received-SPF: pass client-ip=2001:4b98:dc4:8::221; envelope-from=i@fuzy.me; helo=relay1-d.mail.gandi.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 14 Oct 2024 04:15:59 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.6 (--) Consider the following project: test-project/ =E2=94=9C=E2=94=80=E2=94=80 .git/ =E2=94=94=E2=94=80=E2=94=80 subproject/ =E2=94=9C=E2=94=80=E2=94=80 marker =E2=94=94=E2=94=80=E2=94=80 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. ------------=_1730422202-1926-1--