Subject: Re: Bittorrent package and 'broken libc' claim
To: None <firstname.lastname@example.org>
From: Joerg Sonnenberger <email@example.com>
Date: 07/28/2005 03:04:31
On Wed, Jul 27, 2005 at 08:29:43PM -0400, Greg Troxel wrote:
> Without this option, files are opened like this:
> self.handles[filename] = file(filename, 'rb', 0)
> where the python manual says:
> The optional bufsize argument specifies the file's desired buffer
> size: 0 means unbuffered, 1 means line buffered, any other positive
> value means use a buffer of (approximately) that size. A negative
> bufsize means to use the system default, which is usually line
> buffered for tty devices and fully buffered for other files. If
> omitted, the system default is used.
Ah! I've seen this problem on DragonFly too. Now it makes perfect sense.
Turning off buffering means a few things in the BSD libc:
(a) Reads are done with a buffer size of 1. That might arguable be a bug
for fread() or not, it's hard to say. I'm investigating.
(b) All open FILEs are fflushed before reading from such a file.
(c) Certain IO routines are checking for '\n' and handling it specially.