[issue22163] max_wbits set incorrectly to -zlib.MAX_WBITS in tarfile, shouldn't be negative

2015-03-22 Thread Mark Lawrence

Mark Lawrence added the comment:

Is the thinking and hence the patch correct here?

--
nosy: +BreamoreBoy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22163
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22163] max_wbits set incorrectly to -zlib.MAX_WBITS in tarfile, shouldn't be negative

2015-03-22 Thread Martin Panter

Martin Panter added the comment:

I suspect the patch is wrong and the zlib documentation needs fixing instead. 
See https://docs.python.org/dev/library/zlib.html#zlib.decompress for a 
possible explanation of the negative sign, although it would make more sense 
for compress() which would actually create a “gzip” header.

--
assignee:  - docs@python
components: +Documentation
nosy: +docs@python, vadmium

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22163
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22163] max_wbits set incorrectly to -zlib.MAX_WBITS in tarfile, shouldn't be negative

2015-03-22 Thread Martin Panter

Martin Panter added the comment:

Eduardo’s patch causes many tests to fail. Abbreviated test output:

$ ./python -bWall -m test -v test_tarfile
==
ERROR: test_compare_members (test.test_tarfile.GzipStreamReadTest)
ERROR: test_empty_tarfile (test.test_tarfile.GzipStreamReadTest)
ERROR: test_fileobj_regular_file (test.test_tarfile.GzipStreamReadTest)
ERROR: test_ignore_zeros (test.test_tarfile.GzipStreamReadTest)
ERROR: test_non_existent_tarfile (test.test_tarfile.GzipStreamReadTest)
ERROR: test_null_tarfile (test.test_tarfile.GzipStreamReadTest)
ERROR: test_provoke_stream_error (test.test_tarfile.GzipStreamReadTest)
ERROR: test_read_through (test.test_tarfile.GzipStreamReadTest)
--
tarfile.ReadError: invalid compressed data

==
ERROR: test_stream_padding (test.test_tarfile.GzipStreamWriteTest)
--
zlib.error: Error -3 while decompressing data: invalid stored block lengths

==
FAIL: test_detect_file (test.test_tarfile.GzipDetectReadTest)
FAIL: test_detect_fileobj (test.test_tarfile.GzipDetectReadTest)
AssertionError

--
Ran 387 tests in 14.216s

FAILED (failures=2, errors=9, skipped=8)

There is already Issue 5784 open about clarifying the “wbits” parameter, so I 
think we can close this as a duplicate.

--
resolution:  - duplicate
status: open - closed
superseder:  - raw deflate format and zlib module

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22163
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22163] max_wbits set incorrectly to -zlib.MAX_WBITS in tarfile, shouldn't be negative

2014-08-29 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
nosy: +lars.gustaebel
stage:  - patch review
versions:  -Python 3.1, Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22163
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22163] max_wbits set incorrectly to -zlib.MAX_WBITS in tarfile, shouldn't be negative

2014-08-29 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22163
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22163] max_wbits set incorrectly to -zlib.MAX_WBITS in tarfile, shouldn't be negative

2014-08-07 Thread Eduardo Robles Elvira

New submission from Eduardo Robles Elvira:

I think I have found a small typo-bug in tarfile.py, that seems to
be present in cpython upstream, which makes tarfile compression slower.
The issue can be seen here, in line 415 [1] of tarfile.py:

self.cmp = self.zlib.compressobj(9, self.zlib.DEFLATED,
-self.zlib.MAX_WBITS,
self.zlib.DEF_MEM_LEVEL,
0)

The minus sign doesn't make sense to me, because zlib.MAX_WBITS is 15,
and according to the documentation [2] wbits is by default 15 and
This should be an integer from 8 to 15. Higher values give better
compression, but use more memory. -15 is not even in range. So I guess the 
expected value should be the zlib default, 15. Or maybe another value, but it 
should at least be in range. 

I marked it as performance type bug as this only really affects performance.

I might have gotten it all wrong and it's fine the way it is, but I thought 
it'd be best to report it, as it looked fishy to me.

--
[1] http://hg.python.org/cpython/file/94d0e842b9ea/Lib/tarfile.py#l415
[2] https://docs.python.org/3.4/library/zlib.html#zlib.compressobj

--
components: Library (Lib)
files: max_wbits.patch
keywords: patch
messages: 225006
nosy: edulix
priority: normal
severity: normal
status: open
title: max_wbits set incorrectly to -zlib.MAX_WBITS in tarfile, shouldn't be 
negative
type: performance
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file36299/max_wbits.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22163
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22163] max_wbits set incorrectly to -zlib.MAX_WBITS in tarfile, shouldn't be negative

2014-08-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +nadeem.vawda

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22163
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com