From d19e18c68d6415214afad37ce6cb47ec038ebe1c Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Sun, 28 Apr 2013 17:47:43 -0700 Subject: 31350: block SIGWINCH nearly all the time, except when about to calculate prompts or do synchronous read, so syscalls are not interrupted by window size changes. --- Src/init.c | 1 + 1 file changed, 1 insertion(+) (limited to 'Src/init.c') diff --git a/Src/init.c b/Src/init.c index 8467a739c..f4fb3bee4 100644 --- a/Src/init.c +++ b/Src/init.c @@ -1113,6 +1113,7 @@ init_signals(void) install_handler(SIGCHLD); #ifdef SIGWINCH install_handler(SIGWINCH); + winch_block(); /* See utils.c:preprompt() */ #endif if (interact) { install_handler(SIGALRM); -- cgit v1.2.3 From 4e43360261e88346bd71b238f423cbf5bc8e1eff Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Tue, 30 Apr 2013 00:22:03 -0700 Subject: 31361: handle negative optno ("no" prefix used) when storing options with parseopts_insert() for sticky contexts --- ChangeLog | 5 ++++- Src/init.c | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'Src/init.c') diff --git a/ChangeLog b/ChangeLog index 898aef16b..10c17d8b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,10 @@ 2013-04-29 Bart Schaefer + * 31361: Src/init.c: handle negative optno ("no" prefix used) + when storing options with parseopts_insert() for sticky contexts + * 31353: Src/math.c: fix handling of floating point in ternary - + * 31350: Src/init.c, Src/input.c, Src/signals.h, Src/utils.c, Src/Zle/zle_main.c: block SIGWINCH nearly all the time, except when about to calculate prompts or do synchronous read, so diff --git a/Src/init.c b/Src/init.c index f4fb3bee4..01a969df4 100644 --- a/Src/init.c +++ b/Src/init.c @@ -281,9 +281,10 @@ parseargs(char **argv, char **runscript) /**/ static void -parseopts_insert(LinkList optlist, void *ptr) +parseopts_insert(LinkList optlist, void *base, int optno) { LinkNode node; + void *ptr = base + (optno < 0 ? -optno : optno); for (node = firstnode(optlist); node; incnode(node)) { if (ptr < getdata(node)) { @@ -390,7 +391,7 @@ parseopts(char *nam, char ***argvp, char *new_opts, char **cmdp, if (dosetopt(optno, action, !nam, new_opts) && nam) { WARN_OPTION("can't change option: %s", *argv); } else if (optlist) { - parseopts_insert(optlist, new_opts+optno); + parseopts_insert(optlist, new_opts, optno); } } break; @@ -415,7 +416,7 @@ parseopts(char *nam, char ***argvp, char *new_opts, char **cmdp, if (dosetopt(optno, action, !nam, new_opts) && nam) { WARN_OPTION("can't change option: -%c", **argv); } else if (optlist) { - parseopts_insert(optlist, new_opts+optno); + parseopts_insert(optlist, new_opts, optno); } } } -- cgit v1.2.3 From c98cbe25d2be2c8c552250e7e039a72e1f61887b Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sun, 27 Oct 2013 15:42:00 -0700 Subject: 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. --- ChangeLog | 17 ++++++++++++----- Src/exec.c | 4 ++-- Src/init.c | 1 + 3 files changed, 15 insertions(+), 7 deletions(-) (limited to 'Src/init.c') diff --git a/ChangeLog b/ChangeLog index 659aba150..462ffdad6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,19 @@ 2013-10-27 Barton E. Schaefer - * 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 >&- from closing for a real redirect. Fixes knock-on multios bug 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 * 31909: Jun T: Completion/Unix/Command/_cat: new completion. @@ -146,7 +153,7 @@ internal history from the HISTFILE at write time. * 31832: Src/exec.c: make execrestore() more signal-safe. - + 2013-10-17 Peter Stephenson * 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 than as part of the match, and account for lines that have already wrapped due to very long matches. - + * 31781: Src/Zle/computil.c: "compdescribe -i" must clear the completion list column padding width along with the rest of the description state. Cf. 31782. diff --git a/Src/exec.c b/Src/exec.c index 99c7eaa6a..df915e152 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -3123,7 +3123,7 @@ execcmd(Estate state, int input, int output, int how, int last1) int fd = fn->fd2; if(fd == -2) fd = (fn->type == REDIR_MERGEOUT) ? coprocout : coprocin; - fil = dup(fd); + fil = movefd(dup(fd)); } if (fil == -1) { char fdstr[4]; @@ -3151,7 +3151,7 @@ execcmd(Estate state, int input, int output, int how, int last1) else fil = clobber_open(fn); if(fil != -1 && IS_ERROR_REDIR(fn->type)) - dfil = dup(fil); + dfil = movefd(dup(fil)); else dfil = 0; if (fil == -1 || dfil == -1) { diff --git a/Src/init.c b/Src/init.c index 01a969df4..7032ff8ae 100644 --- a/Src/init.c +++ b/Src/init.c @@ -1584,6 +1584,7 @@ zsh_main(UNUSED(int argc), char **argv) fdtable_size = zopenmax(); fdtable = zshcalloc(fdtable_size*sizeof(*fdtable)); + fdtable[0] = fdtable[1] = fdtable[2] = FDT_EXTERNAL; createoptiontable(); emulate(zsh_name, 1, &emulation, opts); /* initialises most options */ -- cgit v1.2.3