diff --git a/NEWS b/NEWS index 3c762a14f..4f70f67c4 100644 --- a/NEWS +++ b/NEWS @@ -54,7 +54,7 @@ Any uppercase BUG_* names are modernish shell bug IDs. - Filescan loops are now disabled at runtime if the --posix option is active as they break a portable use case: POSIXly, 'while scanmask = flag&~NV_NOSCOPE; tp->scanroot = root; diff --git a/src/cmd/ksh93/edit/edit.c b/src/cmd/ksh93/edit/edit.c index 371f5a9ec..5739a8776 100644 --- a/src/cmd/ksh93/edit/edit.c +++ b/src/cmd/ksh93/edit/edit.c @@ -69,7 +69,6 @@ static Lex_t *savelex; { switch(c) { - case cntl('A'): return('A'); case cntl('B'): return('B'); case cntl('C'): return('C'); diff --git a/src/cmd/ksh93/edit/emacs.c b/src/cmd/ksh93/edit/emacs.c index 27fd3bcdd..954f3462e 100644 --- a/src/cmd/ksh93/edit/emacs.c +++ b/src/cmd/ksh93/edit/emacs.c @@ -205,7 +205,6 @@ int ed_emacsread(void *context, int fd,char *buff,int scend, int reedit) } raw = 1; /* This mess in case the read system call fails */ - ed_setup(ep->ed,fd,reedit); #if !SHOPT_MULTIBYTE out = (genchar*)buff; @@ -715,9 +714,7 @@ update: continue; } } - process: - if (c == (-1)) { lookahead = 0; @@ -1414,7 +1411,6 @@ static void search(Emacs_t* ep,genchar *out,int direction) } skip: i = genlen(string); - if(ep->prevdirection == -2 && i!=2 || direction!=1) ep->prevdirection = -1; if (direction < 1) @@ -1583,7 +1579,6 @@ static void draw(register Emacs_t *ep,Draw_t option) **********************/ i = ncursor - nscreen; - if ((ep->offset && i<=ep->offset)||(i >= (ep->offset+w_size))) { /* Center the cursor on the screen */ @@ -1600,12 +1595,9 @@ static void draw(register Emacs_t *ep,Draw_t option) nptr = &nscreen[ep->offset]; sptr = ep->screen; - i = w_size; - while (i-- > 0) { - if (*nptr == '\0') { *(nptr + 1) = '\0'; @@ -1638,7 +1630,6 @@ static void draw(register Emacs_t *ep,Draw_t option) if(ep->ed->e_multiline && option == REFRESH) ed_setcursor(ep->ed, ep->screen, ep->ed->e_peol, ep->ed->e_peol, -1); - /****************** Screen overflow checks diff --git a/src/cmd/ksh93/edit/history.c b/src/cmd/ksh93/edit/history.c index c4efe351e..9b9397eee 100644 --- a/src/cmd/ksh93/edit/history.c +++ b/src/cmd/ksh93/edit/history.c @@ -178,7 +178,6 @@ static int sh_checkaudit(History_t *hp, const char *name, char *logbuf, size_t l done: sh_close(fd); return(r); - } #endif /* SHOPT_AUDIT */ @@ -1014,7 +1013,6 @@ int hist_copy(char *s1,int size,int command,int line) } *s1++ = c; } - } sfseek(hp->histfp,(off_t)0,SEEK_END); if(s1==0) diff --git a/src/cmd/ksh93/sh/arith.c b/src/cmd/ksh93/sh/arith.c index fe83cae56..7aded4905 100644 --- a/src/cmd/ksh93/sh/arith.c +++ b/src/cmd/ksh93/sh/arith.c @@ -516,7 +516,6 @@ static Sfdouble_t arith(const char **ptr, struct lval *lvalue, int type, Sfdoubl sfsync(NIL(Sfio_t*)); if(lvalue->emode&ARITH_COMP) return(-1); - errormsg(SH_DICT,ERROR_exit((lvalue->emode&3)!=0),lvalue->value,*ptr); } *ptr = str; diff --git a/src/cmd/ksh93/sh/fault.c b/src/cmd/ksh93/sh/fault.c index 1ae545160..c27ed3eda 100644 --- a/src/cmd/ksh93/sh/fault.c +++ b/src/cmd/ksh93/sh/fault.c @@ -348,7 +348,6 @@ void sh_sigreset(register int mode) free(trap); sh.st.trap[sig] = 0; } - } if(sh.st.trapcom[0] && sh.st.trapcom[0] != Empty) free(sh.st.trapcom[0]); diff --git a/src/cmd/ksh93/sh/init.c b/src/cmd/ksh93/sh/init.c index 34fd7b5fa..1fe1ddbae 100644 --- a/src/cmd/ksh93/sh/init.c +++ b/src/cmd/ksh93/sh/init.c @@ -1077,7 +1077,6 @@ static char* get_math(register Namval_t* np, Namfun_t *fp) } val = sfstruse(sh.strbuf); return(val); - } static char *setdisc_any(Namval_t *np, const char *event, Namval_t *action, Namfun_t *fp) @@ -1169,7 +1168,6 @@ int sh_type(register const char *path) { register const char* s; register int t = 0; - if (s = (const char*)strrchr(path, '/')) { if (*path == '-') diff --git a/src/cmd/ksh93/sh/lex.c b/src/cmd/ksh93/sh/lex.c index 036ef2415..d84ca7c94 100644 --- a/src/cmd/ksh93/sh/lex.c +++ b/src/cmd/ksh93/sh/lex.c @@ -1994,7 +1994,6 @@ static int here_copy(Lex_t *lp,register struct ionod *iop) special++; fcget(); break; - case S_GRAVE: case S_DOL: special++; diff --git a/src/cmd/ksh93/sh/macro.c b/src/cmd/ksh93/sh/macro.c index 458ed8113..b1ade153e 100644 --- a/src/cmd/ksh93/sh/macro.c +++ b/src/cmd/ksh93/sh/macro.c @@ -1506,7 +1506,6 @@ retry1: { ap->nelem &= ~ARRAY_SCAN; dolg = 0; - } } break; @@ -2659,7 +2658,6 @@ static void tilde_expand2(register int offset) * If ~name is replaced with login directory of name. * If string doesn't start with ~ or ~... not found then 0 returned. */ - static char *sh_tilde(register const char *string) { register char *cp; diff --git a/src/cmd/ksh93/sh/name.c b/src/cmd/ksh93/sh/name.c index 3419f07f0..c5794d920 100644 --- a/src/cmd/ksh93/sh/name.c +++ b/src/cmd/ksh93/sh/name.c @@ -353,7 +353,6 @@ void nv_setlist(register struct argnod *arg,register int flags, Namval_t *typ) while(ap->argnxt.ap) ap = ap->argnxt.ap; ap->argnxt.ap = tp->com.comarg; - } tp->com.comarg = tp->com.comset; tp->com.comset = 0; @@ -506,7 +505,6 @@ void nv_setlist(register struct argnod *arg,register int flags, Namval_t *typ) _nv_unset(np,NV_EXPORT); /* this can free ap */ if(was_assoc_array) nv_setarray(np,nv_associative); - } } else @@ -1045,7 +1043,6 @@ Namval_t *nv_create(const char *name, Dt_t *root, int flags, Namfun_t *dp) flags &= ~NV_FARRAY; if(fixed) flags &= ~NV_ARRAY; - #endif /* SHOPT_FIXEDARRAY */ } else @@ -1101,7 +1098,6 @@ Namval_t *nv_create(const char *name, Dt_t *root, int flags, Namfun_t *dp) memcpy(sp+1,sub,n-2); sp[n-1] = ']'; cp = sp+n; - } } else if(c==0 && mode && (n=nv_aindex(np))>0) @@ -1311,7 +1307,6 @@ Namval_t *nv_open(const char *name, Dt_t *root, int flags) #if NVCACHE struct Cache_entry *xp; #endif - sh_stats(STAT_NVOPEN); memset(&fun,0,sizeof(fun)); sh.openmatch = 0; @@ -2333,7 +2328,6 @@ void sh_scope(struct argnod *envlist, int fun) { dtview(rp->sdict,newroot); newroot = rp->sdict; - } dtview(newscope,(Dt_t*)newroot); sh.var_tree = newscope; diff --git a/src/cmd/ksh93/sh/nvdisc.c b/src/cmd/ksh93/sh/nvdisc.c index 114ccd2b8..725ff079e 100644 --- a/src/cmd/ksh93/sh/nvdisc.c +++ b/src/cmd/ksh93/sh/nvdisc.c @@ -659,7 +659,6 @@ static void putdisc(Namval_t* np, const char* val, int flag, Namfun_t* fp) nv_disc(np,fp,NV_POP); if(!(fp->nofree&1)) free((void*)fp); - } } diff --git a/src/cmd/ksh93/sh/nvtree.c b/src/cmd/ksh93/sh/nvtree.c index c2d653491..4e1498350 100644 --- a/src/cmd/ksh93/sh/nvtree.c +++ b/src/cmd/ksh93/sh/nvtree.c @@ -874,7 +874,6 @@ static char **genvalue(char **argv, const char *prefix, int n, struct Walk *wp) continue; if((wp->array = nv_isarray(np)) && (ap=nv_arrayptr(np))) k = array_elem(ap); - if(wp->indent>0) sfnputc(outfile,'\t',wp->indent); nv_attribute(np,outfile,"typeset",1); diff --git a/src/cmd/ksh93/sh/nvtype.c b/src/cmd/ksh93/sh/nvtype.c index d1056cb35..7541cb295 100644 --- a/src/cmd/ksh93/sh/nvtype.c +++ b/src/cmd/ksh93/sh/nvtype.c @@ -339,7 +339,6 @@ static int fixnode(Namtype_t *dp, Namtype_t *pp, int i, struct Namref *nrp,int f nq->nvalue.cp = Empty; else if(nq->nvalue.cp==Empty) nv_offattr(nq,NV_NOFREE); - } if(fp) nv_disc(nq, &dp->childfun.fun, NV_LAST); @@ -603,7 +602,6 @@ static int typeinfo(Opt_t* op, Sfio_t *out, const char *str, Optdisc_t *fp) Namval_t *np,*nq,*tp; int n, i, offset=staktell(); Sfio_t *sp; - np = *(Namval_t**)(fp+1); stakputs(NV_CLASS); stakputc('.'); diff --git a/src/cmd/ksh93/sh/parse.c b/src/cmd/ksh93/sh/parse.c index f1474331e..289bb9c61 100644 --- a/src/cmd/ksh93/sh/parse.c +++ b/src/cmd/ksh93/sh/parse.c @@ -1641,7 +1641,6 @@ static Shnode_t *simple(Lex_t *lexp,int flag, struct ionod *io) lexp->comp_assign = 2; goto retry; } - } if(!(flag&SH_NOIO)) { diff --git a/src/cmd/ksh93/sh/path.c b/src/cmd/ksh93/sh/path.c index 9f7e1c17e..a91d0c410 100644 --- a/src/cmd/ksh93/sh/path.c +++ b/src/cmd/ksh93/sh/path.c @@ -1432,7 +1432,6 @@ static noreturn void exscript(register char *path,register char *argv[],char **e close( fd); } } - /* * Produce a pseudo-floating point representation * with 3 bits base-8 exponent, 13 bits fraction. @@ -1605,7 +1604,6 @@ Pathcomp_t *path_addpath(Pathcomp_t *first, register const char *path,int type) Pathcomp_t *old=0; int offset = staktell(); char *savptr; - if(!path && type!=PATH_PATH) return(first); if(type!=PATH_FPATH) @@ -1756,7 +1754,6 @@ Pathcomp_t *path_unsetfpath(void) } continue; } - } old = pp; pp = pp->next; diff --git a/src/cmd/ksh93/sh/streval.c b/src/cmd/ksh93/sh/streval.c index bf1e53351..cac01d6fd 100644 --- a/src/cmd/ksh93/sh/streval.c +++ b/src/cmd/ksh93/sh/streval.c @@ -870,7 +870,6 @@ again: stakpush(vp,d,Sfdouble_t); stakputc(lvalue.isfloat); } - /* check for function call */ if(lvalue.fun) continue; diff --git a/src/cmd/ksh93/sh/subshell.c b/src/cmd/ksh93/sh/subshell.c index 49bba2365..8e66dfe9b 100644 --- a/src/cmd/ksh93/sh/subshell.c +++ b/src/cmd/ksh93/sh/subshell.c @@ -313,7 +313,6 @@ Namval_t *sh_assignok(register Namval_t *np,int add) nv_delete(mp,walk,NV_NOFREE); *((Namval_t**)mp) = lp->child; lp->child = mp; - } } lp->dict = dp; diff --git a/src/cmd/ksh93/sh/suid_exec.c b/src/cmd/ksh93/sh/suid_exec.c index 6b11927a3..313840416 100644 --- a/src/cmd/ksh93/sh/suid_exec.c +++ b/src/cmd/ksh93/sh/suid_exec.c @@ -498,7 +498,6 @@ static void maketemp(char *template) *--cp = (n%10) + '0'; n /= 10; } - } /* diff --git a/src/cmd/ksh93/sh/xec.c b/src/cmd/ksh93/sh/xec.c index 0fbdaadeb..fdc2b9402 100644 --- a/src/cmd/ksh93/sh/xec.c +++ b/src/cmd/ksh93/sh/xec.c @@ -55,7 +55,7 @@ # include #endif -#if _lib_posix_spawn > 1 && _lib_posix_spawn_file_actions_addtcsetpgrp_np +#if SHOPT_SPAWN && _lib_posix_spawn > 1 && _lib_posix_spawn_file_actions_addtcsetpgrp_np #define _use_ntfork_tcpgrp 1 #endif @@ -578,7 +578,6 @@ static void put_level(Namval_t* np,const char *val,int flags,Namfun_t *fp) { sh_setscope(sp); error_info.id = sp->cmdname; - } } @@ -1088,7 +1087,6 @@ int sh_exec(register const Shnode_t *t, int flags) #endif /* SHOPT_NAMESPACE */ sh.prefix = NV_CLASS; flgs |= NV_TYPE; - } if(sh.fn_depth && !sh.prefix) flgs |= NV_NOSCOPE; @@ -1465,7 +1463,6 @@ int sh_exec(register const Shnode_t *t, int flags) #endif /* SHOPT_NAMESPACE */ np = nv_search(com0,sh.fun_tree,HASH_NOSCOPE); } - if(!np->nvalue.ip) { if(indx==1) @@ -1777,7 +1774,6 @@ int sh_exec(register const Shnode_t *t, int flags) job_wait(parent); sh_iorestore(topfd,SH_JMPCMD); sh_done((sh.exitval&SH_EXITSIG)?(sh.exitval&SH_EXITMASK):0); - } job_unlock(); } @@ -3435,7 +3431,6 @@ static void coproc_init(int pipes[]) if(fcntl(*sh.cpipe,F_SETFD,FD_CLOEXEC)>=0) sh.fdstatus[sh.cpipe[0]] |= IOCLEX; sh.fdptrs[sh.cpipe[0]] = sh.cpipe; - if(fcntl(sh.cpipe[1],F_SETFD,FD_CLOEXEC) >=0) sh.fdstatus[sh.cpipe[1]] |= IOCLEX; } diff --git a/src/cmd/ksh93/tests/subshell.sh b/src/cmd/ksh93/tests/subshell.sh index 15ea67436..4bcf5b5f4 100755 --- a/src/cmd/ksh93/tests/subshell.sh +++ b/src/cmd/ksh93/tests/subshell.sh @@ -1137,7 +1137,7 @@ fun() print -n stdout=$foo print -u2 stderr=$foo } -[[ `fun 2>&1` == 'stdout=foostderr=foo' ]] || err_exit 'nested command substitution with 2>&1 not working' +[[ `set +x; fun 2>&1` == 'stdout=foostderr=foo' ]] || err_exit 'nested command substitution with 2>&1 not working' # Various regression tests from ksh93v- 2012-10-04 and 2012-10-24 $SHELL > /dev/null -c 'echo $(for x in whatever; do case y in *) true;; esac; done)' || err_exit 'syntax error with case in command substitution' diff --git a/src/cmd/ksh93/tests/types.sh b/src/cmd/ksh93/tests/types.sh index 3db8be3bb..eea70e0c2 100755 --- a/src/cmd/ksh93/tests/types.sh +++ b/src/cmd/ksh93/tests/types.sh @@ -725,7 +725,7 @@ exp=$'start1\ntypeset -x a=one\nstart2\ntypeset -x a=one\nend2\nend1' # Backported regression test from ksh93v- 2013-08-07 for # short integer arrays in types. -got=$("$SHELL" 2>&1 <<- \EOF +got=$(set +x; "$SHELL" 2>&1 <<- \EOF typeset -T X_t=(typeset -si -a arr=(7 8) ) X_t x print -r -- $((x.arr[1])) diff --git a/src/lib/libast/comp/setlocale.c b/src/lib/libast/comp/setlocale.c index 895d30469..ced676596 100644 --- a/src/lib/libast/comp/setlocale.c +++ b/src/lib/libast/comp/setlocale.c @@ -2512,7 +2512,6 @@ single(int category, Lc_t* lc, unsigned int flags) ast.locale.set &= ~(1<