Subject: bug#57129: 29.0.50; Improve behavior of conditionals in Eshell

From: Eli Zaretskii <[email-masked]>
Date: Sat, 13 Aug 2022 10:01:21 +0300

> Cc: [email-masked]
> From: Jim Porter <[email-masked]>
> Date: Fri, 12 Aug 2022 22:14:02 -0700
> 
> On 8/12/2022 8:22 AM, Lars Ingebrigtsen wrote:
> > Jim Porter <[email-masked]> writes:
> > 
> >> Here are some patches to fix this.
> > 
> > I haven't tested the patches, but reading them, they make sense to me,
> > so please go ahead and push.
> 
> Thanks for taking a look. Merged as 
> f3408af0a3251a744cb0b55b5e153565bfd57ea3.

One of the tests in esh-var-tests.el failed on MS-Windows; I fixed it,
although I'm not sure it's a correct fix, because the Eshell manual
seems to say that a built-in implementation of a command should be
preferred by default?

One of the tests in eshell-tests.el also fails on MS-Windows, but I
have no idea how to fix it, nor even what are the details of the
test.  Are the 'echo' commands in that test supposed to be external
shell commands or internal Eshell commands?  If the former, it could
be a problem on MS-Windows.

(This is a good example of my gripes about the test suite, which I
described in bug#57150 yesterday: debugging a failure is unnecessarily
hard and tedious.  There's no information about the specific intent of
the test and its inner workings and assumptions, except the general
idea described in the doc string.)

Here's the failure I get:

  Test eshell-test/subcommand-reset-in-pipeline backtrace:
    signal(ert-test-failed (((should (equal (eshell-test-command-result
    ert-fail(((should (equal (eshell-test-command-result (format templat
    (if (unwind-protect (setq value-38 (apply fn-36 args-37)) (setq form
    (let (form-description-40) (if (unwind-protect (setq value-38 (apply
    (let ((value-38 'ert-form-evaluation-aborted-39)) (let (form-descrip
    (let* ((fn-36 #'equal) (args-37 (condition-case err (let ((signal-ho
    (let ((template (car --dolist-tail--))) (let* ((fn-26 #'equal) (args
    (while --dolist-tail-- (let ((template (car --dolist-tail--))) (let*
    (let ((--dolist-tail-- '("echo {%s} | *cat" "echo ${%s} | *cat" "*ca
    (closure (t) nil (let* ((fn-21 #'executable-find) (args-22 (conditio
    ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
    ert-run-test(#s(ert-test :name eshell-test/subcommand-reset-in-pipel
    ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-m
    ert-run-tests((not (or (tag :unstable) (tag :nativecomp))) #f(compil
    ert-run-tests-batch((not (or (tag :unstable) (tag :nativecomp))))
    ert-run-tests-batch-and-exit((not (or (tag :unstable) (tag :nativeco
    eval((ert-run-tests-batch-and-exit '(not (or (tag :unstable) (tag :n
    command-line-1(("-L" ";." "-l" "ert" "-l" "lisp/eshell/eshell-tests.
    command-line()
    normal-top-level()
  Test eshell-test/subcommand-reset-in-pipeline condition:
      (ert-test-failed
       ((should
	 (equal
	  (eshell-test-command-result ...)
	  "first"))
	:form
	(equal nil "first")
	:value nil :explanation
	(different-types nil "first")))
     FAILED  18/18  eshell-test/subcommand-reset-in-pipeline (1.873920 sec) at lisp/eshell/eshell-tests.el:80