Dr. Werner Fink 2011-05-13 15:47:15 +00:00 committed by Git OBS Bridge
parent e79c01a284
commit b1a419bdbe
3 changed files with 110 additions and 0 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri May 13 15:29:04 UTC 2011 - werner@suse.de
- Add workaround to enforce synchronization on here documents done
for forked sub shell or processes (bnc#690623)
-------------------------------------------------------------------
Fri Mar 4 16:15:16 CET 2011 - werner@suse.de

View File

@ -73,6 +73,7 @@ Patch18: ksh93-fdfn.dif
Patch19: ksh93-fdleak.dif
Patch20: ksh93-argv0.dif
Patch21: ksh93-export.dif
Patch22: ksh93-eintr.dif
%global use_suid_exe 0
%global use_locale 1
%global debug_memleak 0
@ -145,6 +146,7 @@ find share/ -type d -a -empty | xargs -r rm -vrf
%patch19
%patch20
%patch21
%patch22
%build
typeset -i IGNORED=0x$(ps --no-headers -o ignored $$)

102
ksh93-eintr.dif Normal file
View File

@ -0,0 +1,102 @@
--- src/cmd/ksh93/sh/io.c
+++ src/cmd/ksh93/sh/io.c 2011-05-03 15:15:18.283926707 +0200
@@ -403,6 +403,7 @@
shp->sftable[2] = sfstderr;
sfnotify(sftrack);
sh_iostream(shp,0);
+ sh_iostream(shp,1);
/* all write steams are in the same pool and share outbuff */
shp->outpool = sfopen(NIL(Sfio_t*),NIL(char*),"sw"); /* pool identifier */
shp->outbuff = (char*)malloc(IOBSIZE+4);
@@ -608,7 +609,8 @@
}
if(sp)
shp->sftable[f1] = 0;
- sh_close(f1);
+ if(shp->fdstatus[f1]!=IOCLOSE)
+ sh_close(f1);
}
return(f2);
}
@@ -1022,6 +1024,8 @@
memset(ap, 0, ARGVAL);
if(iof&IOPUT)
ap->argflag = ARG_RAW;
+ else if(shp->subshell)
+ sh_subtmpfile(shp);
ap->argchn.ap = (struct argnod*)fname;
ap = sh_argprocsub(shp,ap);
fname = ap->argval;
@@ -2148,13 +2152,18 @@
static ssize_t subread(Sfio_t* sp,void* buff,register size_t size,Sfdisc_t* handle)
{
register struct subfile *disp = (struct subfile*)handle;
+ ssize_t n;
NOT_USED(sp);
+ sfseek(disp->oldsp,disp->offset,SEEK_SET);
if(disp->left == 0)
return(0);
if(size > disp->left)
size = disp->left;
disp->left -= size;
- return(sfread(disp->oldsp,buff,size));
+ n = sfread(disp->oldsp,buff,size);
+ if(size>0)
+ disp->offset += size;
+ return(n);
}
/*
--- src/cmd/ksh93/sh/subshell.c
+++ src/cmd/ksh93/sh/subshell.c 2011-04-29 15:34:13.747926082 +0200
@@ -235,7 +235,7 @@
if(!sp->shpwd || np==SH_LEVELNOD || np==L_ARGNOD || np==SH_SUBSCRNOD || np==SH_NAMENOD)
return(np);
/* don't bother to save if in newer scope */
- if(sp->var!=shp->var_tree && sp->var!=shp->var_base && shp->last_root==shp->var_tree)
+ if(sp->var!=shp->var_tree && shp->last_root==shp->var_tree)
return(np);
if((ap=nv_arrayptr(np)) && (mp=nv_opensub(np)))
{
--- src/cmd/ksh93/sh/xec.c
+++ src/cmd/ksh93/sh/xec.c 2011-05-03 15:02:23.411926136 +0200
@@ -53,6 +53,7 @@
#define SH_NTFORK SH_TIMING
#define NV_BLTPFSH NV_ARRAY
+#define HERE_MEM 0x1000
#if _lib_nice
extern int nice(int);
@@ -2606,6 +2607,7 @@
pid_t sh_fork(int flags, int *jobid)
{
+ Sfio_t* aux_heredocs = NIL(Sfio_t*);
register pid_t parent;
register int sig;
#if SHOPT_FASTPIPE
@@ -2625,7 +2627,23 @@
sh.trapnote &= ~SH_SIGTERM;
job_fork(-1);
sh.savesig = -1;
+ if (sh.heredocs)
+ {
+ aux_heredocs = sftmp(HERE_MEM);
+ if (aux_heredocs)
+ {
+ sfseek(sh.heredocs,(off_t)0,SEEK_SET);
+ sfmove(sh.heredocs,aux_heredocs,(Sfoff_t)(-1),-1);
+ sfsync(aux_heredocs);
+ }
+ }
while(_sh_fork(parent=fork(),flags,jobid) < 0);
+ if (aux_heredocs)
+ {
+ if (!parent)
+ sfswap(aux_heredocs,sh.heredocs);
+ sfclose(aux_heredocs);
+ }
sh_stats(STAT_FORKS);
sig = sh.savesig;
sh.savesig = 0;