On 1/17/12 7:04 PM, Zachary Miller wrote: > > hello, > > i would like to report a what i believe to be a minor bug in bash 4.2 that has > to do with file redirection: > > in redir.c:356 (function write_here_document()), this block of code: > if (write (fd, document, document_len) < document_len) > { > if (errno == 0) > errno = ENOSPC; > return (errno); > } > else > return 0; > > checks for a short write() but doesn't retry writing the remainder of the > bytes > (and in fact returns ENOSPC instead, even though no error has yet occurred). > > according to the man page for write(2), fewer bytes may be written and this is > not by itself an error.
Thanks for the report. As a practical matter, this doesn't present a problem. When writing to a regular file, with no special flags supplied to open(), the only cases Posix says it can return fewer bytes than specified are errors. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/