Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com> List-Archive: <http://sourceware.org/ml/cygwin/> List-Post: <mailto:cygwin AT cygwin DOT com> List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Sun, 12 Dec 2004 16:19:48 -0500 From: Christopher Faylor <cgf-no-personal-reply-please AT cygwin DOT com> To: cygwin AT cygwin DOT com Subject: Re: short fread(), but no ferror/feof Message-ID: <20041212211948.GA19741@trixie.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com References: <Pine DOT GSO DOT 4 DOT 51L2 DOT 0412051701370 DOT 21199 AT koeberg DOT lysator DOT liu DOT se> <Pine DOT GSO DOT 4 DOT 51L2 DOT 0412112312480 DOT 19131 AT koeberg DOT lysator DOT liu DOT se> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <Pine.GSO.4.51L2.0412112312480.19131@koeberg.lysator.liu.se> User-Agent: Mutt/1.4.1i On Sat, Dec 11, 2004 at 11:32:07PM +0100, Peter Astrand wrote: >I've discussed this issue with some local gurus, and the consensus is >that fread() should do as many read() calls as it takes. This is what >glibc does, for example (if I understand the source correctly). >Basically, fread() means "read everything". It's just plain wrong to >return a partial result, unless EOF or an error occured. > >>Of course, Peter can always detect when this situation has occurred, >>precisely because fread() returns a value that, while >= 0, is < the >>number of elements requested, and when feof() and ferror() both return >>zero, his code could deduce that it's a short read from a pipe and try >>again. > >If you can convince the Python developers to add these checks to the >already-complicated fread() invocation in fileobject.c, I will stop >complaining... But fread() shouldn't behave like that. Perhaps you should prevail upon your gurus to provide a patch to fix this problem rather than relying on "complaining". cgf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/