Subject: bug#79030: rare failure of esh-cmd-test/reset-in-pipeline/subcommand

From: Paul Eggert <[email-masked]>
Date: Tue, 15 Jul 2025 23:50:13 -0700

On the master branch, on Ubuntu 25.04 x86-64, I ran "make -j12 check" 
about 130 times in sequence, and eventually got a failure in 
esh-cmd-test/reset-in-pipeline/subcommand. The problem is most likely 
timing related. The rest of this email is a copy of the failed 
esh-cmd-tests.log.

Running 77 tests (2025-07-15 18:19:45-0700, selector ‘(not (or (tag 
:expensive-test) (tag :unstable) (tag :nativecomp)))’)
    passed   1/77  esh-cmd-test/and-operator (0.221212 sec)
    passed   2/77  esh-cmd-test/and-operator/output (0.205419 sec)
[sleep]+ Done (/usr/bin/sleep 10)
    passed   3/77  esh-cmd-test/background/kill (0.101571 sec)
[echo]+ Done (/usr/bin/echo hi)
    passed   4/77  esh-cmd-test/background/simple-command (0.102426 sec)
[echo]+ Done (/usr/bin/echo hello)
[rev]+ Done (/usr/bin/rev)
    passed   5/77  esh-cmd-test/background/subcommand (0.102975 sec)
    passed   6/77  esh-cmd-test/backquoted-lisp-form (0.000991 sec)
    passed   7/77  esh-cmd-test/backquoted-lisp-form/splice (0.000762 sec)
    passed   8/77  esh-cmd-test/command-not-found/pipeline (0.102448 sec)
    passed   9/77  esh-cmd-test/empty-background-command (0.000850 sec)
    passed  10/77  esh-cmd-test/for-loop (0.001163 sec)
    passed  11/77  esh-cmd-test/for-loop-lisp-body (0.000946 sec)
    passed  12/77  esh-cmd-test/for-loop-list (0.012570 sec)
    passed  13/77  esh-cmd-test/for-loop-mixed-args (0.001573 sec)
    passed  14/77  esh-cmd-test/for-loop-name (0.000959 sec)
    passed  15/77  esh-cmd-test/for-loop-name-shadow (0.001693 sec)
    passed  16/77  esh-cmd-test/for-loop-pipe (0.102910 sec)
    passed  17/77  esh-cmd-test/for-loop-range (0.002508 sec)
    passed  18/77  esh-cmd-test/for-loop-string (0.000966 sec)
    passed  19/77  esh-cmd-test/for-loop-vector (0.000988 sec)
    passed  20/77  esh-cmd-test/if-else-statement (0.002046 sec)
    passed  21/77  esh-cmd-test/if-else-statement-chain (0.001977 sec)
    passed  22/77  esh-cmd-test/if-else-statement-ext-cmd (0.103959 sec)
    passed  23/77  esh-cmd-test/if-else-statement-lisp-body (0.001634 sec)
    passed  24/77  esh-cmd-test/if-else-statement-lisp-form (0.002191 sec)
    passed  25/77  esh-cmd-test/if-else-statement-lisp-form-2 (0.002140 sec)
    passed  26/77  esh-cmd-test/if-else-statement-pipe (0.204174 sec)
    passed  27/77  esh-cmd-test/if-statement (0.003827 sec)
    passed  28/77  esh-cmd-test/if-statement-pipe (0.204486 sec)
    passed  29/77  esh-cmd-test/invoke-directly/complex (0.000759 sec)
    passed  30/77  esh-cmd-test/invoke-directly/complex-subcmd (0.000773 
sec)
    passed  31/77  esh-cmd-test/invoke-directly/multiple-cmds (0.000654 sec)
    passed  32/77  esh-cmd-test/invoke-directly/no-args (0.000678 sec)
    passed  33/77  esh-cmd-test/invoke-directly/subcmd (0.000857 sec)
    passed  34/77  esh-cmd-test/invoke-directly/with-args (0.000647 sec)
    passed  35/77  esh-cmd-test/let-rebinds-after-defer (0.103729 sec)
    passed  36/77  esh-cmd-test/lisp-command (0.000588 sec)
    passed  37/77  esh-cmd-test/lisp-command-args (0.000541 sec)
    passed  38/77  esh-cmd-test/lisp-command-with-quote (0.000449 sec)
    passed  39/77  esh-cmd-test/or-operator (0.205100 sec)
    passed  40/77  esh-cmd-test/or-operator/output (0.206857 sec)
    passed  41/77  esh-cmd-test/pipeline-wait/head-proc (0.102134 sec)
    passed  42/77  esh-cmd-test/pipeline-wait/multi-proc (1.106663 sec)
    passed  43/77  esh-cmd-test/pipeline-wait/nested-pipes (1.108869 sec)
    passed  44/77  esh-cmd-test/pipeline-wait/subcommand (0.103447 sec)
    passed  45/77  esh-cmd-test/pipeline-wait/subcommand-with-pipe 
(0.119194 sec)
    passed  46/77  esh-cmd-test/pipeline-wait/tail-proc (0.102325 sec)
    passed  47/77  esh-cmd-test/pipeline/replace-command (0.002533 sec)
    passed  48/77  esh-cmd-test/quoted-lisp-form (0.000730 sec)
    passed  49/77  esh-cmd-test/reset-in-pipeline/lisp (0.103057 sec)
Test esh-cmd-test/reset-in-pipeline/subcommand backtrace:
   signal(ert-test-failed (((should (eshell-command-result--equal comma
   ert-fail(((should (eshell-command-result--equal command (eshell-test
   (if (unwind-protect (setq value-7 (apply fn-5 args-6)) (setq form-de
   (let (form-description-9) (if (unwind-protect (setq value-7 (apply f
   (let ((value-7 'ert-form-evaluation-aborted-8)) (let (form-descripti
   (let* ((fn-5 #'eshell-command-result--equal) (args-6 (condition-case
   (let ((eshell-module-loading-messages nil)) (let* ((fn-5 #'eshell-co
   (let ((ert--infos (cons (cons "Command logs: " #'eshell-get-debug-lo
   eshell-command-result-equal("*cat $<echo | echo $eshell-in-pipeline-
   #f(compiled-function () #<bytecode -0x19894490097a61f1>)()
   #f(compiled-function () #<bytecode -0x1ef738f5a9e10056>)()
   handler-bind-1(#f(compiled-function () #<bytecode -0x1ef738f5a9e1005
   ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
   ert-run-test(#s(ert-test :name esh-cmd-test/reset-in-pipeline/subcom
   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" "--eval" "(setq treesit-extra-l
   command-line()
   normal-top-level()
Test esh-cmd-test/reset-in-pipeline/subcommand condition:
     Command logs: command: "*cat $<echo | echo $eshell-in-pipeline-p | 
echo> | *cat"

                   ----------------------------------------
                   [process] started external process ‘cat’

                   /usr/bin/cat
                   ----------------------------------------
                   [process] started external process ‘cat<1>’

                   /usr/bin/cat /tmp/rEfiLP
                   ----------------------------------------
                   [process] received output from process ‘cat<1>’

                   t

                   ----------------------------------------
                   [process] forwarding output from process ‘cat<1>’

                   t

                   ----------------------------------------
                   [process] received output from process ‘cat’

                   t

                   ----------------------------------------
                   [process] forwarding output from process ‘cat’

                   t

                   ----------------------------------------
                   [process] sentinel for external process ‘cat<1>’: 
"finished
                   "
                   ----------------------------------------
                   [process] i/o busy for process ‘cat<1>’
                   ----------------------------------------
                   [process] sentinel for external process ‘cat-stderr’: 
"finished
                   "
                   ----------------------------------------
                   [process] finished external process ‘cat-stderr’
                   ----------------------------------------
                   [process] finished external process ‘cat<1>’
                   ----------------------------------------
                   [process] sentinel for external process ‘cat’: "finished
                   "
                   ----------------------------------------
                   [process] finished external process ‘cat’
     (ert-test-failed
      ((should
        (eshell-command-result--equal command
				     (eshell-test-command-result command)
				     result))
       :form
       (eshell-command-result--equal
        "*cat $<echo | echo $eshell-in-pipeline-p | echo> | *cat" "t\n" "t")
       :value nil :explanation
       (nonequal-result
        (command "*cat $<echo | echo $eshell-in-pipeline-p | echo> | *cat")
        (result "t\n") (expected "t"))))
    FAILED  50/77  esh-cmd-test/reset-in-pipeline/subcommand (0.641031 
sec) at lisp/eshell/esh-cmd-tests.el:273
    passed  51/77  esh-cmd-test/simple-command-result (0.001157 sec)
    passed  52/77  esh-cmd-test/skip-leading-nils (0.001570 sec)
    passed  53/77  esh-cmd-test/subcommand (0.001292 sec)
    passed  54/77  esh-cmd-test/subcommand-args (0.001372 sec)
    passed  55/77  esh-cmd-test/subcommand-lisp (0.000725 sec)
    passed  56/77  esh-cmd-test/subcommand-shadow-value (0.001680 sec)
    passed  57/77  esh-cmd-test/throw (0.001959 sec)
    passed  58/77  esh-cmd-test/unless-else-statement (0.002314 sec)
    passed  59/77  esh-cmd-test/unless-else-statement-ext-cmd (0.108885 sec)
    passed  60/77  esh-cmd-test/unless-else-statement-lisp-form 
(0.003231 sec)
    passed  61/77  esh-cmd-test/unless-statement (0.001704 sec)
    passed  62/77  esh-cmd-test/until-loop (0.001488 sec)
    passed  63/77  esh-cmd-test/until-loop-ext-cmd (0.103259 sec)
    passed  64/77  esh-cmd-test/until-loop-lisp-form (0.002376 sec)
    passed  65/77  esh-cmd-test/which/alias (0.001724 sec)
    passed  66/77  esh-cmd-test/which/explicit (0.001203 sec)
    passed  67/77  esh-cmd-test/which/explicit/not-found (0.001120 sec)
    passed  68/77  esh-cmd-test/which/plain/eshell-builtin (0.001701 sec)
    passed  69/77  esh-cmd-test/which/plain/external-program (0.001325 sec)
    passed  70/77  esh-cmd-test/which/plain/not-found (0.001281 sec)
    passed  71/77  esh-cmd-test/which/quoted-file (0.000875 sec)
    passed  72/77  esh-cmd-test/which/quoted-file/not-found (0.000852 sec)
    passed  73/77  esh-cmd-test/while-loop (0.018836 sec)
    passed  74/77  esh-cmd-test/while-loop-ext-cmd (0.103267 sec)
    passed  75/77  esh-cmd-test/while-loop-lisp-body (0.000884 sec)
    passed  76/77  esh-cmd-test/while-loop-lisp-form (0.001272 sec)
    passed  77/77  esh-cmd-test/while-loop-pipe (0.102147 sec)

Ran 77 tests, 76 results as expected, 1 unexpected (2025-07-15 
18:19:51-0700, 5.990603 sec)

1 unexpected results:
    FAILED  esh-cmd-test/reset-in-pipeline/subcommand