Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 75b9da4

Browse files
committed
Patch #995126: Correct directory size, and generate GNU tarfiles by default.
1 parent 78a8acc commit 75b9da4

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

Doc/lib/libtarfile.tex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,8 @@ \subsection{TarFile Objects \label{tarfile-objects}}
261261
gigabytes. A \exception{ValueError} is raised if a file exceeds
262262
this limit. If false, create a GNU tar compatible archive. It
263263
will not be \POSIX{} compliant, but can store files without any
264-
of the above restrictions.
264+
of the above restrictions.
265+
\versionchanged[\var{posix} defaults to false.]{2.4}
265266
\end{memberdesc}
266267

267268
\begin{memberdesc}{dereference}

Lib/tarfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ class TarFile(object):
781781
# messages (if debug >= 0). If > 0, errors
782782
# are passed to the caller as exceptions.
783783

784-
posix = True # If True, generates POSIX.1-1990-compliant
784+
posix = False # If True, generates POSIX.1-1990-compliant
785785
# archives (no GNU extensions!)
786786

787787
fileobject = ExFileObject
@@ -1137,7 +1137,7 @@ def gettarinfo(self, name=None, arcname=None, fileobj=None):
11371137
tarinfo.mode = stmd
11381138
tarinfo.uid = statres.st_uid
11391139
tarinfo.gid = statres.st_gid
1140-
tarinfo.size = statres.st_size
1140+
tarinfo.size = not stat.S_ISDIR(stmd) and statres.st_size or 0
11411141
tarinfo.mtime = statres.st_mtime
11421142
tarinfo.type = type
11431143
tarinfo.linkname = linkname

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ Extension modules
4444
Library
4545
-------
4646

47+
- tarfile now generates GNU tar files by default.
48+
4749
- HTTPResponse has now a getheaders method.
4850

4951
- Patch #1006219: let inspect.getsource handle '@' decorators. Thanks Simon

0 commit comments

Comments
 (0)