unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Pogonyshev <pogonyshev@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 65763@debbugs.gnu.org
Subject: bug#65763: Error opening a file from a Git working directory if Git is not installed
Date: Tue, 5 Sep 2023 22:14:15 +0200	[thread overview]
Message-ID: <CAG7BpargG0NQo2w7h=x9nGuaWV6HfbZ_BncVpDrBNUkP=dGHwA@mail.gmail.com> (raw)
In-Reply-To: <CAG7Bpaq0fCF5qzvUCyD4kYQrk8rZ6V_vEZYo_ykVcwaPHcABjg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3399 bytes --]

Ah, `debug-on-error' makes `with-demoted-errors' not demote it.

It seems in my case `debug-on-error' is let-bound in
`ert--run-test-internal'. I.e. when file is failed to be opened inside a
ERT-based test, there is no warning, it's a hard error. I happen to run ERT
tests inside a Docker container.

I'm not sure if it is a bug, but it does cause problems.

Paul

On Tue, 5 Sept 2023 at 22:06, Paul Pogonyshev <pogonyshev@gmail.com> wrote:

> From what I see it's not just a warning:
>
> $ emacs --batch --eval "(let ((debug-on-error t)) (setf vc-git-program
> \"git-is-not-installed\") (find-file-noselect \"whatever\"))"
> 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" "--" "whatever")
>   process-file("git-is-not-installed" nil (t nil) nil "--no-pager"
> "ls-files" "-c" "-z" "--" "whatever")
>   vc-git--call((t nil) "ls-files" "-c" "-z" "--" "whatever")
>   vc-git--out-ok("ls-files" "-c" "-z" "--" "whatever")
>   vc-git-registered("/home/paul/eldev/whatever")
>   vc-git-registered("/home/paul/eldev/whatever")
>   vc-call-backend(Git registered "/home/paul/eldev/whatever")
>   #f(compiled-function (b) #<bytecode 0x15a622e462a366fe>)(Git)
>   mapc(#f(compiled-function (b) #<bytecode 0x15a622e462a366fe>) (RCS CVS
> SVN SCCS SRC Bzr Git Hg))
>   vc-registered("/home/paul/eldev/whatever")
>   vc-backend("/home/paul/eldev/whatever")
>   vc-refresh-state()
>   run-hooks(find-file-hook)
>   after-find-file(t t)
>   find-file-noselect-1(#<buffer whatever> "~/eldev/whatever" nil nil
> "~/eldev/whatever" nil)
>   find-file-noselect("whatever")
>   (let ((debug-on-error t)) (setf vc-git-program "git-is-not-installed")
> (find-file-noselect "whatever"))
>   command-line-1(("--eval" "(let ((debug-on-error t)) (setf vc-git-program
> \"gi..."))
>   command-line()
>   normal-top-level()
>
> Paul
>
> On Tue, 5 Sept 2023 at 21:44, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> > From: Paul Pogonyshev <pogonyshev@gmail.com>
>> > Date: Tue, 5 Sep 2023 20:54:54 +0200
>> >
>> > To reproduce:
>> >
>> > 1. Change current directory to a Git checkout (e.g. `~/git/emacs' or
>> something).
>> > 2. From the command line:
>> >
>> >        $ emacs --batch --eval "(progn (setf vc-git-program
>> \"git-is-not-installed\") (find-file-noselect
>> > \"whatever\"))"
>> >        Error: (file-missing "Searching for program" "No such file or
>> directory" "git-is-not-installed")
>> >
>> > Expected: Emacs is able to open the file, Git must not be essential.
>>
>> Emacs does open the file; what you see is not an error, it's a
>> message.  The code which tries to invoke Git runs with-demoted-errors,
>> so any error is converted to a simple message.  If you try this
>> variant of your command:
>>
>>   $ emacs --batch --eval "(progn (setf vc-git-program
>> \"git-is-not-installed\") (message \"%s\" (find-file-noselect \"README\")))"
>>
>> you will see:
>>
>>   Error: (file-missing "Searching for program" "No such file or
>> directory" "git-is-not-installed")
>>   README
>>
>> That "README" at the end means that find-file-noselect did read the
>> file into its buffer, and the error message is just a message.
>>
>> So if this somehow prevented you from doing something, please tell
>> more, or maybe the recipe needs more steps?
>>
>

[-- Attachment #2: Type: text/html, Size: 4891 bytes --]

  reply	other threads:[~2023-09-05 20:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-05 18:54 bug#65763: Error opening a file from a Git working directory if Git is not installed Paul Pogonyshev
2023-09-05 19:44 ` Eli Zaretskii
2023-09-05 20:06   ` Paul Pogonyshev
2023-09-05 20:14     ` Paul Pogonyshev [this message]
2023-09-06  2:25       ` Eli Zaretskii
2023-09-06  7:29         ` Paul Pogonyshev
2023-09-06 12:13           ` Eli Zaretskii
2023-09-06 12:35             ` Dmitry Gutov
2023-09-06 12:49               ` Paul Pogonyshev
2023-09-06 12:52                 ` Dmitry Gutov
2023-09-06 13:11                   ` Paul Pogonyshev
2023-09-06 14:31                     ` Dmitry Gutov
2023-09-06 15:46                       ` Eli Zaretskii
2023-09-06 15:59                         ` Dmitry Gutov
2023-09-10  6:26                           ` Eli Zaretskii
2023-09-10 13:21                             ` Dmitry Gutov
2023-09-10 13:40                               ` Eli Zaretskii
2023-09-10 17:36                                 ` Paul Pogonyshev
2023-09-10 17:52                                   ` Eli Zaretskii
2023-09-06 13:06               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAG7BpargG0NQo2w7h=x9nGuaWV6HfbZ_BncVpDrBNUkP=dGHwA@mail.gmail.com' \
    --to=pogonyshev@gmail.com \
    --cc=65763@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).