This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: bug in tarfile.ExFileObject.readline
Type: Stage:
Components: Extension Modules Versions:
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: Nosy List: gazzadee, loewis
Priority: normal Keywords: patch

Created on 2004-08-24 04:48 by gazzadee, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
tarfile.py.diff gazzadee, 2004-08-24 04:48 context diff from CVS head (revision 1.18)
Messages (2)
msg46777 - (view) Author: GaryD (gazzadee) Date: 2004-08-24 04:48
TarFile objects produce file-like objects to represent
internal files in the archive. There appears to be a
bug in the readline implementation for these objects.

When you specify the size parameter for readline, the
standard function will try to read one line with at
most size characters. However, in the tarfile module,
it may return extra data beyond the end of the line
(and also not clean out the trailing \r).

The problem is that after reading the maximum data, we
break out of the loop before checking for a newline.
This is fixed by modifying the while test.

This patch may break existing code which uses this
'feature'.
msg46778 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-08-25 10:56
Logged In: YES 
user_id=21627

Thanks for the patch. Applied as tarfile.py 1.19 and
1.8.12.4, NEWS 1.831.4.148. I doubt this will break existing
code since people typically invoke readline without
arguments, and should expect that readline returns at most a
line - hence the backport to 2.3.

As for dealing with \r: patches to support universal
newlines would be welcome.
History
Date User Action Args
2022-04-11 14:56:06adminsetgithub: 40814
2004-08-24 04:48:25gazzadeecreate