summaryrefslogtreecommitdiffstats
path: root/Lib/tarfile.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2004-08-18 13:57:44 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2004-08-18 13:57:44 (GMT)
commit75b9da4aaf6b1636a116f4afd5b0d11a642c4401 (patch)
tree5281cd8a1fded1cefc91a3daa6742bab693014a3 /Lib/tarfile.py
parent78a8acc55bb3ae7c8d265cbcb4709d84938a4cef (diff)
downloadcpython-75b9da4aaf6b1636a116f4afd5b0d11a642c4401.zip
cpython-75b9da4aaf6b1636a116f4afd5b0d11a642c4401.tar.gz
cpython-75b9da4aaf6b1636a116f4afd5b0d11a642c4401.tar.bz2
Patch #995126: Correct directory size, and generate GNU tarfiles by default.
Diffstat (limited to 'Lib/tarfile.py')
-rw-r--r--Lib/tarfile.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index 64d006d..ba5a1d2 100644
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -781,7 +781,7 @@ class TarFile(object):
# messages (if debug >= 0). If > 0, errors
# are passed to the caller as exceptions.
- posix = True # If True, generates POSIX.1-1990-compliant
+ posix = False # If True, generates POSIX.1-1990-compliant
# archives (no GNU extensions!)
fileobject = ExFileObject
@@ -1137,7 +1137,7 @@ class TarFile(object):
tarinfo.mode = stmd
tarinfo.uid = statres.st_uid
tarinfo.gid = statres.st_gid
- tarinfo.size = statres.st_size
+ tarinfo.size = not stat.S_ISDIR(stmd) and statres.st_size or 0
tarinfo.mtime = statres.st_mtime
tarinfo.type = type
tarinfo.linkname = linkname