Dr. Werner Fink 2013-10-22 11:59:47 +00:00 committed by Git OBS Bridge
parent 42805f1cc8
commit d220110303
3 changed files with 85 additions and 24 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Oct 22 11:58:21 UTC 2013 - werner@suse.de
- Change patch ksh93-fdstatus.dif by adding some more EINTR wrapper
-------------------------------------------------------------------
Fri Oct 18 12:21:58 UTC 2013 - werner@suse.de

View File

@ -330,6 +330,7 @@ fi
cflags -Wno-implicit IGNORE
cflags -Wno-unused-value IGNORE
cflags -Wno-type-limits IGNORE
cflags -Wclobbered RPM_OPT_FLAGS
#
# Do not use -DSHOPT_SPAWN=1 and/or -DSHOPT_AMP=1 this would cause
# errors due race conditions while executing the test suite.
@ -541,6 +542,7 @@ fi
sed -ri '/^L[[:blank:]]/a \t 8000' pty.sh
sed -ri 's/(SECONDS[[:blank:]]*>[[:blank:]]*)([[:digit:]]+)/\18/' signal.sh
unset ${!LESS*}
grep -E '^(model name|flags)[[:blank:]]*:' /proc/cpuinfo | sort -ur
${SHELL} shtests
exec 3> ${TMPDIR:-/tmp}/log
LANG=POSIX

View File

@ -576,7 +576,7 @@
if(fd<0)
return(0);
if(fd < shp->gd->lim.open_max)
@@ -422,7 +423,7 @@ int sh_iovalidfd(Shell_t *shp, int fd)
@@ -422,13 +423,13 @@ int sh_iovalidfd(Shell_t *shp, int fd)
if(n > max)
n = max;
max = shp->gd->lim.open_max;
@ -585,6 +585,13 @@
if(max)
memcpy(shp->sftable,sftable,max*sizeof(Sfio_t*));
shp->fdptrs = (int**)(&shp->sftable[n]);
if(max)
memcpy(shp->fdptrs,fdptrs,max*sizeof(int*));
- shp->fdstatus = (unsigned char*)(&shp->fdptrs[n]);
+ shp->fdstatus = (unsigned int*)(&shp->fdptrs[n]);
if(max)
memcpy(shp->fdstatus,fdstatus,max);
if(sftable)
@@ -453,6 +454,8 @@ void sh_ioinit(Shell_t *shp)
sfnotify(sftrack);
sh_iostream(shp,0);
@ -855,6 +862,40 @@
for(;c= *cp;cp++)
{
if(c==HIST_CHAR)
@@ -2494,12 +2578,14 @@ skip:
*/
ssize_t sh_read(register int fd, void* buff, size_t n)
{
+ int r,err=errno;
Shell_t *shp = sh_getinterp();
register Sfio_t *sp;
if(sp=shp->sftable[fd])
return(sfread(sp,buff,n));
- else
- return(read(fd,buff,n));
+ while ((r=read(fd,buff,n))<0 && errno==EINTR)
+ errno = err;
+ return(r);
}
#undef write
@@ -2508,12 +2594,14 @@ ssize_t sh_read(register int fd, void* b
*/
ssize_t sh_write(register int fd, const void* buff, size_t n)
{
+ int r,err=errno;
Shell_t *shp = sh_getinterp();
register Sfio_t *sp;
if(sp=shp->sftable[fd])
return(sfwrite(sp,buff,n));
- else
- return(write(fd,buff,n));
+ while ((r=write(fd,buff,n))<0 && errno==EINTR)
+ errno = err;
+ return(r);
}
#undef lseek
--- src/cmd/ksh93/sh/jobs.c
+++ src/cmd/ksh93/sh/jobs.c 2013-09-16 14:18:07.000000000 +0000
@@ -424,6 +424,8 @@ int job_reap(register int sig)
@ -1936,6 +1977,19 @@
if(np==shp->typeinit)
shp->typeinit = 0;
shp->envlist = argp;
@@ -1451,7 +1451,11 @@ int sh_exec(register const Shnode_t *t,
stat(".",&stata);
/* restore directory changed */
if(statb.st_ino!=stata.st_ino || statb.st_dev!=stata.st_dev)
- chdir(shp->pwd);
+ {
+ int err=errno;
+ while((chdir(shp->pwd) < 0) && errno==EINTR)
+ errno = err;
+ }
}
sh_offstate(SH_STOPOK);
if(share&SF_SHARE)
@@ -1570,7 +1587,7 @@ int sh_exec(register const Shnode_t *t,
unset_instance(nq,&node,&nr,mode);
sh_funstaks(slp->slchild,-1);
@ -1945,7 +1999,7 @@
siglongjmp(*shp->jmplist,jmpval);
goto setexit;
}
@@ -1597,10 +1614,14 @@ int sh_exec(register const Shnode_t *t,
@@ -1597,10 +1618,14 @@ int sh_exec(register const Shnode_t *t,
if(shp->subshell)
{
sh_subtmpfile(shp);
@ -1963,7 +2017,7 @@
}
no_fork = !ntflag && !(type&(FAMP|FPOU)) && !shp->subshell &&
!(shp->st.trapcom[SIGINT] && *shp->st.trapcom[SIGINT]) &&
@@ -1676,7 +1697,7 @@ int sh_exec(register const Shnode_t *t,
@@ -1676,7 +1701,7 @@ int sh_exec(register const Shnode_t *t,
if(parent<0)
{
if(shp->comsub==1 && usepipe && unpipe)
@ -1972,7 +2026,7 @@
break;
}
#else
@@ -1693,7 +1714,7 @@ int sh_exec(register const Shnode_t *t,
@@ -1693,7 +1718,7 @@ int sh_exec(register const Shnode_t *t,
if(parent<0)
{
if(shp->comsub==1 && usepipe && unpipe)
@ -1981,7 +2035,7 @@
break;
}
#else
@@ -1715,6 +1736,8 @@ int sh_exec(register const Shnode_t *t,
@@ -1715,6 +1740,8 @@ int sh_exec(register const Shnode_t *t,
nlock--;
job_unlock();
}
@ -1990,7 +2044,7 @@
if(type&FPCL)
sh_close(shp->inpipe[0]);
if(type&(FCOOP|FAMP))
@@ -1730,11 +1753,15 @@ int sh_exec(register const Shnode_t *t,
@@ -1730,11 +1757,15 @@ int sh_exec(register const Shnode_t *t,
if(shp->pipepid)
shp->pipepid = parent;
else
@ -2008,7 +2062,7 @@
if(!sh_isoption(SH_MONITOR))
{
shp->trapnote &= ~SH_SIGIGNORE;
@@ -1906,8 +1933,8 @@ int sh_exec(register const Shnode_t *t,
@@ -1906,8 +1937,8 @@ int sh_exec(register const Shnode_t *t,
{
was_interactive = sh_isstate(SH_INTERACTIVE);
sh_offstate(SH_INTERACTIVE);
@ -2018,7 +2072,7 @@
sh_iorenumber(shp,shp->inpipe[0],0);
/*
* if read end of pipe is a simple command
@@ -1924,7 +1951,7 @@ int sh_exec(register const Shnode_t *t,
@@ -1924,7 +1955,7 @@ int sh_exec(register const Shnode_t *t,
jmpval = sigsetjmp(buffp->buff,0);
if(jmpval==0)
{
@ -2027,7 +2081,7 @@
tsetio = 1;
sh_redirect(shp,t->fork.forkio,execflg);
(t->fork.forktre)->tre.tretyp |= t->tre.tretyp&FSHOWME;
@@ -1953,8 +1980,8 @@ int sh_exec(register const Shnode_t *t,
@@ -1953,8 +1984,8 @@ int sh_exec(register const Shnode_t *t,
if(type || !sh_isoption(SH_PIPEFAIL))
shp->exitval = type;
}
@ -2038,7 +2092,7 @@
shp->pipepid = 0;
shp->st.ioset = 0;
if(simple && was_errexit)
@@ -2179,7 +2206,7 @@ int sh_exec(register const Shnode_t *t,
@@ -2179,7 +2210,7 @@ int sh_exec(register const Shnode_t *t,
}
shp->exitval = n;
#ifdef SIGTSTP
@ -2047,7 +2101,7 @@
tcsetpgrp(JOBTTY,shp->gd->pid);
#endif /*SIGTSTP */
job.curpgid = savepgid;
@@ -2320,7 +2347,10 @@ int sh_exec(register const Shnode_t *t,
@@ -2320,7 +2351,10 @@ int sh_exec(register const Shnode_t *t,
nv_putsub(np,NIL(char*),0L);
nv_putval(np,cp,0);
if(nameref)
@ -2058,7 +2112,7 @@
if(trap=shp->st.trap[SH_DEBUGTRAP])
{
av[0] = (t->tre.tretyp&COMSCAN)?"select":"for";
@@ -2352,6 +2382,8 @@ int sh_exec(register const Shnode_t *t,
@@ -2352,6 +2386,8 @@ int sh_exec(register const Shnode_t *t,
if(shp->st.breakcnt<0)
shp->st.execbrk = (++shp->st.breakcnt !=0);
}
@ -2067,7 +2121,7 @@
#if SHOPT_OPTIMIZE
endfor:
sh_popcontext(shp,buffp);
@@ -2466,8 +2498,10 @@ int sh_exec(register const Shnode_t *t,
@@ -2466,8 +2502,10 @@ int sh_exec(register const Shnode_t *t,
#if SHOPT_FILESCAN
if(iop)
{
@ -2079,7 +2133,7 @@
dup(savein);
shp->cur_line = 0;
}
@@ -2688,6 +2722,7 @@ int sh_exec(register const Shnode_t *t,
@@ -2688,6 +2726,7 @@ int sh_exec(register const Shnode_t *t,
else
{
root = dtopen(&_Nvdisc,Dtoset);
@ -2087,7 +2141,7 @@
nv_mount(np, (char*)0, root);
np->nvalue.cp = Empty;
dtview(root,shp->var_base);
@@ -2729,7 +2764,7 @@ int sh_exec(register const Shnode_t *t,
@@ -2729,7 +2768,7 @@ int sh_exec(register const Shnode_t *t,
np = sh_fsearch(shp,fname,NV_ADD|HASH_NOSCOPE);
if(!np)
#endif /* SHOPT_NAMESPACE */
@ -2096,7 +2150,7 @@
if(npv)
{
if(!shp->mktype)
@@ -2745,7 +2780,7 @@ int sh_exec(register const Shnode_t *t,
@@ -2745,7 +2784,7 @@ int sh_exec(register const Shnode_t *t,
stakdelete(slp->slptr);
if(rp->sdict)
{
@ -2105,7 +2159,7 @@
shp->last_root = rp->sdict;
for(mp=(Namval_t*)dtfirst(rp->sdict);mp;mp=nq)
{
@@ -2799,7 +2834,8 @@ int sh_exec(register const Shnode_t *t,
@@ -2799,7 +2838,8 @@ int sh_exec(register const Shnode_t *t,
rp->np = np;
if(!shp->fpathdict)
shp->fpathdict = dtopen(&_Rpdisc,Dtobag);
@ -2115,7 +2169,7 @@
dtuserdata(shp->fpathdict,shp,1);
dtinsert(shp->fpathdict,rp);
}
@@ -2909,6 +2945,15 @@ int sh_exec(register const Shnode_t *t,
@@ -2909,6 +2949,15 @@ int sh_exec(register const Shnode_t *t,
break;
}
}
@ -2131,7 +2185,7 @@
if(shp->trapnote || (shp->exitval && sh_isstate(SH_ERREXIT)) &&
t && echeck)
sh_chktrap(shp);
@@ -3165,7 +3210,7 @@ pid_t _sh_fork(Shell_t *shp,register pid
@@ -3165,7 +3214,7 @@ pid_t _sh_fork(Shell_t *shp,register pid
{
if(shp->topfd > restorefd)
sh_iorestore(shp,restorefd,0);
@ -2140,7 +2194,7 @@
}
}
return(parent);
@@ -3477,8 +3522,7 @@ static void sh_funct(Shell_t *shp,Namval
@@ -3477,8 +3526,7 @@ static void sh_funct(Shell_t *shp,Namval
struct funenv fun;
char *fname = nv_getval(SH_FUNNAMENOD);
struct Level *lp =(struct Level*)(SH_LEVELNOD->nvfun);
@ -2150,7 +2204,7 @@
shp->pipepid = 0;
sh_stats(STAT_FUNCT);
if(!lp->hdr.disc)
@@ -3521,7 +3565,6 @@ static void sh_funct(Shell_t *shp,Namval
@@ -3521,7 +3569,6 @@ static void sh_funct(Shell_t *shp,Namval
lp->maxlevel = level;
SH_LEVELNOD->nvalue.s = lp->maxlevel;
shp->last_root = nv_dict(DOTSHNOD);
@ -2158,7 +2212,7 @@
#if 0
nv_putval(SH_FUNNAMENOD,shp->st.funname,NV_NOFREE);
#else
@@ -3626,11 +3669,11 @@ static void coproc_init(Shell_t *shp, in
@@ -3626,11 +3673,11 @@ static void coproc_init(Shell_t *shp, in
sh_pipe(shp->cpipe);
if((outfd=shp->cpipe[1]) < 10)
{
@ -2172,7 +2226,7 @@
shp->fdstatus[outfd] = IOCLOSE;
shp->cpipe[1] = fd;
}
@@ -3719,7 +3762,7 @@ static int run_subshell(Shell_t *shp,con
@@ -3719,7 +3766,7 @@ static int run_subshell(Shell_t *shp,con
if(!shp->gd->shpath)
shp->gd->shpath = pathshell();
pid = spawnveg(shp->shpath,arglist,envlist,grp);
@ -2181,7 +2235,7 @@
for(i=3; i < 10; i++)
{
if(shp->fdstatus[i]&IOCLEX && i!=pin && i!=pout)
@@ -4000,7 +4043,7 @@ static pid_t sh_ntfork(Shell_t *shp,cons
@@ -4000,7 +4047,7 @@ static pid_t sh_ntfork(Shell_t *shp,cons
shp->gd->shpath = pathshell();
spawnpid = path_spawn(shp,shp->gd->shpath,&argv[-1],arge,pp,(grp<<1)|1);
if(fd>=0)