Glenn Fowler wrote:
On Tue, 14 Oct 2008 16:02:44 +0200 Michal Hlavinka wrote:
we've tested new beta (20081010) and the problem still exists.
First: there is a bug in src/cmd/ksh93/sh/io.c : outexcept() : line 430:
it should be:
else if(type==SF_WRITE && (*((ssize_t *)data))<0 && errno!=EINTR &&
sffileno(iop)!=2)
instead of:
else if(type==SF_WRITE && ((ssize_t)data)<0 && errno!=EINTR &&
sffileno(iop)!=2)
it checks data's pointer address instead of the value (data is 'void *')
thanks for catching this
the other problem is the sfio pool that contains { sfstdout sfstderr }
try this replacement for outexcept
---
static int outexcept(register Sfio_t *iop,int type,void *data,Sfdisc_t *handle)
{
static int active = 0;
NOT_USED(handle);
if(type==SF_DPOP || type==SF_FINAL)
free((void*)handle);
else if(type==SF_WRITE && (*(ssize_t*)data)<0 && errno!=EINTR &&
sffileno(iop)!=2)
{
if(!active)
{
int mode = ((struct checkpt*)sh.jmplist)->mode;
int save = errno;
active = 1;
((struct checkpt*)sh.jmplist)->mode = 0;
sfpurge(iop);
sfpool(iop,NIL(Sfio_t*),SF_WRITE);
errno = save;
errormsg(SH_DICT,ERROR_system(1),e_badwrite,sffileno(iop));
active = 0;
((struct checkpt*)sh.jmplist)->mode = mode;
sh_exit(1);
}
return(-1);
}
return(0);
}
this replacement works
$ echo "hello world" >>file.txt || echo "KO"
ksh: echo: write to 1 failed [No space left on device]
KO
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers