From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Paul Pogonyshev Newsgroups: gmane.emacs.bugs Subject: bug#65763: Error opening a file from a Git working directory if Git is not installed Date: Wed, 6 Sep 2023 15:11:00 +0200 Message-ID: References: <831qfc4d7h.fsf@gnu.org> <83y1hk2g29.fsf@gnu.org> <83a5tz33er.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000042138c0604b07a99" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7622"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 65763@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 06 15:12:12 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 1qdsKJ-0001lk-Pk for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 06 Sep 2023 15:12:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qdsKB-0004z0-Et; Wed, 06 Sep 2023 09:12: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 1qdsK9-0004rD-Dk for bug-gnu-emacs@gnu.org; Wed, 06 Sep 2023 09:12:01 -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 1qdsK9-0005AO-4o for bug-gnu-emacs@gnu.org; Wed, 06 Sep 2023 09:12:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qdsK9-0000ul-VO for bug-gnu-emacs@gnu.org; Wed, 06 Sep 2023 09:12:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Pogonyshev Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Sep 2023 13:12: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.16940058853470 (code B ref 65763); Wed, 06 Sep 2023 13:12:01 +0000 Original-Received: (at 65763) by debbugs.gnu.org; 6 Sep 2023 13:11:25 +0000 Original-Received: from localhost ([127.0.0.1]:33416 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdsJY-0000tt-Og for submit@debbugs.gnu.org; Wed, 06 Sep 2023 09:11:25 -0400 Original-Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]:49512) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdsJU-0000tb-BX for 65763@debbugs.gnu.org; Wed, 06 Sep 2023 09:11:23 -0400 Original-Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2b9d07a8d84so54948681fa.3 for <65763@debbugs.gnu.org>; Wed, 06 Sep 2023 06:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694005872; x=1694610672; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=689sCBTBRVRXwG3uLahuGSilvBME3OnRfg0SnaJyLVU=; b=asU/g9wN+5G740vhRgL+1IQkIKZFFP52tfA63TPgBtX/G0DqUFAJUSt1NY7yYqJPRs rAX0YWf/V5UTHdOZiNly6UcXdCD1QJKARjOBpsR5G9WxIVJ9Y0De7RkuuZvjxCauyqWa Ve0La+60ZdGf6uqtZ1z1BHxwixmphZcGHLbir2q5xSgU3M97AQ1Yra4eGMjF7iO459Uh PUrwSebSWDb/qyt1d7ejVtpsPFcgKwWvzI2mHFl4Sdm9txJo0XREojIRVXyQFme/tMU6 osaLmvxEQqFRg3njiBIZZSbXpIMc4zg3luj/dwSu5EODevhnW/1jclGMe27CJhRFmrP3 WdvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1694005872; x=1694610672; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=689sCBTBRVRXwG3uLahuGSilvBME3OnRfg0SnaJyLVU=; b=h60iF9WUUkcj/UM2u1/an6VHn0BGZV9DFUJcr6cSZD3PoA/Eb8ohu9JbbQk7y36Fhc lT4/JmO4DbGDiONgtEwHj7ZqM7BJTNDixNyqU+T8vbu28MF+vfahrWupoQ8lIi9iMyIA kfwz5FUGV/i6cR0DpvvKggkYFFL9+8ITlwluyDmJhPv+YBO3Nk0NgDw5AmWdAT7cAcgi kC2cDkdCSaSqVm2aEMx1QEd5EmUmDNBSgLkBXS7Fc5vtqpBZy7FS6cWcGiJ6NkCiUSG5 wUMKaHFbRtocyPWncAcONK5BpzyqHaJ+Uqtr6vwDGTRMRkIauvzgd4U2MZSSs/CV7JSh Jp4Q== X-Gm-Message-State: AOJu0YzJ4cFPbJiKO6TLUJM1UhxqaA5riAT628j5SE5smCvcKffDIJ9v 56QIhyHk/XUeRFtlEQLjj+eYFQ19Tx69d4Ba+g== X-Google-Smtp-Source: AGHT+IEJLZO46xjmEbPlbgN1UW7cXfNwlsJdc8xWw/hxWIN+JUrGKZLJmyA2cfR6c+25Ruvl89mEUtWiVEn8Aw83L0A= X-Received: by 2002:a2e:b701:0:b0:2bc:c89e:d8df with SMTP id j1-20020a2eb701000000b002bcc89ed8dfmr2517565ljo.48.1694005872168; Wed, 06 Sep 2023 06:11:12 -0700 (PDT) In-Reply-To: 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:269542 Archived-At: --00000000000042138c0604b07a99 Content-Type: text/plain; charset="UTF-8" I doubt ERT can be changed, it probably sets `debug-on-error' for a reason, i.e. without it it simply couldn't work. As far as I can tell, the only good option is to never trigger an error just because a directory looks like it might be Git, but Git is not installed. Also consider this from a user point of view. Let's say I have nothing to do with programming at all and don't have Git installed. Someone emails me a cool Emacs package as a tarball and accidentally archives `.git' along, because he is a developer. I unpack it, open some file and now my Emacs warns me that Git is not installed. But why? I didn't even ask it to do anything. It *itself* decided to do something (because it saw a `.git' directory), failed (Git is not installed), and now warns *me*. From my point of view, if there is a failure for action that wasn't direct result of user order, Emacs should stay silent. In other words, I think there are two sane options here: 1) Simply check if Git is installed before doing anything Git-related from `find-file-hook' callback. If it is not installed, just silently don't do anything. Reserve errors and warnings until the user actually ask you to do something Git-related, not simply to open a file. 2) Make sure that this error is always demoted to a warning, even if `debug-on-error' is t. I like option 1 better. Paul On Wed, 6 Sept 2023 at 14:52, Dmitry Gutov wrote: > On 06/09/2023 15:49, Paul Pogonyshev wrote: > > It feels conceptually wrong to require all tests that open files to > > rebind `vc-handled-backends'. This is not what they are testing. It also > > depends on knowing particular Emacs quirks (which I, for example, didn't > > know one day earlier). If those were to change in some way, would all > > tests everywhere need to accomodate? > > But does that mean that VC needs to be changed, or ERT? > > E.g. ERT has an interactive mode where it drops into a debugger for the > user ('d'), but does it need to enable the debugger for its simple runs > as well? > --00000000000042138c0604b07a99 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I doubt ERT can be changed, it probably sets `debug-on-err= or' for a reason, i.e. without it it simply couldn't work. As far a= s I can tell, the only good option is to never trigger an error just becaus= e a directory looks like it might be Git, but Git is not installed.
Also consider this from a user point of view. Let's say I h= ave nothing to do with programming at all and don't have Git installed.= Someone emails me a cool Emacs package as a tarball and accidentally archi= ves `.git' along, because he is a developer. I unpack it, open some fil= e and now my Emacs warns me that Git is not installed. But why? I didn'= t even ask it to do anything. It itself decided to do something (bec= ause it saw a `.git' directory), failed (Git is not installed), and now= warns me. From my point of view, if there is a failure for action t= hat wasn't direct result of user order, Emacs should stay silent.
=

In other words, I think there are two sane options here= :

1) Simply check if Git is installed before doing= anything Git-related from `find-file-hook' callback. If it is not inst= alled, just silently don't do anything. Reserve errors and warnings unt= il the user actually ask you to do something Git-related, not simply to ope= n a file.

2) Make sure that this error is always d= emoted to a warning, even if `debug-on-error' is t.

I like option 1 better.

Paul

=
On Wed, 6 = Sept 2023 at 14:52, Dmitry Gutov <dm= itry@gutov.dev> wrote:
On 06/09/2023 15:49, Paul Pogonyshev wrote:
> It feels conceptually wrong to require all tests that open files to > rebind `vc-handled-backends'. This is not what they are testing. I= t also
> depends on knowing particular Emacs quirks (which I, for example, didn= 't
> know one day earlier). If those were to change in some way, would all =
> tests everywhere need to accomodate?

But does that mean that VC needs to be changed, or ERT?

E.g. ERT has an interactive mode where it drops into a debugger for the user ('d'), but does it need to enable the debugger for its simple = runs
as well?
--00000000000042138c0604b07a99--