| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
deprecation warnings (GH-117872) (GH-117930)
gh-117691: Add an appropriate stacklevel for PEP-706 tarfile deprecation warnings (GH-117872)
(cherry picked from commit cff0a2db00b6379f60fe273a9782f71773d0a4cb)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
|
|
|
|
|
|
|
| |
top of a file (GH-114960) (GH-114963)
Also, add tests common to tarfile and zipfile.
(cherry picked from commit 96bce033c4a4da7112792ba335ef3eb9a3eb0da0)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
|
|
|
|
|
|
| |
tarfile stream (GH-31610) (GH-113519)
(cherry picked from commit 0651936ae2bc6999f488f8c519b8d07a06a11557)
Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
|
|
| |
(#108211)
gh-107845: Fix symlink handling for tarfile.data_filter (GH-107846)
(cherry picked from commit acbd3f9c5c5f23e95267714e41236140d84fe962)
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Lumír 'Frenzy' Balhar <frenzy.madness@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-107485) (#108207)
gh-107396: tarfiles: set self.exception before _init_read_gz() (GH-107485)
In the stack call of: _init_read_gz()
```
_read, tarfile.py:548
read, tarfile.py:526
_init_read_gz, tarfile.py:491
```
a try;except exists that uses `self.exception`, so it needs to be set before
calling _init_read_gz().
(cherry picked from commit 37135d25e269ede92bc7da363bebfa574782e59a)
Co-authored-by: balmeida-nokia <83089745+balmeida-nokia@users.noreply.github.com>
|
| |
|
|
|
| |
Co-authored-by: Simeon Visser <svisser@users.noreply.github.com>
|
| |
|
|
|
| |
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
|
| |
|
|
|
|
|
|
| |
`tarfile` already accepts a compressionlevel argument for creating
files. This patch adds the same for stream-based tarfile usage.
The default is 9, the value that was previously hard-coded.
|
|
|
| |
Co-authored-by: Brett Cannon <brett@python.org>
|
|
|
|
|
|
|
|
|
|
| |
Numeric fields of type float, notably mtime, can't be represented
exactly in the ustar header, so the pax header is used. But it is
helpful to set them to the nearest int (i.e. second rather than
nanosecond precision mtimes) in the ustar header as well, for the
benefit of unarchivers that don't understand the pax header.
Add test for tarfile.TarInfo.create_pax_header to confirm correct
behaviour.
|
|
|
|
| |
tarfile.is_tarfile (GH-26488)
|
| |
|
|
|
|
|
|
|
| |
* during tarfile parsing, a zlib error indicates invalid data
* tarfile.open now raises a descriptive exception from the zlib error
* this makes it clear to the user that they may be trying to open a
corrupted tar file
|
|
|
|
|
| |
(GH-24850)
Automerge-Triggered-By: GH:pablogsal
|
|
|
|
| |
- `from None` if the new exception uses, or doesn't need, the previous one
- `from e` if the previous exception is still relevant
|
|
|
| |
Restore fix from 011525ee92eb1c13ad1a62d28725a840e28f8160.
|
|
|
| |
Co-authored-by: Andrey Darascheka <andrei.daraschenka@leverx.com>
|
|
|
|
|
|
|
|
|
|
| |
tarfile writes full path to FNAME field of GZIP format instead of just basename if user specified absolute path. Some archive viewers may process file incorrectly. Also it creates security issue because anyone can know structure of directories on system and know username or other personal information.
RFC1952 says about FNAME:
This is the original name of the file being compressed, with any directory components removed.
So tarfile must remove directory names from FNAME and write only basename of file.
Automerge-Triggered-By: @jaraco
|
|
|
|
|
| |
Avoid infinite loop when reading specially crafted TAR files using the tarfile module
(CVE-2019-20907).
|
|
|
|
|
|
| |
The GNU docs describe the `devmajor` and `devminor` fields of the tar
header struct only in the context of character and block special files,
suggesting that in other cases they are not populated. Typical utilities
behave accordingly; this patch teaches `tarfile` to do the same.
|
|
|
| |
Use `from ... import ...` to ensure module is fully loaded before accessing its attributes.
|
|
|
| |
`is_tarfile()` now supports `name` being a file or file-like object.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
tarfile._Stream has two buffer for compressed and uncompressed data.
Those buffers are not aligned so unnecessary bytes slicing happens
for every reading chunks.
This commit bypass compressed buffering.
In this benchmark [1], user time become 250ms from 300ms.
[1]: https://bugs.python.org/msg320763
|
|
|
|
| |
During buffered read, use a list followed by join instead of extending a bytes object.
This is how it was done before but changed in commit b506dc32c1a.
|
| |
|
| |
|
|
|
|
|
|
| |
tarfile and zipfile now sort directory listing to generate tar and zip archives
in a more reproducible way.
See also https://reproducible-builds.org/docs/stable-inputs/ on that topic.
|
|
|
|
|
|
|
|
| |
* Fix multiple typos in code comments
* Add spacing in comments (test_logging.py, test_math.py)
* Fix spaces at the beginning of comments in test_logging.py
|
|
|
| |
The data contained in them is nonsensical
|
| |
|
| |
|
|
|
|
| |
tarfile.TarFile.add().
|
|
|
|
| |
when the grp module cannot be imported, as for example on Android platforms.
|
|\
| |
| |
| |
| | |
file with compression before trying to open it without compression. Otherwise
it had 50% chance failed with ignore_zeros=True.
|
| |
| |
| |
| |
| | |
file with compression before trying to open it without compression. Otherwise
it had 50% chance failed with ignore_zeros=True.
|
| |
| |
| |
| | |
Patch by Jason Fried.
|
| |
| |
| |
| | |
and Windows CE is no longer a relevant platform for Python.
|
|\ \
| |/ |
|
| |
| |
| |
| | |
Patch by Jason Fried.
|
|\ \
| |/ |
|
| |
| |
| |
| | |
link field limits for multibyte character encodings like utf-8.
|
|\ \
| |/
| |
| | |
messages.
|
| | |
|
|\ \
| |/ |
|