python 2.4: tarfile tell() and seek() seem to be broeken

N

N. Volbers

Hello everyone,

I noticed that when you open a zipped tarball using 'tarfile' and if you
then get the pseudo-file descriptor fd for a file via 'extractfile', then
fd.tell() is broken in the following way:

- before reading anything from fd, fd.tell() will return 0 (that's still
ok)
- after reading a line via fd.readline(), fd.tell() will return a
value different from 0 (still ok, I guess)
- subsequent calls of fd.readline() and fd.tell() will yield the correct
lines but always the same value from fd.tell().

fd.seek() seems to be unaffected from this strange behaviour.

Is there a mistake on my side or does this need fixing?

Best regards,

Niklas Volbers.
 
?

=?iso-8859-1?q?Lars_Gust=E4bel?=

- subsequent calls of fd.readline() and fd.tell() will yield the correct
lines but always the same value from fd.tell().

Is there a mistake on my side or does this need fixing?

This is a bug. Although the pseudo file object's readline() method returns
the file data line-wise, the data is processed block-wise (100 chars)
internally. Therefore, the output of tell() will always return the
position right after the current block if it is used in conjunction with
readline().

Thank you for pointing that out. I'll take care of this getting fixed.
 
N

N. Volbers

Am Thu, 02 Jun 2005 17:57:20 +0200 schrieb Lars Gustäbel:
- subsequent calls of fd.readline() and fd.tell() will yield the correct
lines but always the same value from fd.tell().
[...]

Thank you for pointing that out. I'll take care of this getting fixed.

Thanks for taking care of it ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top