From unknown Fri Aug 15 12:54:58 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#49683 <49683@debbugs.gnu.org> To: bug#49683 <49683@debbugs.gnu.org> Subject: Status: Unable to open file under Git VC Reply-To: bug#49683 <49683@debbugs.gnu.org> Date: Fri, 15 Aug 2025 19:54:58 +0000 retitle 49683 Unable to open file under Git VC reassign 49683 emacs submitter 49683 Yan Gajdos severity 49683 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 21 11:51:20 2021 Received: (at submit) by debbugs.gnu.org; 21 Jul 2021 15:51:20 +0000 Received: from localhost ([127.0.0.1]:38394 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m6EVE-0000kg-24 for submit@debbugs.gnu.org; Wed, 21 Jul 2021 11:51:20 -0400 Received: from lists.gnu.org ([209.51.188.17]:47114) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m6EHc-0000Mn-7d for submit@debbugs.gnu.org; Wed, 21 Jul 2021 11:37:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m6EHb-0000GQ-Up for bug-gnu-emacs@gnu.org; Wed, 21 Jul 2021 11:37:15 -0400 Received: from mailrelay4-1.pub.mailoutpod1-cph3.one.com ([46.30.210.185]:30812) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m6EHZ-0002YY-0o for bug-gnu-emacs@gnu.org; Wed, 21 Jul 2021 11:37:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gajdos.info; s=20191106; h=to:message-id:subject:date:mime-version:content-transfer-encoding: content-type:from:from; bh=Wf2rnv/IKUwn7lpfGwGG32uDWKAK2HIJeS+bki5J5dA=; b=tTYGiHc5Q9bAtRydEDcWwEORD9MsWTOE7DhPnWDG+hDlVcs1wFwJwNkg932OsJgY57AEaNaNeaxu9 UAwZEgUanmPj2+ofx1mipxCcKlPS+VID1NhHZwEpnNbn3DhnqXrCdsx/iLwhPn+75WnNbFrsg5sjov sYbdXbY4iPNkuizL/USmJD/gA+1RcEp10iZ3P4uhGGbafEYvdDjbLnMC4mGk44gkiFTDECGJIzg/bM XgdgoQPXv62UsewVPdcWhbBdcCrIB/GGxwO2Z7aJZdByykqtXwrJbCwBjaXbJENNTDazaTaXLXuaHK /jcrRcYAU7R12LyQU0dvew9Iqelwp7A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gajdos.info; s=rsa1; h=to:message-id:subject:date:mime-version:content-transfer-encoding: content-type:from:from; bh=Wf2rnv/IKUwn7lpfGwGG32uDWKAK2HIJeS+bki5J5dA=; b=iuTpwFXEAxhJVArTKGLGlGhA1DzQbz5z58r1E+yjxl8uzAyVQhBwuylURm+qsThNyQ0WcZ8ula7JC /0zQR6Cbb5CF2AhAasMt6Q1+AI3lChDvnaRqyktgx/YA7WHkzhYvUomPZiry4qu971m88KKExOw/RJ JdmhgURe4L0tXCAzxe9rDY77UwTaZhAUeC6f9PRHiQChue4Qb3hfkigzUxAnjW5dvVzT9yR3BNpKl6 QSNmZCxT34d0V9vV22ee+P26M7dYjA0C3mZKSzCEMv6OS9mdfnzaYXKAUPDR8vUHO0Ef3u/pCsEnGG 3UdyTnnylsEtvvnYZJDxlq7Jh0lvvig== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=gajdos.info; s=ed1; h=to:message-id:subject:date:mime-version:content-transfer-encoding: content-type:from:from; bh=Wf2rnv/IKUwn7lpfGwGG32uDWKAK2HIJeS+bki5J5dA=; b=CdCsb1mgZ1hD8O19Nt029sUXtdNoqADQYCpRKOk5TowqoRvWP6JfDZX3r1GIGRjgceuroyhy/Q9Q4 EWr6Ah9CQ== X-HalOne-Cookie: c52d691d585db2cd8a35007a9c1e005d254f9000 X-HalOne-ID: 80c2d05c-ea39-11eb-adf8-d0431ea8bb10 Received: from [192.168.1.132] (h-178-174-193-110.na.cust.bahnhof.se [178.174.193.110]) by mailrelay4.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 80c2d05c-ea39-11eb-adf8-d0431ea8bb10; Wed, 21 Jul 2021 15:37:06 +0000 (UTC) From: Yan Gajdos Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Date: Wed, 21 Jul 2021 17:37:05 +0200 Subject: Unable to open file under Git VC Message-Id: <54C95169-53B1-45E2-9957-F5DE51430E8C@gajdos.info> To: bug-gnu-emacs@gnu.org X-Mailer: Apple Mail (2.3608.120.23.2.7) Received-SPF: none client-ip=46.30.210.185; envelope-from=yan@gajdos.info; helo=mailrelay4-1.pub.mailoutpod1-cph3.one.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 21 Jul 2021 11:51:19 -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: -3.3 (---) Emacs kept refusing to open a file with 'emacs lisp/wang/wang.lisp' and = instead reported: vc-git-mode-line-string: Wrong type argument: arrayp, nil Adding (setq debug-on-error t) at the beginning of vc-git-mode-line-string reveals the problem: Debugger entered--Lisp error: (wrong-type-argument arrayp nil) substring(nil 0 7) (or (vc-git--symbolic-ref file) (substring rev 0 7)) (let* ((rev (vc-working-revision file 'Git)) (disp-rev (or = (vc-git--symbolic-ref file) (substring rev 0 7))) (def-ml = (vc-default-mode-line-string 'Git file)) (help-echo (get-text-property 0 = 'help-echo def-ml)) (face (get-text-property 0 'face def-ml))) = (propertize (concat (substring def-ml 0 4) disp-rev) 'face face = 'help-echo (concat help-echo "\nCurrent revision: " rev))) vc-git-mode-line-string("/src/xxx/lisp/wang/wang.lisp") apply(vc-git-mode-line-string "/src/xxx/lisp/wang/wang.lisp") vc-call-backend(Git mode-line-string "/src/xxx/lisp/wang/wang.lisp") vc-mode-line("/src/xxx/lisp/wang/wang.lisp" Git) vc-refresh-state() run-hooks(find-file-hook) after-find-file(nil t) find-file-noselect-1(# = "/src/xxx/lisp/wang/wang.lisp" nil nil = "/Users/Shared/cl/my/wang/wang.lisp" (133696873 16777221)) find-file-noselect("/src/xxx/lisp/wang/wang.lisp" nil nil t) find-file("/src/xxx/lisp/wang/wang.lisp" t) funcall-interactively(find-file "/src/xxx/lisp/wang/wang.lisp" t) call-interactively(find-file nil nil) command-execute(find-file) Explanation: The file used to be in a Git hierarchy, but its directory was moved, and = this directory is only pointed to with a symbolic link now. This seems to give the impression that it both is and isn't under = version control, so vc-working-revision returning nil causes the issue. Solution: Only attempt to get substring of rev if rev is non-nil. Patch: ----- =46rom 4814217010157fb1e8041b6613c6deda70caf51c Mon Sep 17 00:00:00 2001 From: Yan Date: Wed, 21 Jul 2021 16:11:08 +0200 Subject: [PATCH] Ensure git revision exists --- lisp/vc/vc-git.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 89f9800..5828a83 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -375,7 +375,7 @@ (defun vc-git-mode-line-string (file) "Return a string for `vc-mode-line' to put in the mode line for = FILE." (let* ((rev (vc-working-revision file 'Git)) (disp-rev (or (vc-git--symbolic-ref file) - (substring rev 0 7))) + (and rev (substring rev 0 7)))) (def-ml (vc-default-mode-line-string 'Git file)) (help-echo (get-text-property 0 'help-echo def-ml)) (face (get-text-property 0 'face def-ml))) --=20 2.32.0 ----- Works like a charm. Feel free to use or improve. /Yan P.S. Probably unnecessarily lengthy attempt at an explanation of the reason = for the issue: The file was checked in while it was still in the original hierarchy: = /src/xxx/lisp/ /src/xxx/.git is the repository location. /src/xxx/lisp is now a symbolic link pointing to /cl/my/ /cl points to /Users/Shared/cl Now Git thinks the file is deleted when it's accessed from the old = hierarchy (/src/xxx/lisp/), while from the new hierarchy (/cl/my/) it is = not under version control at all. From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 21 17:57:23 2021 Received: (at 49683) by debbugs.gnu.org; 21 Jul 2021 21:57:24 +0000 Received: from localhost ([127.0.0.1]:38857 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m6KDT-0003rM-ME for submit@debbugs.gnu.org; Wed, 21 Jul 2021 17:57:23 -0400 Received: from quimby.gnus.org ([95.216.78.240]:47438) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m6KDR-0003r5-55 for 49683@debbugs.gnu.org; Wed, 21 Jul 2021 17:57:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=wx66nRbGPTOxcb2yt/sK6IeaxyU/1JCq5Xce0VqohHY=; b=Ob/UrsOqywpxQhn0X5stRY2iPT LG+aOHsNSMqU99eNXLIv9syv7gQinNF/kvYunPFCAoVqx+gHtW9dmqPEjFwhCol2YkseSYVAZ0XUz FJuPahdhfaF94GLGpzIJMe/3paFj7IQJBEQPMEc4jr86EIqC6nTZ+vmVA8cbDZNJKS8Q=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m6KDI-0002CB-Kx; Wed, 21 Jul 2021 23:57:15 +0200 From: Lars Ingebrigtsen To: Yan Gajdos Subject: Re: bug#49683: Unable to open file under Git VC References: <54C95169-53B1-45E2-9957-F5DE51430E8C@gajdos.info> X-Now-Playing: Severed Heads's _Clean_: "Floopness" Date: Wed, 21 Jul 2021 23:57:12 +0200 In-Reply-To: <54C95169-53B1-45E2-9957-F5DE51430E8C@gajdos.info> (Yan Gajdos's message of "Wed, 21 Jul 2021 17:37:05 +0200") Message-ID: <87a6mfnxdz.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Yan Gajdos writes: > Explanation: > The file used to be in a Git hierarchy, but its directory was moved, and this directory is only pointed to with a symbolic link now. > This seems to give the impression that it both i [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 49683 Cc: 49683@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: -3.3 (---) Yan Gajdos writes: > Explanation: > The file used to be in a Git hierarchy, but its directory was moved, and this directory is only pointed to with a symbolic link now. > This seems to give the impression that it both is and isn't under version control, so vc-working-revision returning nil causes the issue. > > Solution: > Only attempt to get substring of rev if rev is non-nil. Thanks; makes sense to me. I've now pushed your patch to Emacs 28. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 21 17:57:31 2021 Received: (at control) by debbugs.gnu.org; 21 Jul 2021 21:57:31 +0000 Received: from localhost ([127.0.0.1]:38860 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m6KDW-0003rb-Uz for submit@debbugs.gnu.org; Wed, 21 Jul 2021 17:57:31 -0400 Received: from quimby.gnus.org ([95.216.78.240]:47456) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m6KDW-0003rE-6j for control@debbugs.gnu.org; Wed, 21 Jul 2021 17:57:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=tntDzaRr/EOotanpY5zX3yr6J47e3nYRRypdFpCuyjI=; b=W1jrr9cEpYFj8KGGP9X9pUpwyk /3pD86QKqoA5EFsUCrbyTqJO/ct5TKNDYueypj3/kTzYUiUG1duyTHHhgEOkAzhGkqK2B9x1UxEKx jKQRlV+6+bxdy/VC9YAoZTNi2/PXXYh1cSW2a4yvcDADCne8O32ij8+2QNpJUe88s8eI=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m6KDO-0002CJ-IE for control@debbugs.gnu.org; Wed, 21 Jul 2021 23:57:20 +0200 Date: Wed, 21 Jul 2021 23:57:18 +0200 Message-Id: <878s1znxdt.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #49683 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 49683 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control 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 (---) close 49683 28.1 quit From unknown Fri Aug 15 12:54:58 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 19 Aug 2021 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator