public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Christopher Faylor <cgf-no-personal-reply-please@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: short fread(), but no ferror/feof
Date: Sun, 12 Dec 2004 21:18:00 -0000	[thread overview]
Message-ID: <20041212211948.GA19741@trixie.casa.cgf.cx> (raw)
In-Reply-To: <Pine.GSO.4.51L2.0412112312480.19131@koeberg.lysator.liu.se>

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/

  reply	other threads:[~2004-12-12 21:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-05 16:18 Peter Åstrand
2004-12-05 17:43 ` Christopher Faylor
2004-12-09 23:41 ` Peter Astrand
2004-12-10  0:49   ` Igor Pechtchanski
2004-12-10  0:59     ` Christopher Faylor
2004-12-10 10:18     ` Peter Astrand
2004-12-10 12:12       ` Jason Tishler
2004-12-10 13:48         ` Dave Korn
2004-12-11 22:32 ` Peter Astrand
2004-12-12 21:18   ` Christopher Faylor [this message]
2004-12-13 19:55   ` Jeff Johnston
2004-12-13 20:53     ` Peter Astrand
2004-12-14  5:00       ` Ralf Corsepius
2004-12-14 13:41     ` Jason Tishler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041212211948.GA19741@trixie.casa.cgf.cx \
    --to=cgf-no-personal-reply-please@cygwin.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).