From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mike Woolley Newsgroups: gmane.emacs.bugs Subject: bug#57777: 28.2; `vc-dir' picks incorrect backend. Date: Thu, 15 Sep 2022 15:53:32 +0100 Message-ID: References: <29088AD9-36ED-4D7D-A0A0-6D17C79F065F@bulsara.com> <8735cu81rc.fsf@gnus.org> <87wna66n0h.fsf@gnus.org> <87sfku6moz.fsf@gnus.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_2821B0C1-CDE2-478F-A7DC-F742B3EB584A" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24382"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 57777@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 15 16:55:05 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oYqGf-0006Aa-5s for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 15 Sep 2022 16:55:05 +0200 Original-Received: from localhost ([::1]:58786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oYqGd-0005SM-QY for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 15 Sep 2022 10:55:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oYqFq-0005Ou-F0 for bug-gnu-emacs@gnu.org; Thu, 15 Sep 2022 10:54:16 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:41933) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oYqFe-00046t-T1 for bug-gnu-emacs@gnu.org; Thu, 15 Sep 2022 10:54:14 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oYqFe-00049x-IR for bug-gnu-emacs@gnu.org; Thu, 15 Sep 2022 10:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mike Woolley Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 15 Sep 2022 14:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57777 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 57777-submit@debbugs.gnu.org id=B57777.166325362915965 (code B ref 57777); Thu, 15 Sep 2022 14:54:02 +0000 Original-Received: (at 57777) by debbugs.gnu.org; 15 Sep 2022 14:53:49 +0000 Original-Received: from localhost ([127.0.0.1]:58865 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oYqFN-00049L-QZ for submit@debbugs.gnu.org; Thu, 15 Sep 2022 10:53:49 -0400 Original-Received: from mailout.easymail.ca ([64.68.200.34]:60616) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oYqFK-000492-4q for 57777@debbugs.gnu.org; Thu, 15 Sep 2022 10:53:43 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id AF1C46439C; Thu, 15 Sep 2022 14:53:34 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at emo07-pco.easydns.vpn Original-Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo07-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Re2e5djA98rd; Thu, 15 Sep 2022 14:53:34 +0000 (UTC) Original-Received: from smtpclient.apple (97e60a2a.skybroadband.com [151.230.10.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id 11353640B8; Thu, 15 Sep 2022 14:53:33 +0000 (UTC) In-Reply-To: <87sfku6moz.fsf@gnus.org> X-Mailer: Apple Mail (2.3696.120.41.1.1) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:242598 Archived-At: --Apple-Mail=_2821B0C1-CDE2-478F-A7DC-F742B3EB584A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Thanks for looking at this Lars. The steps you tried also work correctly for me, so clearly the problem = is a bit more specific than I initially thought! I stepped through `vc-responsible-backend=E2=80=99 in the debugger when = executing `vc-dir=E2=80=99 on one of the directories where I have this = problem (my home directory in the following example). This bit of code: (vc-call-backend backend 'responsible-p file) returns "~/=E2=80=9C for the Git backend, but "/Users/mike/=E2=80=9C for = the CVS backend. Further down, this next bit of code looks for the longest directory = string in an attempt to find the deepest subdirectory: ;; Several roots; we seem to have one vc inside another's ;; directory. Choose the most specific. (caar (sort dirs (lambda (d1 d2) (< (length (cdr d2)) (length (cdr d1)))))))) Which explains why it picks the CVS backend, because "/Users/mike/=E2=80=9C= is longer than "~/=E2=80=9C =F0=9F=98=8A So in other words, the missing step from my instructions is the = directory has to be under the user=E2=80=99s home directory. I would have thought the fix would be either to make `responsible-p=E2=80=99= return the same string or expand the =E2=80=9C~=E2=80=9D before = executing the length comparison above. Thanks, Mike > On 14 Sep 2022, at 15:43, Lars Ingebrigtsen wrote: >=20 > Lars Ingebrigtsen writes: >=20 >>> I'm unable to reproduce this problem with Emacs 28.2 (or the current >>> trunk). >>=20 >> Sorry; I was testing in the wrong checkout -- I'm now rebuilding the >> real emacs-28.2 release and will re-test. >=20 > I've now redone the tests, but I'm still not able to reproduce the > problem. --Apple-Mail=_2821B0C1-CDE2-478F-A7DC-F742B3EB584A Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Thanks for looking at this Lars.

The steps you tried also work correctly = for me, so clearly the problem is a bit more specific than I initially = thought!

I = stepped through `vc-responsible-backend=E2=80=99 in the debugger when = executing `vc-dir=E2=80=99 on one of the directories where I have this = problem (my home directory in the following example).
This bit of code:

 (vc-call-backend backend = 'responsible-p file)

returns "~/=E2=80=9C for the Git backend, = but "/Users/mike/=E2=80=9C for the CVS backend.

Further = down, this next bit of code looks for the longest directory string in an = attempt to find the deepest subdirectory:

  ;; Several roots; we = seem to have one vc inside another's
  ;; = directory.  Choose the most specific.
  (caar (sort dirs (lambda (d1 d2)
                =      (< (length (cdr d2)) (length (cdr = d1))))))))

Which explains why it picks the CVS backend, = because "/Users/mike/=E2=80=9C is longer than "~/=E2=80=9C = =F0=9F=98=8A

So = in other words, the missing step from my instructions is the directory = has to be under the user=E2=80=99s home directory.

I would have thought the = fix would be either to make `responsible-p=E2=80=99 return the same = string or expand the =E2=80=9C~=E2=80=9D before executing the length = comparison above.

Thanks,
Mike

On 14 Sep 2022, at 15:43, Lars Ingebrigtsen <larsi@gnus.org> = wrote:

Lars Ingebrigtsen <larsi@gnus.org> writes:

I'm unable to reproduce this problem with Emacs 28.2 (or the = current
trunk).

Sorry; I was testing in the wrong checkout -- I'm now = rebuilding the
real emacs-28.2 release and will = re-test.

I've now redone the = tests, but I'm still not able to reproduce the
problem.

= --Apple-Mail=_2821B0C1-CDE2-478F-A7DC-F742B3EB584A--