Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > python 2.4: tarfile tell() and seek() seem to be broeken

Reply
Thread Tools

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

 
 
N. Volbers
Guest
Posts: n/a
 
      06-01-2005
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.


 
Reply With Quote
 
 
 
 
=?iso-8859-1?q?Lars_Gust=E4bel?=
Guest
Posts: n/a
 
      06-02-2005
On Wed, 01 Jun 2005 14:58:23 +0200, N. Volbers wrote:

> - 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.

--
Lars Gustäbel
http://www.velocityreviews.com/forums/(E-Mail Removed)

 
Reply With Quote
 
 
 
 
N. Volbers
Guest
Posts: n/a
 
      06-02-2005
Am Thu, 02 Jun 2005 17:57:20 +0200 schrieb Lars Gustäbel:

> On Wed, 01 Jun 2005 14:58:23 +0200, N. Volbers wrote:
>
>> - 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

 
Reply With Quote
 
=?iso-8859-1?q?Lars_Gust=E4bel?=
Guest
Posts: n/a
 
      06-30-2005
On Thu, 02 Jun 2005 19:52:24 +0200, N. Volbers wrote:

> Thanks for taking care of it


I submitted patch #1230446 today which ought to fix the problem.

--
Lars Gustäbel
(E-Mail Removed)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create TarFile using python itzel Python 6 09-08-2009 11:15 AM
Re: How to process a very large (4Gb) tarfile from python? Uwe Schmitt Python 5 07-19-2008 10:11 AM
tarfile+bz2 and GnuPGInterface Ron Johnson Python 0 10-17-2004 12:08 AM
'name is too long' (tarfile, python 2.2, Debian Woody) Lars Behrens Python 4 08-20-2003 07:55 PM
tarfile and end-of-tape Josh Smith Python 1 08-05-2003 10:58 AM



Advertisments