Commit Graph

122 Commits

Author SHA1 Message Date
Gregory P. Smith 09aa752067 Refactor recently added bugfix into more testable code by using a
method for windows file name sanitization.  Splits the unittest up
into several based on platform.
2013-02-03 00:36:32 -08:00
Serhiy Storchaka 672671da47 Fix the test for issue #6972.
Remove trailing dots on Windows.
2013-02-02 19:51:37 +02:00
Serhiy Storchaka e5e6444497 Fix the test for issue #6972.
Remove trailing dots on Windows.
2013-02-02 19:50:59 +02:00
Gregory P. Smith 193e1be72d Fixes Issue #6972: The zipfile module no longer overwrites files outside of
its destination path when extracting malicious zip files.
2013-02-01 11:31:31 -08:00
Gregory P. Smith b47acbf46a Fixes Issue #6972: The zipfile module no longer overwrites files outside of
its destination path when extracting malicious zip files.
2013-02-01 11:22:43 -08:00
Serhiy Storchaka d72bfe9eb9 Issue #4844: ZipFile now raises BadZipFile when opens a ZIP file with an
incomplete "End of Central Directory" record.  Original patch by Guilherme
Polo and Alan McIntyre.
2013-01-31 15:29:20 +02:00
Serhiy Storchaka d2b1527f14 Issue #4844: ZipFile now raises BadZipFile when opens a ZIP file with an
incomplete "End of Central Directory" record.  Original patch by Guilherme
Polo and Alan McIntyre.
2013-01-31 15:27:07 +02:00
Serhiy Storchaka c5b75db5de Issue #12004: Fix an internal error in PyZipFile when writing an invalid
Python file.  Patch by Ben Morgan.
2013-01-29 20:14:08 +02:00
Serhiy Storchaka 45c4375ea7 Issue #12004: Fix an internal error in PyZipFile when writing an invalid
Python file.  Patch by Ben Morgan.
2013-01-29 20:10:28 +02:00
Serhiy Storchaka 64bfcc4c22 Issue #9720: zipfile now writes correct local headers for files larger than 4 GiB. 2013-01-15 00:38:17 +02:00
Serhiy Storchaka 182d7cd531 Issue #9720: zipfile now writes correct local headers for files larger than 4 GiB. 2013-01-15 00:31:39 +02:00
Ezio Melotti 6a5fc4c443 #14313: zipfile now raises NotImplementedError when the compression type is unknown. 2012-11-18 13:20:36 +02:00
Antoine Pitrou 8572da5e96 Issue #16408: Fix file descriptors not being closed in error conditions in the zipfile module.
Patch by Serhiy Storchaka.
2012-11-17 23:52:05 +01:00
Antoine Pitrou 17babc5e97 Issue #16408: Fix file descriptors not being closed in error conditions in the zipfile module.
Patch by Serhiy Storchaka.
2012-11-17 23:50:08 +01:00
Antoine Pitrou 78157b3f6f On behalf of Nadeem Vawda: issue #10376: micro-optimize reading from a Zipfile.
(patch by Serhiy)
2012-06-23 16:44:48 +02:00
Nadeem Vawda a425c3d5a2 Make lzma.{encode,decode}_filter_properties private.
These functions were originally added to support LZMA compression in the zipfile
module, and are not of interest for the majority of users.

They can be made public in 3.4 if there is user interest, but in the meanwhile,
I've opted to present a smaller, simpler API for the module's initial release.
2012-06-21 23:36:48 +02:00
Martin v. Löwis 7fb79fcb64 Issue #14366: Support lzma compression in zip files.
Patch by Serhiy Storchaka.
2012-05-13 10:06:36 +02:00
Martin v. Löwis d099b56be7 Check extract_version when opening a zipfile. 2012-05-01 14:08:22 +02:00
Georg Brandl 5c01678174 Add missing comma in __all__ list. 2012-05-01 09:00:59 +02:00
Martin v. Löwis 2a2ce328fb Recognize unsupported feature "compressed patch data set" from zip 2.7. 2012-05-01 08:44:08 +02:00
Martin v. Löwis b3260f08cf Detect unsupported compression types. 2012-05-01 08:38:01 +02:00
Martin v. Löwis f6b16a4b50 Issue #14371: Support bzip2 in zipfile module.
Patch by Serhiy Storchaka.
2012-05-01 07:58:44 +02:00
Ezio Melotti 006917ec7f #14603: use a listcomp in ZipFile.namelist. 2012-04-16 21:34:24 -06:00
R David Murray f50b38a11f Merge #14399: zipfile now correctly handles comments added to empty zipfiles.
Patch by Serhiy Storchaka.

This also moves the TypeError that results from trying to use a unicode
comment from the 'close' step to the point at which the comment is added to
the zipfile.
2012-04-12 18:44:58 -04:00
R David Murray 51804e9725 #14399: zipfile now correctly handles comments added to empty zipfiles.
Patch by Serhiy Storchaka.

This also moves the TypeError that results from trying to use a unicode
comment from the 'close' step to the point at which the comment is added to
the zipfile.
2012-04-12 18:44:42 -04:00
Senthil Kumaran 29fa9d4d68 3.2 - Fix closes Issue6090 - Raise a ValueError, instead of failing with unrelated
exceptions, when a document with timestamp earlier than 1980 is provided to
zipfile. Patch contributed by  Petri Lehtinen.
2011-10-20 01:46:00 +08:00
R David Murray 4fbb9dbd34 #10694: zipfile now ignores garbage at the end of a zipfile.
Original fix by 'rep', final patch (with tests) by Xuanji Li.
2011-06-09 15:50:51 -04:00
Georg Brandl 5ba11de845 #10801: In zipfile, support different encodings for the header and the filenames. Patch by MvL, test by Eli Bendersky. 2011-01-01 10:09:32 +00:00
R. David Murray 8d855d8304 #4871: check that zipfile password is bytes, and give useful error message.
Previously passing a string in as the password would fail either with
an assertion error or a TypeError with a confusing error message.
Note that a string can't be accepted since zipfile has no way to
guess what encoding should be used to turn it into bytes.

Patch by Victor Stinner.
2010-12-21 21:53:37 +00:00
Georg Brandl 8334fd9285 Add an "optimize" parameter to compile() to control the optimization level, and provide an interface to it in py_compile, compileall and PyZipFile. 2010-12-04 10:26:46 +00:00
Łukasz Langa a9f054b423 zipfile: remove remaining ResourceWarnings 2010-11-23 00:15:02 +00:00
Łukasz Langa e94980a64f Issue #9846: ZipExtFile provides no mechanism for closing the underlying file object 2010-11-22 23:31:26 +00:00
Benjamin Peterson d285bdb443 start banging on zipfile's file leakiness 2010-10-31 17:57:22 +00:00
Éric Araujo ae2d8320a5 Fix typo from r85874 2010-10-28 13:49:17 +00:00
Georg Brandl 4d54088599 #7351: add more consistent exception name alias. 2010-10-28 06:42:33 +00:00
Georg Brandl 268e4d4cf3 #1710703: write zipfile structures also in the case of closing a new, but empty, archive. 2010-10-14 06:59:45 +00:00
Antoine Pitrou 6464d5ffdc Issue #9837: The read() method of ZipExtFile objects (as returned by
ZipFile.open()) could return more bytes than requested.
2010-09-12 14:51:20 +00:00
Antoine Pitrou 7c8bcb6f92 Issue #7467: when a file from a ZIP archive, its CRC is checked and a
BadZipfile error is raised if it doesn't match (as used to be the
case in Python 2.5 and earlier).
2010-08-12 15:11:50 +00:00
Barry Warsaw 28a691b7fd PEP 3147 2010-04-17 00:19:56 +00:00
Ronald Oussoren ee5c885fd2 Merged revisions 78097 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r78097 | ronald.oussoren | 2010-02-07 21:18:02 +0100 (Sun, 07 Feb 2010) | 2 lines

  Issue 6003: ZipFile.writestr "compression_type" argument
........
2010-02-07 20:24:02 +00:00
Ezio Melotti 92b4743719 Merged revisions 77809 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77809 | ezio.melotti | 2010-01-28 03:41:30 +0200 (Thu, 28 Jan 2010) | 1 line

  avoid to use zlib when the compress type is not ZIP_DEFLATED
........
2010-01-28 01:44:41 +00:00
Antoine Pitrou a32f9a24df Merged revisions 77798 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77798 | antoine.pitrou | 2010-01-27 21:59:50 +0100 (mer., 27 janv. 2010) | 8 lines

  Issue #7610: Reworked implementation of the internal
  :class:`zipfile.ZipExtFile` class used to represent files stored inside
  an archive.  The new implementation is significantly faster and can
  be wrapped in a :class:`io.BufferedReader` object for more speedups.
  It also solves an issue where interleaved calls to `read()` and
  `readline()` give wrong results.  Patch by Nir Aides.
........
2010-01-27 21:18:57 +00:00
Ezio Melotti faa6b7f421 Merged revisions 77136 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r77136 | ezio.melotti | 2009-12-30 08:14:51 +0200 (Wed, 30 Dec 2009) | 1 line

  #5511: Added the ability to use ZipFile as a context manager. Patch by Brian Curtin.
........
2009-12-30 12:34:59 +00:00
Ezio Melotti af30d2eeaa fix print statement 2009-09-25 21:35:24 +00:00
Georg Brandl fe99105835 Use true booleans and PEP8 for argdefaults. 2009-09-16 15:54:04 +00:00
Amaury Forgeot d'Arc bc3478043d Merged revisions 74245 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r74245 | amaury.forgeotdarc | 2009-07-29 00:15:30 +0200 (mer., 29 juil. 2009) | 3 lines

  #6511: ZipFile will now raise BadZipfile when opening an empty or tiny file,
  like it does for larger invalid files.
........
2009-07-28 22:18:57 +00:00
Gregory P. Smith e88749b475 Merged revisions 73565 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r73565 | gregory.p.smith | 2009-06-26 00:50:21 -0700 (Fri, 26 Jun 2009) | 2 lines

  Fixes the last problem mentioned in issue1202.
........

Issue #1202: zipfile module would cause a struct.error when attempting to store
files with a CRC32 > 2**31-1.  (on trunk this was merely a warning, in the py3k
branch this caused an exception so I'm treating this as a release blocker and
merging it now)
2009-06-26 08:05:13 +00:00
Benjamin Peterson fa0d703433 Merged revisions 72506,72525-72526,72551,72558,72616,72654-72655,72689,72745,72750,72802,72812,72822,72824,72826-72827,72833,72876,72890,72923,72946,73026,73042,73045,73047,73065,73068-73069 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72506 | vinay.sajip | 2009-05-09 07:07:17 -0500 (Sat, 09 May 2009) | 1 line

  Issue #5971: StreamHandler.handleError now swallows IOErrors which occur when trying to print a traceback.
........
  r72525 | benjamin.peterson | 2009-05-09 20:38:02 -0500 (Sat, 09 May 2009) | 1 line

  close file explicitly
........
  r72526 | benjamin.peterson | 2009-05-09 21:29:00 -0500 (Sat, 09 May 2009) | 1 line

  make sure files are closed using the with statement
........
  r72551 | benjamin.peterson | 2009-05-10 09:16:47 -0500 (Sun, 10 May 2009) | 1 line

  use isinstance
........
  r72558 | benjamin.peterson | 2009-05-10 18:52:09 -0500 (Sun, 10 May 2009) | 1 line

  sys.setdefaultencoding() strikes me as a bad example
........
  r72616 | benjamin.peterson | 2009-05-13 19:33:10 -0500 (Wed, 13 May 2009) | 1 line

  importlib.import_module is better these days
........
  r72654 | benjamin.peterson | 2009-05-14 17:37:49 -0500 (Thu, 14 May 2009) | 1 line

  prevent refleaks from threads
........
  r72655 | benjamin.peterson | 2009-05-14 17:40:34 -0500 (Thu, 14 May 2009) | 1 line

  a useful decorator for cleaning up threads
........
  r72689 | benjamin.peterson | 2009-05-16 13:44:34 -0500 (Sat, 16 May 2009) | 1 line

  use skipTest()
........
  r72745 | benjamin.peterson | 2009-05-17 09:16:29 -0500 (Sun, 17 May 2009) | 1 line

  ignore .rst files in sphinx its self
........
  r72750 | benjamin.peterson | 2009-05-17 11:59:27 -0500 (Sun, 17 May 2009) | 1 line

  chop off slash
........
  r72802 | georg.brandl | 2009-05-20 13:35:27 -0500 (Wed, 20 May 2009) | 1 line

  #6051: refer to email examples for better way to construct email messages.
........
  r72812 | michael.foord | 2009-05-21 17:57:02 -0500 (Thu, 21 May 2009) | 1 line

  Rename TestCase._result to _resultForDoCleanups to avoid potential clashes in TestCase subclasses. Issue 6072.
........
  r72822 | georg.brandl | 2009-05-22 04:33:25 -0500 (Fri, 22 May 2009) | 1 line

  #6084: fix example.
........
  r72824 | georg.brandl | 2009-05-22 04:43:17 -0500 (Fri, 22 May 2009) | 1 line

  Fix references to file-related functions and methods (os.* vs file.*).
........
  r72826 | georg.brandl | 2009-05-22 04:49:42 -0500 (Fri, 22 May 2009) | 1 line

  Fix confusing wording.
........
  r72827 | georg.brandl | 2009-05-22 04:50:30 -0500 (Fri, 22 May 2009) | 1 line

  s/use/call/
........
  r72833 | georg.brandl | 2009-05-22 12:00:17 -0500 (Fri, 22 May 2009) | 1 line

  #6078: _warnings is a builtin module and has no standard init_warnings function.
........
  r72876 | benjamin.peterson | 2009-05-23 15:59:09 -0500 (Sat, 23 May 2009) | 1 line

  remove mention of old ctypes version
........
  r72890 | gregory.p.smith | 2009-05-24 13:00:13 -0500 (Sun, 24 May 2009) | 2 lines

  add a versionadded tag for set_tunnel
........
  r72923 | michael.foord | 2009-05-25 15:36:56 -0500 (Mon, 25 May 2009) | 1 line

  Make assertSequenceEqual error messages less cryptic, particularly for nested sequences.
........
  r72946 | ronald.oussoren | 2009-05-26 13:44:48 -0500 (Tue, 26 May 2009) | 2 lines

  Fixes issue 6110
........
  r73026 | r.david.murray | 2009-05-29 14:30:27 -0500 (Fri, 29 May 2009) | 3 lines

  Issue 6141: document that the first item of args is still the
  command name even when executable is specified.
........
  r73042 | benjamin.peterson | 2009-05-29 22:10:52 -0500 (Fri, 29 May 2009) | 1 line

  no fdatasync on macos
........
  r73045 | georg.brandl | 2009-05-30 02:26:04 -0500 (Sat, 30 May 2009) | 1 line

  #6146: fix markup bug.
........
  r73047 | georg.brandl | 2009-05-30 05:33:23 -0500 (Sat, 30 May 2009) | 1 line

  Fix some more small markup problems.
........
  r73065 | antoine.pitrou | 2009-05-30 16:39:25 -0500 (Sat, 30 May 2009) | 3 lines

  The test for #5330 wasn't correct.
........
  r73068 | antoine.pitrou | 2009-05-30 16:45:40 -0500 (Sat, 30 May 2009) | 3 lines

  Update ACKS
........
  r73069 | benjamin.peterson | 2009-05-30 19:42:42 -0500 (Sat, 30 May 2009) | 1 line

  fix signature
........
2009-06-01 22:42:33 +00:00
Martin v. Löwis 70ccd167de Merged revisions 72893 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72893 | martin.v.loewis | 2009-05-24 21:30:52 +0200 (So, 24 Mai 2009) | 3 lines

  Issue #6050: Don't fail extracting a directory from a zipfile if
  the directory already exists.
........
2009-05-24 19:47:22 +00:00
Antoine Pitrou 3c33e087fc Merged revisions 72295 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72295 | antoine.pitrou | 2009-05-04 23:17:17 +0200 (lun., 04 mai 2009) | 3 lines

  Issue #5692: In :class:`zipfile.Zipfile`, fix wrong path calculation when extracting a file to the root directory.
........
2009-05-04 21:21:36 +00:00