Subject: bug#65590: 29.0.50; esh-var-test/interp-concat-cmd fails on macOS

From: Jim Porter <[email-masked]>
Date: Tue, 29 Aug 2023 10:10:12 -0700

On 8/28/2023 11:44 PM, Stefan Kangas wrote:
> X-Debbugs-CC: [email-masked]
> 
> I see the below test failure on macOS:
> 
> Test esh-var-test/interp-concat-cmd backtrace:
>    signal(error ("echo: unrecognized option -b"))
>    error("%s: unrecognized option -%c" "echo" 98)
>    eshell--process-option("echo" "baz" 0 0 ((110 nil (nil) output-newli
>    eshell--process-args("echo" ("-baz") ((110 nil (nil) output-newline
>    eshell--do-opts("echo" ((110 nil (nil) output-newline "do not output
>    eshell/echo("-baz")
>    apply(eshell/echo "-baz")
[snip]
>    eshell-command-result("echo ${*echo \"foo\nbar\"}-baz")
>    eshell-test-command-result("echo ${*echo \"foo\nbar\"}-baz")
>    eshell-command-result-equal("echo ${*echo \"foo\nbar\"}-baz" ("foo"
>    #f(compiled-function () #<bytecode -0x1e41ac0e460bffe0>)()
>    ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
>    ert-run-test(#s(ert-test :name esh-var-test/interp-concat-cmd :docum
>    ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-m
>    ert-run-tests((not (or (tag :expensive-test) (tag :unstable) (tag :n
>    ert-run-tests-batch((not (or (tag :expensive-test) (tag :unstable) (
>    ert-run-tests-batch-and-exit((not (or (tag :expensive-test) (tag :un
>    eval((ert-run-tests-batch-and-exit '(not (or (tag :expensive-test) (
>    command-line-1(("-L" ":." "-l" "ert" "-l" "lisp/eshell/esh-var-tests
>    command-line()
>    normal-top-level()
> Test esh-var-test/interp-concat-cmd condition:
>      (error "echo: unrecognized option -b")
>     FAILED   20/110  esh-var-test/interp-concat-cmd (0.616546 sec) at
> lisp/eshell/esh-var-tests.el:275

This looks like a race condition when executing this command:

   echo ${*echo "foo\nbar"}-baz

That *should* print "foo\nbar-baz", but it tries to print "-baz" (and 
fails). That appears to be because the subcommand (*echo "foo\nbar") 
produces no output.

I'll inspect the code here more to see if there are any obvious places 
that we're not waiting long enough for the output. However, I've never 
been able to reproduce this locally, so it might be time to add more 
debug instrumentation to Eshell...

(Michael Albinus - CCed - has also seen similar sorts of issues on EMBA. 
They're usually different tests that fail, but they all look like 
similar issues where we get no output from a subcommand.)