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: tarfile tries to file_.tell() even when creating a new archive
Type: crash Stage:
Components: Extension Modules Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: lars.gustaebel Nosy List: lars.gustaebel, strombrg, terry.reedy
Priority: normal Keywords:

Created on 2011-03-09 05:00 by strombrg, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
tar-test strombrg, 2011-03-09 05:00
Messages (4)
msg130422 - (view) Author: Dan Stromberg (strombrg) Date: 2011-03-09 05:00
The attached file demonstrates the problem in 2.5, 2.5, 2.7, 3.0, 3.1 and 3.2.

In short, I believe when you're creating a new tar archive (say, to a pipe), there should be no need for a file_.tell() (which blows up when it's a pipe).

I have a workaround, as demonstrated in the file, but probably others shouldn't have to work around this also in the future.

Suggested fix: Only do the tell when you're appending or performing other operations that require subsequent seek's.
msg130437 - (view) Author: Lars Gustäbel (lars.gustaebel) * (Python committer) Date: 2011-03-09 09:48
If I understand correctly, the solution to your problem would be to use the stream mode "w|" instead of "w". Could you please try that?
msg137421 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011-06-01 06:27
2.5 is closed; 2.6 security fix only, 3.1 soon will be
msg137434 - (view) Author: Dan Stromberg (strombrg) Date: 2011-06-01 15:04
Yes, I just needed to use 'w|' instead of 'w'.

Thanks!
History
Date User Action Args
2022-04-11 14:57:14adminsetgithub: 55658
2011-06-01 15:04:18strombrgsetstatus: open -> closed
resolution: works for me
messages: + msg137434
2011-06-01 06:27:17terry.reedysetnosy: + terry.reedy

messages: + msg137421
versions: - Python 2.6, Python 2.5, Python 3.1
2011-03-09 09:48:20lars.gustaebelsetassignee: lars.gustaebel
messages: + msg130437
2011-03-09 07:40:21ned.deilysetnosy: + lars.gustaebel
2011-03-09 05:00:11strombrgcreate