Subject: Re: bug#40109: 27.0.90; simple-delete-trailing-whitespace--bug-21766 fails if Git isn't installed

From: Philipp Stephani <[email-masked]>
Date: Tue, 17 Mar 2020 18:35:33 +0100

Am Di., 17. März 2020 um 18:15 Uhr schrieb Philipp Stephani
<[email-masked]>:
>
>
> Make sure that git isn't installed, e.g. by running 'apt remove git' on
> a Debian system.  Then, in the Emacs source test directory:
>
> $ make lisp/simple-tests SELECTOR=simple-delete-trailing-whitespace--bug-21766
> make[1]: Entering directory '/emacs/test'
>   GEN      lisp/simple-tests.log
> Running 1 tests (2020-03-17 18:07:31+0100, selector `simple-delete-trailing-whitespace--bug-21766')
> Test simple-delete-trailing-whitespace--bug-21766 backtrace:
>   call-process("git" nil (t nil) nil "rev-parse" "--abbrev-ref" "HEAD"
>   emacs-repository-branch-git("/emacs/")
>   emacs-repository-get-branch("/emacs/")
>   byte-code("\3021$\0\303\304\305\306!\307\"\206\17\0\10\1\31\211;\205
>   (defconst tramp-repository-branch (byte-code "\3021$\0\303\304\305\3
>   require(trampver)
>   byte-code("\300\301!\210\300\302!\210\300\303!\210\300\304!\210\305\
>   require(tramp)
>   require(tramp-sh)
>   byte-code("\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\
>   (python-mode)
>   (progn (python-mode) (insert (concat "query = \"\"\"WITH filtered AS
>   (unwind-protect (progn (python-mode) (insert (concat "query = \"\"\"
>   (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn
>   (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-b
>   (unwind-protect (let ((temp-buffer (generate-new-buffer " *temp*")))
>   (let ((python (featurep 'python)) (python-indent-guess-indent-offset
>   (closure (t) nil (defvar python-indent-guess-indent-offset) (let ((p
>   ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
>   ert-run-test(#s(ert-test :name simple-delete-trailing-whitespace--bu
>   ert-run-or-rerun-test(#s(ert--stats :selector simple-delete-trailing
>   ert-run-tests(simple-delete-trailing-whitespace--bug-21766 #f(compil
>   ert-run-tests-batch(simple-delete-trailing-whitespace--bug-21766)
>   ert-run-tests-batch-and-exit(simple-delete-trailing-whitespace--bug-
>   eval((ert-run-tests-batch-and-exit 'simple-delete-trailing-whitespac
>   command-line-1(("-L" ":." "-l" "ert" "-l" "lisp/simple-tests.el" "--
>   command-line()
>   normal-top-level()
> Test simple-delete-trailing-whitespace--bug-21766 condition:
>     (file-missing "Searching for program" "No such file or directory" "git")
>    FAILED  1/1  simple-delete-trailing-whitespace--bug-21766 (0.267653 sec)
>
> Ran 1 tests, 0 results as expected, 1 unexpected (2020-03-17 18:07:32+0100, 1.093014 sec)
>
> 1 unexpected results:
>    FAILED  simple-delete-trailing-whitespace--bug-21766
>
> make[1]: *** [Makefile:183: lisp/simple-tests.log] Error 1
> make[1]: Leaving directory '/emacs/test'
> make: *** [Makefile:249: lisp/simple-tests] Error 2
>
>
> This is weird because trampver.el properly uses ignore-errors, so this
> error shouldn't bubble up.

Ah, the problem is that with-demoted-errors uses
condition-case-unless-debug.  More minimal example:

$ emacs -Q -batch -eval '(let ((debug-on-error t)) (ignore-errors
(with-demoted-errors "%S" (error "foo"))))'
Debugger entered--Lisp error: (error "foo")
[…]

I think this behavior is very confusing. Both version.el and
trampver.el try to do the right thing, but that breaks in such a
situation.