-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark Brown wrote:
>> When reading uncompressed files with gzread() the EOF indicator is not
>> always set correctly. The EOF indicator is only set, when the underlying
>> fread() returned 0. This is incorrect, since any return value that is
>> shorter than the nmemb argument may indicate an EOF. The correct
>> behavior is to explicitly check feof() after the fread() determine
>> whether EOF occored.
> 
> I don't feel that this is a bug.  While a short read may indicate EOF it
> doesn't need to and the additional read should not cause any harm to
> applications - they need to be able to cope with both short reads and
> explicit EOF anyway - and I know there are users who want lazy EOF
> detection to facilitate things like reading from files as they are being
> written.

Please note, that my patch will only change/fix the behavior if gzeof(),
not of gzread(). My patch will set the EOF indicator in zlib, when the
underlying file had an EOF (by checking feof()). gzread() will still
return the short count (and not 0).

IMHO gzeof() should have the same semantic than feof(). At the moment it
doesn't.
Also note, that gzeof()'s semantic is different for compressed and
uncompressed files. For compressed files gzeof() may indicate EOF after
a short gzread() (if the end-of-file was encountered), whereas for
uncompressed files gzeof() will only indicate EOF if the last gzread()
got exactly 0 bytes.

IMHO gzeof() behavior for uncompressed files is clearly broken, since it
differs from
* feof()'s behavior when using fread()   and from
* gzeof()'s behavior when reading from compressed files.


My suggested patch fixes this, so that gzeof() always has the same semantic.




> On an unrelated note, please note that when filing bugs with the BTS you
> should not CC the maintainer.  The maintainer will be notified by the
> BTS with the bug number that is assigned.
alright. Sorry about that.


Regards
Gregor

- --
Gregor Maier                             [EMAIL PROTECTED]
TU Berlin / Deutsche Telekom Labs             [EMAIL PROTECTED]
Sekr. TEL 4, FG INET                        www.net.t-labs.tu-berlin.de
Ernst-Reuter-Platz 7
10587 Berlin, Germany
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHTy6JdGiwgbikMYMRAsq5AJ0Z54t3gRdnrmiGURv1MmVq5Z6b4wCgmqan
hMJzS4rQzgAZyFqHMuwAKUw=
=qYED
-----END PGP SIGNATURE-----



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to