msg101445 - (view) |
Author: Arkadiusz Miśkiewicz (arekm) |
Date: 2010-03-21 19:12 |
Starting with zlib 1.2.4 zlib test suite fails with:
test test_zlib failed -- Traceback (most recent call last):
File "/home/users/arekm/rpm/BUILD/Python-2.6.5/Lib/test/test_zlib.py", line 84, in test_baddecompressobj
self.assertRaises(ValueError, zlib.decompressobj, 0)
AssertionError: ValueError not raised
|
msg101751 - (view) |
Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * |
Date: 2010-03-26 14:54 |
According to http://www.zlib.net/ChangeLog.txt, since zlib 1.2.3.5::
- Use zlib header window size if windowBits is 0 in inflateInit2()
The failing test should be changed, for example::
self.assertRaises(ValueError, zlib.decompressobj, -1)
|
msg101908 - (view) |
Author: Valerio Turturici (valerio.turturici) |
Date: 2010-03-29 22:28 |
I can pick up this bug.
|
msg101909 - (view) |
Author: Valerio Turturici (valerio.turturici) |
Date: 2010-03-29 23:09 |
I confirm that the bug still exists on trunk.
|
msg101910 - (view) |
Author: Valerio Turturici (valerio.turturici) |
Date: 2010-03-30 00:02 |
This is my first patch, i apologize if i make some mistakes.
|
msg101911 - (view) |
Author: R. David Murray (r.david.murray) * |
Date: 2010-03-30 01:08 |
I imagine the problem exists in 3.x as well (unless someone proves otherwise), so I'm adjusting the versions to the places it can be fixed.
Does the patched test still work with the older zlib?
|
msg101922 - (view) |
Author: Valerio Turturici (valerio.turturici) |
Date: 2010-03-30 09:01 |
Now i make patches for other versions of Python.
How i try if the patched test still work with the older zlib?
|
msg101923 - (view) |
Author: Nick Coghlan (ncoghlan) * |
Date: 2010-03-30 09:10 |
I'm not sure simply changing the value is the right thing to do - with older zlib versions (which do the wrong thing with 0), we definitely want that exception to be triggered.
For newer versions, we want to check that passing in 0 worked as specified in the zlib patch note and that -1 still raises the exception.
Changing the test behaviour based on zlib.ZLIB_VERSION is likely the best option.
|
msg101924 - (view) |
Author: Valerio Turturici (valerio.turturici) |
Date: 2010-03-30 09:24 |
Seems that from Python 2.6 to 3.2 the test work fine. With -1 still raises the exception. By the way, the original problem of Arkadiusz was with Python 2.5.
|
msg101925 - (view) |
Author: Valerio Turturici (valerio.turturici) |
Date: 2010-03-30 09:32 |
The original test, with 0, pass in all versions of Python, from 2.6 to 3.2.
|
msg101933 - (view) |
Author: Valerio Turturici (valerio.turturici) |
Date: 2010-03-30 11:32 |
I try again and ValueError not raised. The test pass without problem, both Python 2.6 and next.
|
msg101934 - (view) |
Author: Valerio Turturici (valerio.turturici) |
Date: 2010-03-30 11:33 |
P.S: the value it's default, 0.
|
msg102000 - (view) |
Author: R. David Murray (r.david.murray) * |
Date: 2010-03-31 12:09 |
Nick's point is that we should be testing both the value 0 and the value -1, but that we should expect 0 to fail only if zlib.ZLIB_VERSION is less than 1.2.4. So you'll need to update your patch to keep the 0 test but put it inside an appropriate conditional.
The original problem may be in 2.5, but we are doing security updates only for 2.5, so the fix won't backported to 2.5. (At least not by us, distributors are of course free to patch their own distributions of earlier python versions.)
I'm not sure what your last comment about the default means.
|
msg102003 - (view) |
Author: Valerio Turturici (valerio.turturici) |
Date: 2010-03-31 13:18 |
This was clear. Now i make a new patch and then upload it.
|
msg102009 - (view) |
Author: Valerio Turturici (valerio.turturici) |
Date: 2010-03-31 13:57 |
Here's the new patch. It's ok?
|
msg102010 - (view) |
Author: Michael Foord (michael.foord) * |
Date: 2010-03-31 13:58 |
Looks good to me.
|
msg102012 - (view) |
Author: Antoine Pitrou (pitrou) * |
Date: 2010-03-31 14:38 |
Shouldn't it be
zlib.ZLIB_VERSION < '1.2.4'
rather than
zlib.ZLIB_VERSION <= '1.2.4'
?
|
msg102014 - (view) |
Author: R. David Murray (r.david.murray) * |
Date: 2010-03-31 15:16 |
Are we safe using string comparison here? How likely is zlib to get into double digit release numbers? (Too bad the version comparison stuff Tarek is working on isn't already available.)
|
msg102015 - (view) |
Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * |
Date: 2010-03-31 15:21 |
Note that the exact version which changed the behavior is 1.2.3.5, see http://www.zlib.net/ChangeLog.txt
- Use zlib header window size if windowBits is 0 in inflateInit2()
|
msg102016 - (view) |
Author: R. David Murray (r.david.murray) * |
Date: 2010-03-31 15:40 |
The else branch of the test should also check that 0 does *not* raise an error.
|
msg102017 - (view) |
Author: Antoine Pitrou (pitrou) * |
Date: 2010-03-31 15:48 |
Ok, actually Python is only echoing the error return from zlib here, so I don't seen the point of the conditional. Just always test against -1 and we're done.
|
msg102020 - (view) |
Author: Valerio Turturici (valerio.turturici) |
Date: 2010-03-31 16:52 |
@pitrou: because the op have the problem with 1.2.4 version of zlib. By the way i had just always test against -1 in my first patch. Make i a new patch with a simple correction with -1 in place of 0?
@david: i know, but i'm learning now the TDD, so excuse me if i make mistakes. How i check that a function don't raise an error? About the string comparison you right, this is the first thing that i thought, but when i looked the type of release number, in that moment i thought that the string comparison was ok.
|
msg102044 - (view) |
Author: Valerio Turturici (valerio.turturici) |
Date: 2010-03-31 23:21 |
While i wait for what i have to do, i corrected the patch. But there is a problem: the version of zlib '1.2.3.3' raise an error on "distutils.version" module. The problem is caused by the regex expression in the "distutils.version" module:
version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$',
re.VERBOSE)
this expression don't match with the type of version that zlib.ZLIB_VERSION return.
|
msg102072 - (view) |
Author: Nick Coghlan (ncoghlan) * |
Date: 2010-04-01 07:58 |
The "I'm not sure" in my comment really was a question, rather than a definite direction to conditionally retain the old test.
I've actually looked at the relevant C code in the zlib module now, and I agree with Antoine that the original suggestion of changing the 0 in the test to a -1 is fine (the test is just checking the handling of a Z_STREAM_ERROR return from the API call rather than anything more sophisticated).
Adding to my to-do list.
|
msg102073 - (view) |
Author: Valerio Turturici (valerio.turturici) |
Date: 2010-04-01 08:08 |
Ok, so here the patch.
|
msg102478 - (view) |
Author: Antoine Pitrou (pitrou) * |
Date: 2010-04-06 17:27 |
Committed in r79848 (trunk), r79849 (py3k), r79850 (2.6), r79851 (3.1). Thank you!
|
msg102485 - (view) |
Author: Valerio Turturici (valerio.turturici) |
Date: 2010-04-06 19:02 |
Thanks to you! This was my first patch, i'm very happy to contribute :)
|
|
Date |
User |
Action |
Args |
2022-04-11 14:56:58 | admin | set | github: 52440 |
2010-04-06 19:02:38 | valerio.turturici | set | messages:
+ msg102485 |
2010-04-06 17:27:30 | pitrou | set | status: open -> closed resolution: fixed messages:
+ msg102478
stage: patch review -> resolved |
2010-04-06 17:12:29 | pioto | set | nosy:
+ pioto
|
2010-04-01 08:08:58 | valerio.turturici | set | files:
+ 8193.patch
messages:
+ msg102073 |
2010-04-01 08:08:25 | valerio.turturici | set | files:
- 8193.patch |
2010-04-01 07:58:26 | ncoghlan | set | assignee: ncoghlan messages:
+ msg102072 |
2010-03-31 23:21:43 | valerio.turturici | set | files:
+ 8193.patch
messages:
+ msg102044 |
2010-03-31 23:03:57 | valerio.turturici | set | files:
- 8193.patch |
2010-03-31 16:52:05 | valerio.turturici | set | messages:
+ msg102020 |
2010-03-31 15:49:00 | pitrou | set | messages:
+ msg102017 |
2010-03-31 15:40:02 | r.david.murray | set | messages:
+ msg102016 |
2010-03-31 15:21:52 | amaury.forgeotdarc | set | messages:
+ msg102015 |
2010-03-31 15:16:39 | r.david.murray | set | messages:
+ msg102014 |
2010-03-31 14:38:25 | pitrou | set | nosy:
+ pitrou messages:
+ msg102012
|
2010-03-31 13:58:51 | michael.foord | set | nosy:
+ michael.foord messages:
+ msg102010
|
2010-03-31 13:57:22 | valerio.turturici | set | files:
+ 8193.patch
messages:
+ msg102009 |
2010-03-31 13:24:20 | valerio.turturici | set | files:
- 8193.patch |
2010-03-31 13:18:33 | valerio.turturici | set | messages:
+ msg102003 |
2010-03-31 12:09:34 | r.david.murray | set | messages:
+ msg102000 |
2010-03-30 11:33:16 | valerio.turturici | set | messages:
+ msg101934 |
2010-03-30 11:32:10 | valerio.turturici | set | messages:
+ msg101933 |
2010-03-30 09:32:56 | valerio.turturici | set | messages:
+ msg101925 |
2010-03-30 09:24:04 | valerio.turturici | set | messages:
+ msg101924 |
2010-03-30 09:10:30 | ncoghlan | set | nosy:
+ ncoghlan messages:
+ msg101923
|
2010-03-30 09:01:39 | valerio.turturici | set | messages:
+ msg101922 |
2010-03-30 01:08:43 | r.david.murray | set | priority: normal versions:
+ Python 2.6, Python 3.1, Python 2.7, Python 3.2, - Python 2.5 nosy:
+ r.david.murray
messages:
+ msg101911
stage: patch review |
2010-03-30 00:02:56 | valerio.turturici | set | files:
+ 8193.patch
messages:
+ msg101910 |
2010-03-29 23:09:04 | valerio.turturici | set | messages:
+ msg101909 |
2010-03-29 22:28:13 | valerio.turturici | set | nosy:
+ valerio.turturici messages:
+ msg101908
|
2010-03-26 14:54:28 | amaury.forgeotdarc | set | keywords:
+ patch, easy nosy:
+ amaury.forgeotdarc messages:
+ msg101751
|
2010-03-21 19:14:58 | Arfrever | set | nosy:
+ Arfrever
|
2010-03-21 19:12:48 | arekm | create | |