
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2009-07-27 06:10 bysrid, last changed2022-04-11 14:56 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| 6584_1.patch | gruszczy,2010-03-16 20:21 | review | ||
| 6584_2.patch | gruszczy,2010-03-16 20:47 | review | ||
| 6584_3.patch | gruszczy,2011-03-15 10:08 | review | ||
| 6584_4.patch | maker,2011-08-20 08:15 | review | ||
| 6584_5.patch | maker,2011-08-20 09:03 | review | ||
| issue6584_6.patch | maker,2012-11-10 16:07 | review | ||
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 13022 | merged | ZackerySpytz,2019-04-30 10:36 | |
| Messages (20) | |||
|---|---|---|---|
| msg90976 -(view) | Author: Sridhar Ratnakumar (srid) | Date: 2009-07-27 06:10 | |
Much like zipfile.BadZipfile, we need a base custom exception for the gzip module. At least, catch gzip-related exceptions and throw a tarfile.TarError when used *via* tarfile.*.See the following example (the exception escaped the "try... except tarfile.TarError: .. " block!):*** [...] File "/home/sridharr/as/pypm/src/pypm/common/compression.py", line 199, in _ensure_read_write_access for tarinfo in tarfileobj.getmembers(): File "/opt/ActivePython-2.6/lib/python2.6/tarfile.py", line 1791, in getmembers self._load() # all members, we first have to File "/opt/ActivePython-2.6/lib/python2.6/tarfile.py", line 2352, in _load tarinfo = self.next() File "/opt/ActivePython-2.6/lib/python2.6/tarfile.py", line 2307, in next self.fileobj.seek(self.offset) File "/opt/ActivePython-2.6/lib/python2.6/gzip.py", line 382, in seek self.read(1024) File "/opt/ActivePython-2.6/lib/python2.6/gzip.py", line 219, in read self._read(readsize) File "/opt/ActivePython-2.6/lib/python2.6/gzip.py", line 284, in _read self._read_eof() File "/opt/ActivePython-2.6/lib/python2.6/gzip.py", line 304, in _read_eof hex(self.crc)))IOError: CRC check failed 0x115929f0 != 0x9f074a38L | |||
| msg91151 -(view) | Author: Terry J. Reedy (terry.reedy)*![]() | Date: 2009-07-31 20:32 | |
Unless something in the docs claims that there is/should be such athing, this is a feature request, not a bug ('behavior') report, andonly applicable to future x.y versions. | |||
| msg101185 -(view) | Author: Filip Gruszczyński (gruszczy) | Date: 2010-03-16 20:21 | |
I have created a small patch, that introduces BadGzipFile exception. It is a subclass of IOError, so it would be backward compatible and will be still caught by old code, but this way is distinct from IOError. | |||
| msg101187 -(view) | Author: Filip Gruszczyński (gruszczy) | Date: 2010-03-16 20:47 | |
Modified patch with test, that catches both BadGzipFile and IOError exceptions. | |||
| msg130842 -(view) | Author: Filip Gruszczyński (gruszczy) | Date: 2011-03-14 16:09 | |
Bump! How about commiting this patch? Or maybe there is something missing? I'll be happy to fix it. | |||
| msg130844 -(view) | Author: Antoine Pitrou (pitrou)*![]() | Date: 2011-03-14 16:15 | |
Since the patch makes BadGzipFile a subclass of IOError, it doesn't look unreasonable.Some nits:- a gzipped file is not an "archive"- the unit tests should use either the "with" statement, or try/finally blocks to properly close the file even when the test fails- you should probably explicitly test that BadGzipFile is a subclass of IOError | |||
| msg130883 -(view) | Author: Filip Gruszczyński (gruszczy) | Date: 2011-03-14 19:56 | |
I'll be very happy to fix this after Friday. Thanks for your comments. | |||
| msg130961 -(view) | Author: Filip Gruszczyński (gruszczy) | Date: 2011-03-15 10:08 | |
I had some time today, so I managed to fix the patch. I hope now everything is ok. | |||
| msg138536 -(view) | Author: Filip Gruszczyński (gruszczy) | Date: 2011-06-17 17:50 | |
Bump! Antoine, do you think the patch is acceptable and can be committed now? | |||
| msg138544 -(view) | Author: Terry J. Reedy (terry.reedy)*![]() | Date: 2011-06-17 18:46 | |
Your changes appear to address all three of Antoine's 'nits'. | |||
| msg138732 -(view) | Author: Éric Araujo (eric.araujo)*![]() | Date: 2011-06-20 15:32 | |
Ezio has found a few other things to improve (follow the “review” link to the right of the patch link). | |||
| msg142517 -(view) | Author: Michele Orrù (maker)* | Date: 2011-08-20 08:15 | |
The attached patch follows Ezio's hints. | |||
| msg174685 -(view) | Author: Ezio Melotti (ezio.melotti)*![]() | Date: 2012-11-03 20:16 | |
The new exception should also be documented, and a versionadded andDoc/whatsnew/3.4.rst entry added. | |||
| msg175285 -(view) | Author: Michele Orrù (maker)* | Date: 2012-11-10 16:07 | |
done! | |||
| msg175286 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2012-11-10 16:27 | |
Not all invalid gzip files raise BadGzipFile. Some of them raises ZlibError. | |||
| msg175289 -(view) | Author: Michele Orrù (maker)* | Date: 2012-11-10 16:57 | |
Well, I specified the word ``files`` everywhere for that reason. Looking atDoc/library/zlib.rst I see: For reading and writing .gz files see the gzip module.Also, I specified 'the gzip module' on the whatsnew section.Is there anything more specific I could have done? | |||
| msg176385 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2012-11-25 19:02 | |
I added some comments on Rietveld. | |||
| msg176891 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2012-12-04 10:32 | |
read32() should raise BadGzipFile when less than 4 bytes read. Also you should introduce read8() function which raises BadGzipFile when less than 1 byte read.See alsoissue4844 andissue14315 for zipfile. | |||
| msg341145 -(view) | Author: Zackery Spytz (ZackerySpytz)*![]() | Date: 2019-04-30 10:37 | |
I'd like to see this issue move forward, so I've created a PR. | |||
| msg342288 -(view) | Author: Serhiy Storchaka (serhiy.storchaka)*![]() | Date: 2019-05-13 07:51 | |
New changesetcf599f6f6f1c392d8f12936982a370d533782195 by Serhiy Storchaka (Zackery Spytz) in branch 'master':bpo-6584: Add a BadGzipFile exception to the gzip module. (GH-13022)https://github.com/python/cpython/commit/cf599f6f6f1c392d8f12936982a370d533782195 | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:56:51 | admin | set | github: 50833 |
| 2019-05-13 07:53:07 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2019-05-13 07:51:01 | serhiy.storchaka | set | messages: +msg342288 |
| 2019-04-30 10:37:44 | ZackerySpytz | set | nosy: +ZackerySpytz messages: +msg341145 versions: + Python 3.8, - Python 3.4 |
| 2019-04-30 10:36:58 | ZackerySpytz | set | stage: needs patch -> patch review pull_requests: +pull_request12944 |
| 2012-12-04 10:32:23 | serhiy.storchaka | set | messages: +msg176891 stage: commit review -> needs patch |
| 2012-11-25 19:02:03 | serhiy.storchaka | set | messages: +msg176385 |
| 2012-11-10 16:57:30 | maker | set | messages: +msg175289 |
| 2012-11-10 16:27:42 | serhiy.storchaka | set | nosy: +serhiy.storchaka messages: +msg175286 |
| 2012-11-10 16:07:53 | maker | set | files: +issue6584_6.patch messages: +msg175285 |
| 2012-11-03 20:16:49 | ezio.melotti | set | messages: +msg174685 versions: + Python 3.4, - Python 3.3 |
| 2011-08-24 07:12:45 | maker | set | nosy: +ezio.melotti |
| 2011-08-20 09:03:31 | maker | set | files: +6584_5.patch |
| 2011-08-20 08:15:42 | maker | set | files: +6584_4.patch nosy: +maker messages: +msg142517 |
| 2011-06-20 15:32:32 | eric.araujo | set | nosy: +eric.araujo messages: +msg138732 |
| 2011-06-17 18:46:19 | terry.reedy | set | messages: +msg138544 stage: patch review -> commit review |
| 2011-06-17 17:50:24 | gruszczy | set | messages: +msg138536 |
| 2011-03-15 10:08:35 | gruszczy | set | files: +6584_3.patch nosy:terry.reedy,pitrou,dstanek,gruszczy,srid messages: +msg130961 |
| 2011-03-14 19:56:15 | gruszczy | set | nosy:terry.reedy,pitrou,dstanek,gruszczy,srid messages: +msg130883 |
| 2011-03-14 16:15:33 | pitrou | set | nosy: +pitrou messages: +msg130844 |
| 2011-03-14 16:09:23 | gruszczy | set | nosy:terry.reedy,dstanek,gruszczy,srid messages: +msg130842 |
| 2011-01-26 23:51:20 | pitrou | set | nosy:terry.reedy,dstanek,gruszczy,srid stage: needs patch -> patch review versions: + Python 3.3, - Python 2.7, Python 3.2 |
| 2011-01-26 17:51:51 | dstanek | set | nosy: +dstanek |
| 2010-03-16 20:47:36 | gruszczy | set | files: +6584_2.patch messages: +msg101187 |
| 2010-03-16 20:21:34 | gruszczy | set | files: +6584_1.patch nosy: +gruszczy messages: +msg101185 keywords: +patch |
| 2009-08-14 22:59:39 | r.david.murray | link | issue6669 dependencies |
| 2009-07-31 20:32:12 | terry.reedy | set | versions: + Python 2.7, - Python 2.6, Python 3.1 nosy: +terry.reedy messages: +msg91151 type: behavior -> enhancement |
| 2009-07-27 06:17:18 | amaury.forgeotdarc | set | stage: needs patch |
| 2009-07-27 06:13:17 | srid | set | versions: + Python 3.1, Python 3.2 |
| 2009-07-27 06:10:48 | srid | create | |