summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tarfile.py
Commit message (Collapse)AuthorAgeFilesLines
* Issue #7232: Add support for the context manager protocolLars Gustäbel2010-03-031-0/+60
| | | | to the TarFile class.
* Remove unused imports in test modules.Georg Brandl2010-02-071-1/+0
|
* use assert[Not]In where appropriateEzio Melotti2010-01-231-1/+1
|
* Reverting the Revision: 77368. I committed Flox's big patch for tests bySenthil Kumaran2010-01-081-3/+1
| | | | mistake. ( It may come in for sure tough)
* Fixing - Issue7026 - RuntimeError: dictionary changed size during iteration. ↵Senthil Kumaran2010-01-081-1/+3
| | | | Patch by flox
* Add a testcase that checks if the TarFile constructor successfullyLars Gustäbel2009-11-231-0/+18
| | | | closes the internal file object in case of an error (issue #7341).
* Issue #6123: Fix opening empty archives and files.Lars Gustäbel2009-11-221-5/+80
| | | | | | | | | | | | | | | | | | | | | | | (Note that an empty archive is not the same as an empty file. An empty archive contains no members and is correctly terminated with an EOF block full of zeros. An empty file contains no data at all.) The problem was that although tarfile was able to create empty archives, it failed to open them raising a ReadError. On the other hand, tarfile opened empty files without error in most read modes and presented them as empty archives. (However, some modes still raised errors: "r|gz" raised ReadError, but "r:gz" worked, "r:bz2" even raised EOFError.) In order to get a more fine-grained control over the various internal error conditions I now split up the HeaderError exception into a number of meaningful sub-exceptions. This makes it easier in the TarFile.next() method to react to the different conditions in the correct way. The visible change in its behaviour now is that tarfile will open empty archives correctly and raise ReadError consistently for empty files.
* Issue #7295: Do not use a hardcoded file name in test_tarfile.Antoine Pitrou2009-11-111-7/+3
|
* Issue #6856: Add a filter keyword argument to TarFile.add().Lars Gustäbel2009-09-121-0/+28
| | | | | | | | | The filter argument must be a function that takes a TarInfo object argument, changes it and returns it again. If the function returns None the TarInfo object will be excluded from the archive. The exclude argument is deprecated from now on, because it does something similar but is not as flexible.
* Issue #6054: Do not normalize stored pathnames.Lars Gustäbel2009-08-281-0/+70
| | | | | | No longer use tarfile.normpath() on pathnames. Store pathnames unchanged, i.e. do not remove "./", "../" and "//" occurrences. However, still convert absolute to relative paths.
* convert usage of fail* to assert*Benjamin Peterson2009-06-301-54/+54
|
* Issue #5068: Fixed the tarfile._BZ2Proxy.read() method that would loopLars Gustäbel2009-03-221-0/+25
| | | | | | forever on incomplete input. That caused tarfile.open() to hang when used with mode 'r' or 'r:bz2' and a fileobj argument that contained no data or partial bzip2 compressed data.
* Issue #4616: TarFile.utime(): Restore directory times on Windows.Lars Gustäbel2008-12-121-6/+3
|
* Issue #3838: TarFile object assigned to self.tar should be closed explicitly.Hirokazu Yamamoto2008-09-211-0/+1
| | | | Reviewed by Lars Gustäbel.
* Do not close external file objects passed to tarfile.open(mode='w:bz2')Lars Gustäbel2008-05-271-2/+14
| | | | when the TarFile is closed.
* Make sure that xstar headers are read correctly.Lars Gustäbel2008-02-111-0/+9
|
* Issue #1735: TarFile.extractall() now correctly setsLars Gustäbel2008-01-041-0/+17
| | | | | | directory permissions and times. (will backport to 2.5)
* Issue #1531: Read fileobj from the current offset, do not seek toLars Gustäbel2007-12-011-0/+32
| | | | | | the start. (will backport to 2.5)
* TarFile.__init__() no longer fails if no name argument is passed andLars Gustäbel2007-08-281-1/+15
| | | | | | the fileobj argument has no usable name attribute (e.g. StringIO). (will backport to 2.5)
* Added exclude keyword argument to the TarFile.add() method.Lars Gustäbel2007-06-181-0/+21
|
* Have md5 raise a DeprecationWarning as per PEP 4.Brett Cannon2007-05-301-2/+2
|
* Added errors argument to TarFile class that allows the user toLars Gustäbel2007-05-271-65/+181
| | | | | | | | | | | | | | | | | | | | specify an error handling scheme for character conversion. Additional scheme "utf-8" in read mode. Unicode input filenames are now supported by design. The values of the pax_headers dictionary are now limited to unicode objects. Fixed: The prefix field is no longer used in PAX_FORMAT (in conformance with POSIX). Fixed: In read mode use a possible pax header size field. Fixed: Strip trailing slashes from pax header name values. Fixed: Give values in user-specified pax_headers precedence when writing. Added unicode tests. Added pax/regtype4 member to testtar.tar all possible number fields in a pax header. Added two chapters to the documentation about the different formats tarfile.py supports and how unicode issues are handled.
* Whitespace normalization. Ugh, we really need to do this more often.Neal Norwitz2007-04-251-1/+0
| | | | You might want to review this change as it's my first time. Be gentle. :-)
* Quick fix for tests that fail on systems with an encoding otherLars Gustäbel2007-03-131-6/+7
| | | | than 'iso8859-1'.
* This is the implementation of POSIX.1-2001 (pax) format read/writeLars Gustäbel2007-03-131-581/+761
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | support. The TarInfo class now contains all necessary logic to process and create tar header data which has been moved there from the TarFile class. The fromtarfile() method was added. The new path and linkpath properties are aliases for the name and linkname attributes in correspondence to the pax naming scheme. The TarFile constructor and classmethods now accept a number of keyword arguments which could only be set as attributes before (e.g. dereference, ignore_zeros). The encoding and pax_headers arguments were added for pax support. There is a new tarinfo keyword argument that allows using subclassed TarInfo objects in TarFile. The boolean TarFile.posix attribute is deprecated, because now three tar formats are supported. Instead, the desired format for writing is specified using the constants USTAR_FORMAT, GNU_FORMAT and PAX_FORMAT as the format keyword argument. This change affects TarInfo.tobuf() as well. The test suite has been heavily reorganized and partially rewritten. A new testtar.tar was added that contains sample data in many formats from 4 different tar programs. Some bugs and quirks that also have been fixed: Directory names do no longer have a trailing slash in TarInfo.name or TarFile.getnames(). Adding the same file twice does not create a hardlink file member. The TarFile constructor does no longer need a name argument. The TarFile._mode attribute was renamed to mode and contains either 'r', 'w' or 'a'.
* A missing binary mode in AppendTest caused failures in WindowsLars Gustäbel2007-02-141-2/+2
| | | | Buildbot.
* Patch #1652681: create nonexistent files in append mode andLars Gustäbel2007-02-061-0/+56
| | | | allow appending to empty files.
* Patch #1504073: Fix tarfile.open() for mode "r" with a fileobj argument.Lars Gustäbel2006-12-271-0/+11
| | | | Will backport to 2.5.
* Patch #1262036: Prevent TarFiles from being added to themselves underLars Gustäbel2006-12-231-0/+14
| | | | | | certain conditions. Will backport to 2.5.
* Patch #1230446: tarfile.py: fix ExFileObject so that read() and tell()Lars Gustäbel2006-12-231-1/+11
| | | | | | work correctly together with readline(). Will backport to 2.5.
* Testcase for patch #1484695.Georg Brandl2006-12-201-0/+23
|
* Patch #1610437: fix a tarfile bug with long filename headers.Georg Brandl2006-12-061-9/+13
|
* Patch [ 1583506 ] tarfile.py: 100-char filenames are truncatedGeorg Brandl2006-10-241-0/+27
|
* Fix bug #1543303, tarfile adds padding that breaks gunzip.Neal Norwitz2006-08-211-0/+21
| | | | | | Patch # 1543897. Will backport to 2.5
* The cheery optimism of old age.Tim Peters2006-05-271-13/+1
|
* More random thrashing trying to understand spuriousTim Peters2006-05-271-1/+13
| | | | Windows failures. Who's keeping a bz2 file open?
* Explicitly close files. I'm trying to stop the frequent spurious test_tarfileTim Peters2006-05-261-9/+32
| | | | | | failures on Windows buildbots, but it's hard to know how since the regrtest failure output is useless here, and it never fails when a buildbot slave runs test_tarfile the second time in verbose mode.
* Use open() to open files (was using file()).Tim Peters2006-05-261-10/+10
|
* test_directory(): Remove the leftover temp directory that's makingTim Peters2006-05-151-0/+4
| | | | the Windows buildbots fail test_tarfile.
* ReadDetectFileobjTest: repair Windows disasters by openingTim Peters2006-05-151-1/+2
| | | | | | | | | | the file object in binary mode. The Windows buildbot slaves shouldn't swap themselves to death anymore. However, test_tarfile may still fail because of a temp directory left behind from a previous failing run. Windows buildbot owners may need to remove that directory by hand.
* [ 1488881 ] tarfile.py: support for file-objects and bz2 (cp. #1488634)Georg Brandl2006-05-151-0/+23
|
* Patch #1484695: Update the tarfile module to version 0.8. This fixesGeorg Brandl2006-05-101-2/+47
| | | | | a couple of issues, notably handling of long file names using the GNU LONGNAME extension.
* Patch #1338314, Bug #1336623: fix tarfile so it can extractNeal Norwitz2005-10-281-0/+30
| | | | | | REGTYPE directories from tarfiles written by old programs. Will backport.
* Fix SF bug # 1330039, patch # 1331635 from Lars Gustaebel (tarfile maintainer)Neal Norwitz2005-10-201-1/+48
| | | | | | | | | | | | | | Problem: if two files are assigned the same inode number by the filesystem, the second one will be added as a hardlink to the first, which means that the content will be lost. The patched code checks if the file's st_nlink is greater 1. So only for files that actually have several links pointing to them hardlinks will be created, which is what GNU tar does. Will backport.
* Patch #1168594: set sizes of non-regular files to zero. Fixes #1167128.Martin v. Löwis2005-08-271-0/+35
| | | | Will backport to 2.4.
* Patch #918101: Add tarfile open mode r|* for auto-detection of theMartin v. Löwis2005-03-051-2/+27
| | | | stream compression; add, for symmetry reasons, r:* as a synonym of r.
* Patch #1107973: tarfile.ExFileObject iterators.Martin v. Löwis2005-03-031-0/+10
|
* Whitespace normalization.Tim Peters2004-10-251-1/+1
|
* Add test case for bug #1017553Andrew M. Kuchling2004-10-201-0/+9
|
* Flush bz2 data even if nothing had been written so far. Fixes #1013882.Martin v. Löwis2004-08-221-1/+7
| | | | Will backport to 2.3.