GNU bug report logs - #53715
29.0.50; [PATCH] Improve correctness of pipelines in Eshell

Previous Next

Package: emacs;

Reported by: Jim Porter <jporterbugs <at> gmail.com>

Date: Wed, 2 Feb 2022 03:33:01 UTC

Severity: normal

Tags: patch

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jim Porter <jporterbugs <at> gmail.com>
To: 53715 <at> debbugs.gnu.org
Subject: bug#53715: 29.0.50; [PATCH] Improve correctness of pipelines in Eshell
Date: Tue, 1 Feb 2022 19:32:10 -0800
[Message part 1 (text/plain, inline)]
From `emacs -Q', start Eshell, and first run the following:

  ~ $ *echo hi | echo bye

This results in:

  bye
  ~ $ hi

That is, `*echo' writes its output *after* the prompt is emitted. This 
is because `eshell-do-pipelines' reports that there's no process object 
to wait for, so Eshell thinks the prompt can be emitted immediately. I 
fixed that in the first patch by setting the `tailproc' in a different 
spot. With this change, the result is:

  bye
  hi
  ~ $

This may be a bit surprising, since you'd normally expect "echo bye" to 
read "hi" on its stdin and just ignore it. However, the builtin Eshell 
echo command doesn't consume stdin, so it just goes straight to stdout 
instead. It's in reverse order because Eshell runs the pipeline from 
right-to-left in order to hook up the pipes properly. For how the 
builtin Eshell echo works, I think this is the right behavior. (If 
people disagree, I can fix this, but not right now; I'm working on a 
patch series to properly support piping to Lisp functions in Eshell, and 
I can change it - or not - once that's done.)

Second, run this:

  ~ $ tr a-z A-Z | rev
  hello RET
  C-c C-d  ;; Send EOF

The result is:

  olleh  ;; should be "OLLEH"

This happens because Eshell only keeps track of the tail process when 
running an external process, so when sending stdin, it gets sent to the 
tail process (`rev'), not the head (`tr'). I fixed this in the second 
patch by recording both the head and tail processes and updating the 
various places that use the current process to use the right one.
[0001-Ensure-that-tailproc-is-set-for-the-last-process-in-.patch (text/plain, attachment)]
[0002-When-executing-an-Eshell-pipeline-send-input-to-the-.patch (text/plain, attachment)]

This bug report was last modified 3 years and 106 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.