Issue 23421: tarfile module does not correctly choose compression algorithms (original ) (raw )Created on 2015-02-09 13:03 by wdv4758h , last changed 2022-04-11 14:58 by admin . This issue is now closed .
| Repositories containing patches | | | |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | | |
| https://bitbucket.org/wdv4758h/cpython/commits/92ac903167a52106435b32e89c1f2a119cb56686 | | | |
| https://bitbucket.org/wdv4758h/cpython/commits/ae6e80a4aadda9a139f568bda3bd4fba086dcc8b | | | |
| https://bitbucket.org/wdv4758h/cpython/commits/0ef46feae8df5e67916f275521315f492ee344b7 | | | |
Messages (11)
msg235604 - (view)
Author: Chiu-Hsiang Hsu (wdv4758h) *
Date: 2015-02-09 13:03
The command "python -m tarfile -c test.tar.bz2 test/" should create a file that is compressed by bzip2, but actually the detection of compression algorithm that should be used is broken (for gz, xz, bz2). fix it by prepending a dot to the keys of the dictionary
msg235606 - (view)
Author: Serhiy Storchaka (serhiy.storchaka) *
Date: 2015-02-09 13:13
Thank you for your patch. Could you provide tests?
msg235608 - (view)
Author: Chiu-Hsiang Hsu (wdv4758h) *
Date: 2015-02-09 13:28
yes just wanna know is there a standard way to get file type by libmagic ?
msg235609 - (view)
Author: Serhiy Storchaka (serhiy.storchaka) *
Date: 2015-02-09 14:06
No need to use libmagic. tarfile.TarFile.gzopen() should fail if the file is not gzipped tar file. There CLI tests in Lib/test/test_tarfile.py . New test should create tar file with file name that ends with the '.gz' extension and check that it can be open and read with gzopen().
msg235611 - (view)
Author: Chiu-Hsiang Hsu (wdv4758h) *
Date: 2015-02-09 14:13
Oh, I can use it. thx
msg235623 - (view)
Author: Chiu-Hsiang Hsu (wdv4758h) *
Date: 2015-02-09 17:41
Here is the tests.
msg235626 - (view)
Author: Serhiy Storchaka (serhiy.storchaka) *
Date: 2015-02-09 18:34
In general LGTM, but I have added few nitpicks on Rietveld.
msg235668 - (view)
Author: Chiu-Hsiang Hsu (wdv4758h) *
Date: 2015-02-10 05:50
Attached factored patch for tests. It looks much better. :)
msg235669 - (view)
Author: Chiu-Hsiang Hsu (wdv4758h) *
Date: 2015-02-10 05:52
s/factored/refactored/
msg235671 - (view)
Author: Roundup Robot (python-dev)
Date: 2015-02-10 06:48
New changeset 2a06379f6562 by Serhiy Storchaka in branch '3.4': Issue #23421 : Fixed compression in tarfile CLI. Patch by wdv4758h. https://hg.python.org/cpython/rev/2a06379f6562 New changeset 5b70eb1cfad0 by Serhiy Storchaka in branch 'default': Issue #23421 : Fixed compression in tarfile CLI. Patch by wdv4758h. https://hg.python.org/cpython/rev/5b70eb1cfad0
msg235672 - (view)
Author: Serhiy Storchaka (serhiy.storchaka) *
Date: 2015-02-10 06:49
Thank you for your contribution.
History
Date
User
Action
Args
2022-04-11 14:58:12
admin
set
github: 67609
2015-02-10 06:49:38
serhiy.storchaka
set
status: open -> closedresolution: fixedmessages: + stage: test needed -> resolved
2015-02-10 06:48:14
python-dev
set
nosy: + python-dev messages: +
2015-02-10 05:52:10
wdv4758h
set
messages: +
2015-02-10 05:50:34
wdv4758h
set
files: + add_tarfile_cli_filetype_test_refactor.patch hgrepos: + hgrepo299messages: +
2015-02-09 18:34:49
serhiy.storchaka
set
assignee: serhiy.storchaka
2015-02-09 18:34:36
serhiy.storchaka
set
messages: +
2015-02-09 17:41:38
wdv4758h
set
files: + add_tarfile_cli_filetype_test.patch hgrepos: + hgrepo298messages: +
2015-02-09 14:13:18
wdv4758h
set
messages: +
2015-02-09 14:06:06
serhiy.storchaka
set
messages: +
2015-02-09 13:30:47
wdv4758h
set
versions: + Python 3.4
2015-02-09 13:28:34
wdv4758h
set
messages: + versions: - Python 3.4
2015-02-09 13:13:14
serhiy.storchaka
set
versions: + Python 3.4nosy: + berker.peksag , serhiy.storchaka messages: + stage: test needed
2015-02-09 13:03:37
wdv4758h
create