Commit 89a89440 authored by CAM Gerlach's avatar CAM Gerlach Committed by Nick Coghlan

bpo-30661: Improve docs for tarfile pax change and effect on shutil (GH-12635)

The shutil archive creation helpers use the default tarfile format,
so that API is also switching to use `pax` by default.
parent 2ea80995
...@@ -559,6 +559,10 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules. ...@@ -559,6 +559,10 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
The *verbose* argument is unused and deprecated. The *verbose* argument is unused and deprecated.
.. versionchanged:: 3.8
The modern pax (POSIX.1-2001) format is now used instead of
the legacy GNU format for archives created with ``format="tar"``.
.. function:: get_archive_formats() .. function:: get_archive_formats()
...@@ -568,7 +572,7 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules. ...@@ -568,7 +572,7 @@ provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules.
By default :mod:`shutil` provides these formats: By default :mod:`shutil` provides these formats:
- *zip*: ZIP file (if the :mod:`zlib` module is available). - *zip*: ZIP file (if the :mod:`zlib` module is available).
- *tar*: uncompressed tar file. - *tar*: Uncompressed tar file. Uses POSIX.1-2001 pax format for new archives.
- *gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available). - *gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available).
- *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available). - *bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available).
- *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available). - *xztar*: xz'ed tar-file (if the :mod:`lzma` module is available).
......
...@@ -813,8 +813,8 @@ Supported tar formats ...@@ -813,8 +813,8 @@ Supported tar formats
There are three tar formats that can be created with the :mod:`tarfile` module: There are three tar formats that can be created with the :mod:`tarfile` module:
* The POSIX.1-1988 ustar format (:const:`USTAR_FORMAT`). It supports filenames * The POSIX.1-1988 ustar format (:const:`USTAR_FORMAT`). It supports filenames
up to a length of at best 256 characters and linknames up to 100 characters. The up to a length of at best 256 characters and linknames up to 100 characters.
maximum file size is 8 GiB. This is an old and limited but widely The maximum file size is 8 GiB. This is an old and limited but widely
supported format. supported format.
* The GNU tar format (:const:`GNU_FORMAT`). It supports long filenames and * The GNU tar format (:const:`GNU_FORMAT`). It supports long filenames and
...@@ -826,14 +826,15 @@ There are three tar formats that can be created with the :mod:`tarfile` module: ...@@ -826,14 +826,15 @@ There are three tar formats that can be created with the :mod:`tarfile` module:
format with virtually no limits. It supports long filenames and linknames, large format with virtually no limits. It supports long filenames and linknames, large
files and stores pathnames in a portable way. Modern tar implementations, files and stores pathnames in a portable way. Modern tar implementations,
including GNU tar, bsdtar/libarchive and star, fully support extended *pax* including GNU tar, bsdtar/libarchive and star, fully support extended *pax*
features; some older or unmaintained libraries may not, but should treat features; some old or unmaintained libraries may not, but should treat
*pax* archives as if they were in the universally-supported *ustar* format. *pax* archives as if they were in the universally-supported *ustar* format.
It is the current default format for new archives.
The *pax* format is an extension to the existing *ustar* format. It uses extra It extends the existing *ustar* format with extra headers for information
headers for information that cannot be stored otherwise. There are two flavours that cannot be stored otherwise. There are two flavours of pax headers:
of pax headers: Extended headers only affect the subsequent file header, global Extended headers only affect the subsequent file header, global
headers are valid for the complete archive and affect all following files. All headers are valid for the complete archive and affect all following files.
the data in a pax header is encoded in *UTF-8* for portability reasons. All the data in a pax header is encoded in *UTF-8* for portability reasons.
There are some more variants of the tar format which can be read, but not There are some more variants of the tar format which can be read, but not
created: created:
......
...@@ -300,6 +300,11 @@ shutil ...@@ -300,6 +300,11 @@ shutil
:func:`shutil.copytree` now accepts a new ``dirs_exist_ok`` keyword argument. :func:`shutil.copytree` now accepts a new ``dirs_exist_ok`` keyword argument.
(Contributed by Josh Bronson in :issue:`20849`.) (Contributed by Josh Bronson in :issue:`20849`.)
:func:`shutil.make_archive` now defaults to the modern pax (POSIX.1-2001)
format for new archives to improve portability and standards conformance,
inherited from the corresponding change to the :mod:`tarfile` module.
(Contributed by C.A.M. Gerlach in :issue:`30661`.)
ssl ssl
--- ---
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment