From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#65763: Error opening a file from a Git working directory if Git is not installed Date: Sun, 10 Sep 2023 09:26:01 +0300 Message-ID: <83zg1usfwm.fsf@gnu.org> References: <831qfc4d7h.fsf@gnu.org> <83y1hk2g29.fsf@gnu.org> <83a5tz33er.fsf@gnu.org> <7fa60b9c-ae00-5fdd-4805-aa55cb4094e3@gutov.dev> <83jzt31ez5.fsf@gnu.org> <6a42daae-db48-4c81-8121-79515ac94bf9@gutov.dev> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2785"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65763@debbugs.gnu.org, pogonyshev@gmail.com To: Dmitry Gutov , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 10 08:27:24 2023 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 1qfDul-0000XX-MH for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 10 Sep 2023 08:27:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfDuR-0006Ir-IG; Sun, 10 Sep 2023 02:27:03 -0400 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 1qfDuN-0006IW-34 for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2023 02:26:59 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfDuM-00047i-QU for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2023 02:26:58 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qfDuQ-0002MC-0x for bug-gnu-emacs@gnu.org; Sun, 10 Sep 2023 02:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Sep 2023 06:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65763 X-GNU-PR-Package: emacs Original-Received: via spool by 65763-submit@debbugs.gnu.org id=B65763.16943271929025 (code B ref 65763); Sun, 10 Sep 2023 06:27:01 +0000 Original-Received: (at 65763) by debbugs.gnu.org; 10 Sep 2023 06:26:32 +0000 Original-Received: from localhost ([127.0.0.1]:48842 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfDtv-0002LT-RL for submit@debbugs.gnu.org; Sun, 10 Sep 2023 02:26:32 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36012) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qfDtr-0002LF-Lh for 65763@debbugs.gnu.org; Sun, 10 Sep 2023 02:26:29 -0400 Original-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 1qfDti-00044n-Ry; Sun, 10 Sep 2023 02:26:18 -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=hnsykYnf/KW99dSpApNIuY3e0wAhyI4KDGhrl0CsfY4=; b=S7phvedHt7G8 +ZIDsD3oFpCIfarEEm5a5SwVEqK04xRHWlaLNrDP2XERWfckHxbLQ3qURdFAdTGo3+SFX6p1gzxM8 JxXw+gVrR25nF1+x+ZpSBy7fTj8KrP6VQ0JFu80ERj/FW+A7ZJ2M9vruFgRxsTm7EAagpmIz5FYCj 7vvc9iAyMjxS9ifnb976KXT9kQt6Qm5nBhSiDTXotoG7COPwl6KHaOT0jtGaEkBZJnuXlQVYMCKa5 PQWAOR5GRJqA5J0t3pBi+4UgSJBxegrArNsJ6cA+5292x9F0Zev+LacsFP0j4UwGbNTYZa89Jsyfr Wx0UQfzkImpt4AdRcSGsSQ==; In-Reply-To: <6a42daae-db48-4c81-8121-79515ac94bf9@gutov.dev> (message from Dmitry Gutov on Wed, 6 Sep 2023 18:59:00 +0300) 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:269916 Archived-At: > Date: Wed, 6 Sep 2023 18:59:00 +0300 > Cc: pogonyshev@gmail.com, 65763@debbugs.gnu.org > From: Dmitry Gutov > > On 06/09/2023 18:46, Eli Zaretskii wrote: > > I prefer to emit the messages, just make them more user-friendly > > ("searching for program" "no such file or directory" is not very > > friendly, IMO), and suppress the error signaling even when > > debug-on-error is non-nil. The reason is simple: we are talking only > > about Git not being installed or accessible here, but the problems > > could be different and more obscure: Git could be present but > > inoperable for some weird misconfiguration reason, or some other > > problem could happen. So "if it is not installed, just silently don't > > do anything" is not a complete solution, and the "silently" part loses > > information which users may wish to have presented to them. > > That also sounds good to me. There's something strange going on here: even if I wrap the call to vc-backend with ignore-errors (see the patch below), I still see the error message, and running with debug-on-error enters the debugger: ./emacs --batch --eval "(let ((debug-on-error t)) (setf vc-git-program \"git-is-not-installed\") (find-file-noselect \"README\"))" Debugger entered--Lisp error: (file-missing "Searching for program" "No such file or directory" "git-is-not-installed") call-process("git-is-not-installed" nil (t nil) nil "--no-pager" "ls-files" "-c" "-z" "--" "src/README") apply(call-process "git-is-not-installed" nil (t nil) nil ("--no-pager" "ls-files" "-c" "-z" "--" "src/README")) process-file("git-is-not-installed" nil (t nil) nil "--no-pager" "ls-files" "-c" "-z" "--" "src/README") apply(process-file "git-is-not-installed" nil (t nil) nil "--no-pager" "ls-files" ("-c" "-z" "--" "src/README")) vc-git--call((t nil) "ls-files" "-c" "-z" "--" "src/README") apply(vc-git--call (t nil) "ls-files" ("-c" "-z" "--" "src/README")) vc-git--out-ok("ls-files" "-c" "-z" "--" "src/README") vc-git-registered("d:/gnu/git/emacs/trunk/src/README") vc-git-registered("d:/gnu/git/emacs/trunk/src/README") apply(vc-git-registered "d:/gnu/git/emacs/trunk/src/README") vc-call-backend(Git registered "d:/gnu/git/emacs/trunk/src/README") #f(compiled-function (b) #)(Git) mapc(#f(compiled-function (b) #) (RCS CVS SVN SCCS SRC Bzr Git Hg)) vc-registered("d:/gnu/git/emacs/trunk/src/README") vc-backend("d:/gnu/git/emacs/trunk/src/README") vc-refresh-state() run-hooks(find-file-hook) after-find-file(nil t) find-file-noselect-1(# "d:/gnu/git/emacs/trunk/src/README" nil nil "d:/gnu/git/emacs/trunk/src/README" (8444249302351936 1817014650)) find-file-noselect("README") (let ((debug-on-error t)) (setf vc-git-program "git-is-not-installed") (find-file-noselect "README")) eval((let ((debug-on-error t)) (setf vc-git-program "git-is-not-installed") (find-file-noselect "README")) t) command-line-1(("--eval" "(let ((debug-on-error t)) (setf vc-git-program \"gi...")) command-line() normal-top-level() It looks like condition-case is not working in this case? Or what am I missing? Stefan, can you help? Here's the patch I installed to try this, and it still produces the backtrace shown above, which clearly tells the error was signaled by subroutines called by vc-backend: diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index a4de0a6..0715236 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -799,7 +799,7 @@ vc-refresh-state (add-hook 'vc-mode-line-hook #'vc-mode-line nil t) (let (backend) (cond - ((setq backend (with-demoted-errors "VC refresh error: %S" + ((setq backend (ignore-errors (vc-backend buffer-file-name))) ;; Let the backend setup any buffer-local things he needs. (vc-call-backend backend 'find-file-hook)