New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tarfile using fstat on GZip file object #66658
Comments
CPython tarfile I suggest checking the file object class before using fstat to determine the size, and raise a warning if it's a gzip file. To clarify, this only happens when adding a GZip file object to tar. I know that it's not a really common scenario, and the problem is really that GZip file size can only properly be determined by uncompressing and reading it entirely, but I think it's nice to not fail without warning. So this is an example that is failing:
Instead this reads the proper filesize and writes the files to a tar:
|
msg227328 states "it's not a really common scenario" but I believe we must still allow for it, what do others think? |
I think a warning in the documentation might be helpful. However a special check in the code doesn’t seem right. Would you check for LZMAFile and BZ2File as well? Some of the other attributes (modification time, owner, etc) may be useful even for a GzipFile, and the programmer can just overwrite the file size attribute if necessary. |
New changeset 94a94deaf06a by Martin Panter in branch '3.5': New changeset e66c476b25ec by Martin Panter in branch 'default': New changeset 9d5217aaea13 by Martin Panter in branch '2.7': |
Hoping my clarification in the documentation is enough to call this fixed |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: