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

Reply via email to