[PATCH] eval: Reset input for pipelines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
Fixes: b1864ee9f241 ("input: Use lseek on stdin when possible")
Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
---
 src/eval.c | 1 +
 1 file changed, 1 insertion(+)

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);
 			}
-- 
2.39.2

-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux