From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#59064: 29.0.50; build problem git worktree linked to main worktree (repo) Date: Sun, 06 Nov 2022 18:38:34 +0000 Message-ID: <87h6zcnd1x.fsf@posteo.net> References: <87y1so1fso.fsf@no.workgroup> <87iljsruwz.fsf@no.workgroup> <87v8nsaqxp.fsf@rfc20.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24107"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Gregor Zattler , 59064@debbugs.gnu.org To: Matt Armstrong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 06 19:39:22 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 1orkYD-00062v-Oh for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 06 Nov 2022 19:39:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1orkXw-0000HP-1I; Sun, 06 Nov 2022 13:39:04 -0500 Original-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 1orkXu-0000H5-CC for bug-gnu-emacs@gnu.org; Sun, 06 Nov 2022 13:39:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1orkXu-0001bv-3k for bug-gnu-emacs@gnu.org; Sun, 06 Nov 2022 13:39:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1orkXt-0006N2-SD for bug-gnu-emacs@gnu.org; Sun, 06 Nov 2022 13:39:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Nov 2022 18:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59064 X-GNU-PR-Package: emacs Original-Received: via spool by 59064-submit@debbugs.gnu.org id=B59064.166775992824466 (code B ref 59064); Sun, 06 Nov 2022 18:39:01 +0000 Original-Received: (at 59064) by debbugs.gnu.org; 6 Nov 2022 18:38:48 +0000 Original-Received: from localhost ([127.0.0.1]:60574 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1orkXf-0006MW-Vq for submit@debbugs.gnu.org; Sun, 06 Nov 2022 13:38:48 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]:44197) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1orkXc-0006MI-AU for 59064@debbugs.gnu.org; Sun, 06 Nov 2022 13:38:46 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 0D019240101 for <59064@debbugs.gnu.org>; Sun, 6 Nov 2022 19:38:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1667759918; bh=YPhCebBfiFaPqKlUtSiXIor+tOcGTVjT0wiLNi1+wz0=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=M7ir3zYBu/psTK4k+nBEMhJ1TnUM/fTc3Fd1My/Pps4okEcirDGOuzL7OCt2HQYqi hD4/2ko0qNGWNqi+gYDMUmcuNZfE39mHqIkWRH0snpK3+LGqptjFM+9GcwY8usQx1D nd6S+JsmV5MeMaofNafCxbiTYbrO+uaMA7yPedDhIsN302ZVl2cxvJJyaIzyrnnZQn HZZhZrWApnZ6Hf9PkBNnXbvKJr66FFNPLRHDKOORNzwZD4sFnrk7jRdGCfG1u5MhQ9 EDnW5t4XWUEdNQoTpiFnaKG2fMUGuHJOJ2sZ+Nw3/C9DJKecS4A4OfkUrPPC3TVYu7 Ps+7lmZIK34Yw== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4N5362742rz9rxW; Sun, 6 Nov 2022 19:38:34 +0100 (CET) In-Reply-To: <87v8nsaqxp.fsf@rfc20.org> (Matt Armstrong's message of "Sun, 06 Nov 2022 10:17:06 -0800") Autocrypt: addr=philipk@posteo.net; keydata= mQGNBGLfygUBDADVznbke6w0n9nE42xb+ZggbBy0IYRkkru/K+NA67523YTl2DoR2a5OMW90w7L9 KDtX2Mp34JN/6jVOSVC07VUbHVu6/exoGKixkiTpGhBPy5tUUJoxQKqLrzVQhN3fIyvg1oyHXKZm QGkUeevV0wjj4++xfjmcP235YvDh3TF8HC9t5KxIQIbhWnQm4ZyDkpWWS2CmdNttlj2+eH+51WLL bgx2bcwTmqrs079Q3hgF3yh44bBEmp9MgFjiZldOY2my0/ZSeucRxYmiM0vbJEBQgZV/MvA3gTxe 7ibV3ii7AyoYA8FiFDP98S/R2y5Nfq3ez9B7qeqtpSNseQHOU7h8Y5VV01a71ZszENAmbbwsldb9 j+HRLke7rn6mswDZl1qA/9ZFRzliFOdQtS1878XjraY+h5jfjvxaFVK23prGGVrrKv0LPWavoFUr nsjeHEZhYezBKhC2PwvRtXm01S3rkNbwm9pj0tfLSDW+1pT+6eZWptfQCXF2oEvgfKSTASUAEQEA AbQmUGhpbGlwIEthbHVkZXJjaWMgPHBoaWxpcGtAcG9zdGVvLm5ldD6JAdQEEwEKAD4WIQRxJuHe LwzjXHcL7QHyw8xRPbifZgUCYt/KBQIbAwUJA8JnAAULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAK CRDyw8xRPbifZkH+DACmCKmhrYgcv2i6dj3vRCVINaLtKUODTna/wAmP20WRKPhqvqvKNUx/wzpT aZrXIxpxOU2xawRWeHhWUktxS+W9L3xTACeR0gf5gomCxD9RuBTIohzWDkQt5rk8QwLqx5rAy5 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:247231 Archived-At: Matt Armstrong writes: > X-Debbugs-CC: Philip Kaludercic > > Hi Philip, this bug manifests for Gregor as Emacs build error in a > particular kind of git repository, but it is really a problem with > `vc-git-mode-line-string' caused by a recent commit of yours to > `vc-working-revision'. Could you take a look? Could this be a duplicate of bug#58709 or bug#59011? I have argued in both threads that the commit ought to be reversed. This particular issue could be resolved by making the code more robust and removing the hard-coded assumption about how git revisions have to look like. > Gregor Zattler writes: > >> I will try to bisect. But since I have no clue regarding the build >> system I only hope that this will not hit other build failures in >> between. This will take days... > > Gregor, no need to bisect. Your most recent instructions helped. This > is not a mysterious problem with the build system, but a simpler one > with a recent regression in Emacs' vc-mode. > > The steps to reproduce are simple: > > 1) In the root directory of an existing Emacs git repository, run this: > > git switch master > git worktree add -d ../b59064 > > Note that the -d is important. This creates a "detached" work tree > attached to no branch at all, but just happens to be at the same rev > as "master". > > 2) cd ../b59064 > > 3) git status > > Confirm this prints "Not currently on any branch." > > 3) emacs -Q (using a recent Emacs built on master, not one built in > this new repository) > > 3) M-: (setq debug-on-error t) > > Edit any file in this repository, I did C-x C-f "INSTALL". You may then > need to run M-x vc-mode. > > You get the following problem in `vc-git-mode-line-string': > > Debugger entered--Lisp error: (args-out-of-range "master" 0 7) > vc-git-mode-line-string("/home/matt/git/e/b59064/admin/grammars/srecode-tem...") > apply(vc-git-mode-line-string "/home/matt/git/e/b59064/admin/grammars/srecode-tem...") > vc-call-backend(Git mode-line-string "/home/matt/git/e/b59064/admin/grammars/srecode-tem...") > vc-mode-line("/home/matt/git/e/b59064/admin/grammars/srecode-tem..." Git) > vc-refresh-state() > run-hooks(find-file-hook) > after-find-file(nil t) > find-file-noselect-1(# "~/git/e/b59064/admin/grammars/srecode-template.wy" nil nil "~/git/e/b59064/admin/grammars/srecode-template.wy" (67952095 27)) > find-file-noselect("/home/matt/git/e/b59064/admin/grammars/srecode-tem..." nil nil nil) > find-file("/home/matt/git/e/b59064/admin/grammars/srecode-tem...") > dired--find-file(find-file "/home/matt/git/e/b59064/admin/grammars/srecode-tem...") > dired--find-possibly-alternative-file("/home/matt/git/e/b59064/admin/grammars/srecode-tem...") > dired-find-file() > funcall-interactively(dired-find-file) > call-interactively(dired-find-file nil nil) > command-execute(dired-find-file) > > The `vc-git-mode-line-string' code assumes that if > `vc-git--symbolic-ref` returns nil then `vc-working-revision' must > necessarily return a full hex git rev ID, so it unconditionally performs > the following on that value: > > (substring rev 0 7) > > However, Philip Kaludercic's recent commit 307ad210040 changed > `vc-working-revision' to resolve a hex ID to a symbolic revision if > possible, so in this case the function returns "master", causing > `substring' to signal as above. > > This is not currently a problem in "normal" git trees because the > following command works in them: > > git symbolic-ref HEAD > > ...and this is what vc-git-mode-line-string normally uses to construct > the displayed revision used in that line. > > In detached worktrees that command fails: > > $ git symbolic-ref HEAD > fatal: ref HEAD is not a symbolic ref > > ...yet the following works: > > $ git rev-parse HEAD > 6e5ec085510ccf52ac6cb07c3a1a2778324a1d89 > > ...and from that we can get to a symbolic name (the new code Philip > added to `vc-working-revision'): > > $ git name-rev --no-undefined --name-only 6e5ec085510ccf52ac6cb07c3a1a2778324a1d89 > master > > Arguably, `vc-git-mode-line-string' should no longer call > `vc-working-revision' but instead a lower level variation that must > return the hex rev id. Perhaps?