[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: minor bug in bash
From: |
Chet Ramey |
Subject: |
Re: minor bug in bash |
Date: |
Tue, 17 Jan 2012 21:48:53 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 |
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 chet@case.edu http://cnswww.cns.cwru.edu/~chet/