Hi,

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 *')


After fixing this, the ksh hangs in some kind of loop with outexcept , sfsync and errorv in it

How to reproduce:

1)create file (disk image) with dd
2)create a loop device with it
3)create fs on the loop
4)mount that loop
5)fill up that fs
6)echo "some text" >file.txt

in old ksh: no message and file.txt is empty
in beta: no message and file.txt is empty
in beta with fix: ksh hangs

note: ext3 (and some other fs) has reserved space for root, so it can change the result if you fill up device as non-root user and try echo ... as root



Glenn Fowler wrote:
this has been fixed by adding an sfio discipline with
an error exception callout on all internal output streams (except stderr)

there will be a beta post later today
thanks

On Tue, 07 Oct 2008 17:17:05 +0200 Michal Hlavinka wrote:
Hi!

We've found that ksh's builtins fail to report errors on failed file operations, e.g.:

echo "something" > /mnt/filesystem/file.txt

Will not report an error and would have zero return code even if
"/mnt/filesystem" was full and the file.txt could not be written to.

This problem seems to be present even in the latest upstream version and is
caused by not checking the return codes of sfsync/sfwrite/sfclose functions.
Excerpt from src/cmd/ksh93/bltins/print.c:

342    else if(n&SF_SHARE)
343    {
344        sfset(outfile,SF_SHARE|SF_PUBLIC,1);
345        sfsync(outfile);
346    }
347    return(exitval);

Note the line 345: if sfsync fails, the builtins print printf or echo would
still return no error which may lead to data loss. The return codes of
sfsync/sfclose or sfwrite should not be ignored and any error should be
indicated to the user with a proper return code of the command and an error
message.

What do you think about this?

Bye,
Michal
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers


_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to