Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Fwd (potential regression in 5.0.3): Bug#732726: zsh function freeze
On Dec 20, 6:19pm, Bart Schaefer wrote:
}
} + * 31549: Src/exec,c, Src/zsh.h: replace ad-hoc subsh_close file
} + descriptor for pipes with new addfilelist() job-based mechanism.
Yep, that's the one.
I compiled commit 709dbbbda82efde2020d9d67a19687c101b91570 and was
able to reproduce the problem. The immediately preceding commit
39ab9952e8255cb99e9c0abcc8bbec43158a55d7 does not show the bug.
Non-interactive shells also do not show the bug, which may be why
"make check" didn't flag anything.
The problem seems to be with this hunk specifically:
@@ -1744,8 +1742,6 @@ execpline2(Estate state, wordcode pcode,
execpline2(state, *state->pc++, how, pipes[0], output, last1);
list_pipe = old_list_pipe;
cmdpop();
- zclose(pipes[0]);
- subsh_close = -1;
}
}
The problem is that pipes[0] isn't always added to the list of files
for the job; sometimes it really does need to be closed there.
diff --git a/Src/exec.c b/Src/exec.c
index dccdc2b..4480033 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1691,6 +1691,7 @@ execpline2(Estate state, wordcode pcode,
execcmd(state, input, output, how, last1 ? 1 : 2);
else {
int old_list_pipe = list_pipe;
+ int subsh_close = -1;
Wordcode next = state->pc + (*state->pc), pc;
wordcode code;
@@ -1738,6 +1739,7 @@ execpline2(Estate state, wordcode pcode,
} else {
/* otherwise just do the pipeline normally. */
addfilelist(NULL, pipes[0]);
+ subsh_close = pipes[0];
execcmd(state, input, pipes[1], how, 0);
}
zclose(pipes[1]);
@@ -1750,6 +1752,8 @@ execpline2(Estate state, wordcode pcode,
execpline2(state, *state->pc++, how, pipes[0], output, last1);
list_pipe = old_list_pipe;
cmdpop();
+ if (subsh_close != pipes[0])
+ zclose(pipes[0]);
}
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author