mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-11-28 03:10:56 +01:00
31919: fix deadlock when a shell builtin with a multio redirection is used on the left side of a pipeline
Make sure stdin/out/err file descriptors are closed for the multio copy process, which means not re-using those descriptors after they are closed and marked FDT_UNUSED in fdtable[]. For completeness, initialize their fdtable[] state to FDT_EXTERNAL.
This commit is contained in:
parent
4748eff7d2
commit
c98cbe25d2
3 changed files with 15 additions and 7 deletions
17
ChangeLog
17
ChangeLog
|
|
@ -1,12 +1,19 @@
|
||||||
2013-10-27 Barton E. Schaefer <schaefer@zsh.org>
|
2013-10-27 Barton E. Schaefer <schaefer@zsh.org>
|
||||||
|
|
||||||
* unposted (cf. users/18063): Functions/Zle/keeper: clean up
|
|
||||||
some syntax nits, add working link to old Unix Review article
|
|
||||||
|
|
||||||
* 31912: Src/exec.c: in closemn(), distinguish closing for >&-
|
* 31912: Src/exec.c: in closemn(), distinguish closing for >&-
|
||||||
from closing for a real redirect. Fixes knock-on multios bug
|
from closing for a real redirect. Fixes knock-on multios bug
|
||||||
introduced by workers/20666 way back in 2005.
|
introduced by workers/20666 way back in 2005.
|
||||||
|
|
||||||
|
* unposted (cf. users/18063): Functions/Zle/keeper: clean up
|
||||||
|
some syntax nits, add working link to old Unix Review article
|
||||||
|
|
||||||
|
* 31919: Src/exec.c, Src/init.c: fix deadlock when a shell builtin
|
||||||
|
with a multio redirection is used on the left side of a pipeline,
|
||||||
|
by making sure stdin/out/err file descriptors are closed for the
|
||||||
|
multio copy process, which means not re-using those descriptors
|
||||||
|
after they are closed and marked FDT_UNUSED in fdtable[]. For
|
||||||
|
completeness, initialize their fdtable[] state to FDT_EXTERNAL.
|
||||||
|
|
||||||
2013-10-27 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
2013-10-27 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||||
|
|
||||||
* 31909: Jun T: Completion/Unix/Command/_cat: new completion.
|
* 31909: Jun T: Completion/Unix/Command/_cat: new completion.
|
||||||
|
|
@ -146,7 +153,7 @@
|
||||||
internal history from the HISTFILE at write time.
|
internal history from the HISTFILE at write time.
|
||||||
|
|
||||||
* 31832: Src/exec.c: make execrestore() more signal-safe.
|
* 31832: Src/exec.c: make execrestore() more signal-safe.
|
||||||
|
|
||||||
2013-10-17 Peter Stephenson <p.stephenson@samsung.com>
|
2013-10-17 Peter Stephenson <p.stephenson@samsung.com>
|
||||||
|
|
||||||
* 31830: Doc/Zsh/func.yo, README, Src/hist.c, Src/zsh.h:
|
* 31830: Doc/Zsh/func.yo, README, Src/hist.c, Src/zsh.h:
|
||||||
|
|
@ -247,7 +254,7 @@
|
||||||
a listing, treat the separator as part of the description rather
|
a listing, treat the separator as part of the description rather
|
||||||
than as part of the match, and account for lines that have already
|
than as part of the match, and account for lines that have already
|
||||||
wrapped due to very long matches.
|
wrapped due to very long matches.
|
||||||
|
|
||||||
* 31781: Src/Zle/computil.c: "compdescribe -i" must clear the
|
* 31781: Src/Zle/computil.c: "compdescribe -i" must clear the
|
||||||
completion list column padding width along with the rest of the
|
completion list column padding width along with the rest of the
|
||||||
description state. Cf. 31782.
|
description state. Cf. 31782.
|
||||||
|
|
|
||||||
|
|
@ -3123,7 +3123,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
|
||||||
int fd = fn->fd2;
|
int fd = fn->fd2;
|
||||||
if(fd == -2)
|
if(fd == -2)
|
||||||
fd = (fn->type == REDIR_MERGEOUT) ? coprocout : coprocin;
|
fd = (fn->type == REDIR_MERGEOUT) ? coprocout : coprocin;
|
||||||
fil = dup(fd);
|
fil = movefd(dup(fd));
|
||||||
}
|
}
|
||||||
if (fil == -1) {
|
if (fil == -1) {
|
||||||
char fdstr[4];
|
char fdstr[4];
|
||||||
|
|
@ -3151,7 +3151,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
|
||||||
else
|
else
|
||||||
fil = clobber_open(fn);
|
fil = clobber_open(fn);
|
||||||
if(fil != -1 && IS_ERROR_REDIR(fn->type))
|
if(fil != -1 && IS_ERROR_REDIR(fn->type))
|
||||||
dfil = dup(fil);
|
dfil = movefd(dup(fil));
|
||||||
else
|
else
|
||||||
dfil = 0;
|
dfil = 0;
|
||||||
if (fil == -1 || dfil == -1) {
|
if (fil == -1 || dfil == -1) {
|
||||||
|
|
|
||||||
|
|
@ -1584,6 +1584,7 @@ zsh_main(UNUSED(int argc), char **argv)
|
||||||
|
|
||||||
fdtable_size = zopenmax();
|
fdtable_size = zopenmax();
|
||||||
fdtable = zshcalloc(fdtable_size*sizeof(*fdtable));
|
fdtable = zshcalloc(fdtable_size*sizeof(*fdtable));
|
||||||
|
fdtable[0] = fdtable[1] = fdtable[2] = FDT_EXTERNAL;
|
||||||
|
|
||||||
createoptiontable();
|
createoptiontable();
|
||||||
emulate(zsh_name, 1, &emulation, opts); /* initialises most options */
|
emulate(zsh_name, 1, &emulation, opts); /* initialises most options */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue