Commit Graph

74 Commits

Author SHA1 Message Date
Lars Gustäbel 9bcbe49ba1 Merged revisions 81663 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r81663 | lars.gustaebel | 2010-06-03 11:56:22 +0200 (Thu, 03 Jun 2010) | 4 lines

  Issue #8833: tarfile created hard link entries with a size
  field != 0 by mistake. The associated testcase did not
  expose this bug because it was broken too.
........
2010-06-03 10:07:08 +00:00
Lars Gustäbel b4a5bc9313 Merged revisions 80616 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r80616 | lars.gustaebel | 2010-04-29 17:23:38 +0200 (Thu, 29 Apr 2010) | 4 lines

  Issue #8464: tarfile.open(name, mode="w|") no longer creates
  files with execute permissions set.
........
2010-04-29 15:35:30 +00:00
Lars Gustäbel 7cf2c80467 Merged revisions 76381 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r76381 | lars.gustaebel | 2009-11-18 21:24:54 +0100 (Wed, 18 Nov 2009) | 3 lines

  Issue #7341: Close the internal file object in the TarFile
  constructor in case of an error.
........
2009-11-18 21:09:35 +00:00
Jesus Cea 585ad8ae5e Merged revisions 69846 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r69846 | mark.dickinson | 2009-02-21 21:27:01 +0100 (Sat, 21 Feb 2009) | 2 lines

  Issue #5341: Fix a variety of spelling errors.
........
2009-07-02 15:37:21 +00:00
Philip Jenvey 54cea3b1a5 Merged revisions 72458 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72458 | philip.jenvey | 2009-05-07 19:28:39 -0700 (Thu, 07 May 2009) | 2 lines

  #4351: more appropriate DeprecationWarning stacklevels
........
2009-05-08 02:47:02 +00:00
Lars Gustäbel 4f908ddc88 Avoid EOFError being passed to the caller (restoring the
old behavior).
2009-03-22 21:29:48 +00:00
Lars Gustäbel 9e2a09a3a3 Merged revisions 70523 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r70523 | lars.gustaebel | 2009-03-22 21:09:33 +0100 (Sun, 22 Mar 2009) | 5 lines

  Issue #5068: Fixed the tarfile._BZ2Proxy.read() method that would loop
  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.
........
2009-03-22 20:22:29 +00:00
Lars Gustäbel 696d6ba6b9 Merged revisions 67717 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r67717 | lars.gustaebel | 2008-12-12 14:58:03 +0100 (Fri, 12 Dec 2008) | 2 lines

  Issue #4616: TarFile.utime(): Restore directory times on Windows.
........
2008-12-12 14:14:42 +00:00
Brett Cannon 132fc54069 Remove a dict.has_key() and list.sort(cmp=) usage from tarfile to silence
warnings under -3.
2008-08-04 21:23:07 +00:00
Lars Gustäbel 727bd0b687 Issue #3039: Fix TarFileCompat.writestr() which always raised an
AttributeError since __slots__ were added to zipfile.ZipInfo in
r46967 two years ago.
Add a warning about the removal of TarFileCompat in Python 3.0.
2008-08-02 11:26:39 +00:00
Lars Gustäbel b1a54a3530 Do not close external file objects passed to tarfile.open(mode='w:bz2')
when the TarFile is closed.
2008-05-27 12:39:23 +00:00
Gregory P. Smith 88440960f9 A stab in the dark attempt to fix the alpha/tru64 buildbot problem and add more
test coverage of valid inputs to zlib.crc32.
2008-03-25 06:12:45 +00:00
Lars Gustäbel 0192e43d64 Issue #2004: Use mode 0700 for temporary directories and default
permissions for missing directories.

(will backport to 2.5)
2008-02-05 11:51:40 +00:00
Lars Gustäbel 2ee1c760cc Issue #1735: TarFile.extractall() now correctly sets
directory permissions and times.

(will backport to 2.5)
2008-01-04 14:00:33 +00:00
Lars Gustäbel 77b2d63b40 Issue #1531: Read fileobj from the current offset, do not seek to
the start.

(will backport to 2.5)
2007-12-01 21:02:12 +00:00
Lars Gustäbel 0f4a14b56f TarFile.__init__() no longer fails if no name argument is passed and
the fileobj argument has no usable name attribute (e.g. StringIO).

(will backport to 2.5)
2007-08-28 12:31:09 +00:00
Lars Gustäbel 104490e615 Added exclude keyword argument to the TarFile.add() method. 2007-06-18 11:42:11 +00:00
Lars Gustäbel a0fcb9384e Added errors argument to TarFile class that allows the user to
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.
2007-05-27 19:49:30 +00:00
Brett Cannon 6cef076ba5 Remove direct call's to file's constructor and replace them with calls to
open() as ths is considered best practice.
2007-05-25 20:17:15 +00:00
Lars Gustäbel c64e40215d This is the implementation of POSIX.1-2001 (pax) format read/write
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'.
2007-03-13 10:47:19 +00:00
Lars Gustäbel 3f8aca1164 Patch #1652681: create nonexistent files in append mode and
allow appending to empty files.
2007-02-06 18:38:13 +00:00
Lars Gustäbel d2e22903d3 Patch #1507247: tarfile.py: use current umask for intermediate
directories.
2007-01-23 11:17:33 +00:00
Lars Gustäbel a7ba6fc548 Patch #1504073: Fix tarfile.open() for mode "r" with a fileobj argument.
Will backport to 2.5.
2006-12-27 10:30:46 +00:00
Lars Gustäbel a4b2381b20 Patch #1262036: Prevent TarFiles from being added to themselves under
certain conditions.

Will backport to 2.5.
2006-12-23 17:57:23 +00:00
Lars Gustäbel 6baa502769 Patch #1230446: tarfile.py: fix ExFileObject so that read() and tell()
work correctly together with readline().

Will backport to 2.5.
2006-12-23 16:40:13 +00:00
Georg Brandl ded1c4df0b Testcase for patch #1484695. 2006-12-20 11:55:16 +00:00
Georg Brandl ebbeed781d Patch #1484695: The tarfile module now raises a HeaderError exception
if a buffer given to frombuf() is invalid.
2006-12-19 22:06:46 +00:00
Georg Brandl 87fa559479 Patch #1610437: fix a tarfile bug with long filename headers. 2006-12-06 22:21:18 +00:00
Georg Brandl 3354f285b9 Patch #1583880: fix tarfile's problems with long names and posix/
GNU modes.
2006-10-29 09:16:12 +00:00
Georg Brandl a32e0a099b Patch [ 1583506 ] tarfile.py: 100-char filenames are truncated 2006-10-24 16:54:16 +00:00
Georg Brandl 35207712dc Fix tarfile depending on buggy int('1\0', base) behavior. 2006-10-12 12:03:07 +00:00
Neal Norwitz 8a519392d5 Fix bug #1543303, tarfile adds padding that breaks gunzip.
Patch # 1543897.

Will backport to 2.5
2006-08-21 17:59:46 +00:00
Tim Peters a05f6e244a _Stream.close(): Try to kill struct.pack() warnings when
writing the crc to file on the "PPC64 Debian trunk" buildbot
when running test_tarfile.

This is again a case where the native zlib crc is an unsigned
32-bit int, but the Python wrapper implicitly casts it to
signed C long, so that "the sign bit looks different" on
different platforms.
2006-08-02 05:20:08 +00:00
Neal Norwitz 4a5fbda66d Part of SF patch #1484695. This removes dead code. The chksum was
already verified in .frombuf() on the lines above.  If there was
a problem an exception is raised, so there was no way this condition
could have been true.
2006-07-10 00:23:17 +00:00
Georg Brandl e895318ee2 Always close BZ2Proxy object. Remove unnecessary struct usage. 2006-05-27 14:02:03 +00:00
Tim Peters 8a299d25ec Whitespace normalization. 2006-05-19 19:16:34 +00:00
Georg Brandl e4751e3cdc Amendments to patch #1484695. 2006-05-18 06:11:19 +00:00
Georg Brandl 49c8f4cf36 [ 1488881 ] tarfile.py: support for file-objects and bz2 (cp. #1488634) 2006-05-15 19:30:35 +00:00
Georg Brandl 38c6a22f38 Patch #1484695: Update the tarfile module to version 0.8. This fixes
a couple of issues, notably handling of long file names using the
GNU LONGNAME extension.
2006-05-10 16:26:03 +00:00
Neal Norwitz f339654280 Patch #1338314, Bug #1336623: fix tarfile so it can extract
REGTYPE directories from tarfiles written by old programs.

Will backport.
2005-10-28 05:52:22 +00:00
Neal Norwitz b0e32e2b71 Fix SF bug # 1330039, patch # 1331635 from Lars Gustaebel (tarfile maintainer)
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.
2005-10-20 04:50:13 +00:00
Raymond Hettinger a1d09e2ded Minor cleanup. 2005-09-11 16:34:05 +00:00
Martin v. Löwis 5dbdc59577 Patch #1168594: set sizes of non-regular files to zero. Fixes #1167128.
Will backport to 2.4.
2005-08-27 10:07:56 +00:00
Martin v. Löwis faffa15842 Revert previous checkin. 2005-08-24 06:43:09 +00:00
Martin v. Löwis bc3b06087c Patch #1262036: Make tarfile name absolute. Fixes #1257255.
Will backport to 2.4.
2005-08-24 06:06:52 +00:00
Georg Brandl 7eb4b7d177 Fix all wrong instances of "it's". 2005-07-22 21:49:32 +00:00
Tim Peters eba28bea9b Whitespace normalization. 2005-03-28 01:08:02 +00:00
Martin v. Löwis 78be7df9e4 Patch #918101: Add tarfile open mode r|* for auto-detection of the
stream compression; add, for symmetry reasons, r:* as a synonym of r.
2005-03-05 12:47:42 +00:00
Martin v. Löwis 00a73e7715 Patch #1043890: tarfile: add extractall() method. 2005-03-04 19:40:34 +00:00
Martin v. Löwis 637431bf14 Patch #1103407: Properly deal with tarfile iterators when untarring
symbolic links on Windows. Fixes #1100429. Will backport to 2.4.
2005-03-03 23:12:42 +00:00