diff mbox series

eval: Reset input for pipelines

Message ID ZqDTvavJpDXPeorl@gondor.apana.org.au (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series eval: Reset input for pipelines | expand

Commit Message

Herbert Xu July 24, 2024, 10:13 a.m. UTC
On Wed, Jul 24, 2024 at 12:44:39AM -0700, arĉi wrote:
>
> I'm on Arch Linux.
> <details><summary>strace</summary>

Oops, this has nothing to do with the other bug report.  Indeed
I could reproduce this.  The issue is a missing reset_input call
for pipelines.

Thanks,

---8<---
For everything but the first component of a pipeline, the input
needs to be reset because it is no longer equal to that of the
parent shell.

Reported-by: arĉi <arcxi@dismail.de>
Fixes: b1864ee9f241 ("input: Use lseek on stdin when possible")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
 src/eval.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/src/eval.c b/src/eval.c
index ad2aa03..0f2a7ba 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -595,6 +595,7 @@  evalpipe(union node *n, int flags)
 				close(pip[0]);
 			}
 			if (prevfd > 0) {
+				reset_input();
 				dup2(prevfd, 0);
 				close(prevfd);
 			}