[Pythonmac-SIG] file.read() after file.readline() problem

Alexandre Parenteau alexp@strata.com
Fri, 05 Oct 2001 16:30:17 -0700


Jack,

> But unfortunately your fix won't work, and the real problem must be
> somewhere deeper down (in GUSI?).

Yes you're right, I was a little fast to conclude. Something goes wacky
anyway when calling GUSI's lseek, that's all I can tell so far. Could be a
mixed up in the GUSI buffering mechanism.

In fact lseek does purge its own cache, so may be it should not (see
GUSIMacFileSocket::lseek and then GUSIMacFileSocket::SyncRead)

Alex.

> 
> The lseek() is intentional: as the comment above that code fragment
> shows some stdio implementations flush the buffer on an fseek(), even
> if the underlying file is unseekable (and fseek() should be a noop).
> Moreover, this specific lseek() call is a no-op, so even though stdio
> doesn't know about us doing it it should harm it either.
> 
> I have this very vague memory of problems with GUSI and seek() and it
> messing up the GUSI buffering mechanism, but I think that that was a
> long time ago. That 1.5.2 works fine also points that way (152 was
> GUSI1 based, 2.0 was the first GUSI2 based MacPython. Also, the bug is
> probably a general GUSI2 problem: 2.0 didn't use the hacked up
> CarbonGUSI yet).
> --
> Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
> Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
> www.cwi.nl/~jack        | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm
>