summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tarfile.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-70441: Fix test_tarfile on systems w/o bz2 (gh-2962) (#94258)Christian Heimes2022-06-251-0/+1
|
* bpo-26253: Add compressionlevel to tarfile stream (GH-2962)Yaron de Leeuw2022-06-251-0/+68
| | | | | | `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.
* gh-91387: Fix tarfile test on WASI (GH-93984)Christian Heimes2022-06-181-1/+1
| | | WASI's rmdir() syscall does not like the trailing slash.
* gh-91387: Strip trailing slash from tarfile longname directories (GH-32423)Chris Fernald2022-06-171-0/+17
| | | Co-authored-by: Brett Cannon <brett@python.org>
* gh-90473: Make chmod a dummy on WASI, skip chmod tests (GH-93534)Christian Heimes2022-06-061-0/+2
| | | WASI does not have the ``chmod(2)`` syscall yet.
* gh-90473: Misc test fixes for WASI (GH-93218)Christian Heimes2022-05-251-1/+4
| | | | | | | | * ``sys.executable`` is not set * WASI does not support subprocess * ``pwd`` module is not available * WASI checks ``open`` syscall flags more strict, needs r, w, rw flag. * ``umask`` is not available * ``/dev/null`` may not be accessible
* bpo-40280: Skip more tests/features that don't apply to Emscripten (GH-31791)Christian Heimes2022-03-101-0/+1
| | | | | | | - fd inheritance can't be modified because Emscripten doesn't support subprocesses anyway. - setpriority always fails - geteuid no longer causes problems with latest emsdk - umask is a stub - geteuid / getuid always return 0, but process cannot chown to random uid.
* bpo-45863: tarfile: don't zero out header fields unnecessarily (GH-29693)Joshua Root2022-02-091-0/+55
| | | | | | | | | | 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.
* bpo-44289: Keep argument file object's current position in ↵Andrzej Mateja2022-02-091-0/+12
| | | | tarfile.is_tarfile (GH-26488)
* bpo-21987: Fix TarFile.getmember getting a dir with a trailing slash (GH-30283)andrei kulakov2022-01-211-0/+19
|
* bpo-39039: tarfile raises descriptive exception from zlib.error (GH-27766)Jack DeVries2021-09-291-0/+14
| | | | | | | * 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
* bpo-32695: Docs and tests for compresslevel and preset kwargs in tarfile ↵Zackery Spytz2021-08-091-3/+18
| | | | | (GH-21470) Co-Authored-By: Bo Bayles <bbayles@gmail.com>
* bpo-8978: improve tarfile.open error message when lzma / bz2 are missing ↵Anthony Sottile2021-04-271-0/+12
| | | | | (GH-24850) Automerge-Triggered-By: GH:pablogsal
* bpo-12800: tarfile: Restore fix from 011525ee9 (GH-21409)Julien Palard2020-11-251-3/+3
| | | Restore fix from 011525ee92eb1c13ad1a62d28725a840e28f8160.
* bpo-41316: Make tarfile follow specs for FNAME (GH-21511)Artem Bulgakov2020-09-071-1/+13
| | | | | | | | | | 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
* bpo-41521: Rename blacklist parameter to not_exported (GH-21824)Victor Stinner2020-08-171-16/+13
| | | | Rename "blacklist" parameter of test.support.check__all__() to "not_exported".
* bpo-40275: Use new test.support helper submodules in tests (GH-21449)Hai Shi2020-08-031-53/+54
|
* bpo-39017: Avoid infinite loop in the tarfile module (GH-21454)Rishi2020-07-151-0/+7
| | | | | Avoid infinite loop when reading specially crafted TAR files using the tarfile module (CVE-2019-20907).
* bpo-41069: Make TESTFN and the CWD for tests containing non-ascii ↵Serhiy Storchaka2020-06-251-3/+6
| | | | characters. (GH-21035)
* bpo-40275: More lazy imports in test.support (GH-20131)Hai Shi2020-05-181-3/+3
| | | | | | | | | | | | | | | | | | | Make the the following imports lazy in test.support: * bz2 * gzip * lzma * resource * zlib The following test.support decorators now need to be called with parenthesis: * @support.requires_bz2 * @support.requires_gzip * @support.requires_lzma * @support.requires_zlib For example, "@requires_zlib" becomes "@requires_zlib()".
* bpo-40275: Move requires_hashdigest() to test.support.hashlib_helper (GH-19716)Hai Shi2020-04-291-1/+1
| | | Add a new test.support.hashlib_helper submodule.
* bpo-40286: Use random.randbytes() in tests (GH-19575)Victor Stinner2020-04-171-1/+1
|
* bpo-18819: tarfile: only set device fields for device files (GH-18080)William Chargin2020-02-121-0/+46
| | | | | | 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.
* bpo-29435: Allow is_tarfile to take a filelike obj (GH-18090)William Woodruff2020-01-231-0/+32
| | | `is_tarfile()` now supports `name` being a file or file-like object.
* bpo-38270: Check for hash digest algorithms and avoid MD5 (GH-16382)Christian Heimes2019-09-251-26/+30
| | | | | | | | | | | Make it easier to run and test Python on systems with restrict crypto policies: * add requires_hashdigest to test.support to check if a hash digest algorithm is available and working * avoid MD5 in test_hmac * replace MD5 with SHA256 in test_tarfile * mark network tests that require MD5 for MD5-based digest auth or CRAM-MD5 https://bugs.python.org/issue38270
* bpo-36268: Change default tar format to pax from GNU. (GH-12355)CAM Gerlach2019-03-211-5/+6
|
* bpo-22831: Use "with" to avoid possible fd leaks in tests (part 1). (GH-10928)Serhiy Storchaka2019-03-051-67/+60
|
* bpo-35772: Fix test_tarfile on ppc64 (GH-11606)Victor Stinner2019-01-211-2/+7
| | | | | | | | | | | | | | | Fix sparse file tests of test_tarfile on ppc64le with the tmpfs filesystem. Fix the function testing if the filesystem supports sparse files: create a file which contains data and "holes", instead of creating a file which contains no data. tmpfs effective block size is a page size (tmpfs lives in the page cache). RHEL uses 64 KiB pages on aarch64, ppc64 and ppc64le, only s390x and x86_64 use 4 KiB pages, whereas the test punch holes of 4 KiB. test.pythoninfo: Add resource.getpagesize().
* bpo-32713: Fix tarfile.itn for large/negative float values. (GH-5434)Joffrey F2018-02-271-0/+8
|
* bpo-30693: Fix tarfile test cleanup on MSWindows (#5557)Bernhard M. Wiedemann2018-02-061-4/+4
| | | it was using our mocked listdir to check when the files were gone.
* bpo-30693: zip+tarfile: sort directory listing (#2263)Bernhard M. Wiedemann2018-01-311-0/+24
| | | | | | 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.
* bpo-29181: Skip test_tarfile tests on PermissionError raised by Android ↵xdegaye2017-11-121-2/+8
| | | | (GH-4375)
* Replace KB unit with KiB (#4293)Victor Stinner2017-11-081-2/+2
| | | | | | | | | | | kB (*kilo* byte) unit means 1000 bytes, whereas KiB ("kibibyte") means 1024 bytes. KB was misused: replace kB or KB with KiB when appropriate. Same change for MB and GB which become MiB and GiB. Change the output of Tools/iobench/iobench.py. Round also the size of the documentation from 5.5 MB to 5 MiB.
* bpo-29958: Minor improvements to zipfile and tarfile CLI. (#944)Serhiy Storchaka2017-04-071-0/+10
|
* bpo-28230: Document the pathlib support in tarfile and add tests. (#512)Serhiy Storchaka2017-03-081-0/+76
|
* Issue #29210: Removed support of deprecated argument "exclude" inSerhiy Storchaka2017-01-131-27/+0
| | | | tarfile.TarFile.add().
* Issue #28449: tarfile.open() with mode "r" or "r:" now tries to open a tarSerhiy Storchaka2016-10-301-1/+7
|\ | | | | | | | | file with compression before trying to open it without compression. Otherwise it had 50% chance failed with ignore_zeros=True.
| * Issue #28449: tarfile.open() with mode "r" or "r:" now tries to open a tarSerhiy Storchaka2016-10-301-1/+7
| | | | | | | | | | file with compression before trying to open it without compression. Otherwise it had 50% chance failed with ignore_zeros=True.
* | Issue #24838: Merge test_tarfile.py fix from 3.5.Lars Gustäbel2016-04-191-2/+2
|\ \ | |/
| * Issue #24838: Fix test_tarfile.py for non-utf8 filesystem encodings.Lars Gustäbel2016-04-191-2/+2
| |
* | Issue #24838: Merge tarfile fix from 3.5.Lars Gustäbel2016-04-191-5/+82
|\ \ | |/
| * Issue #24838: tarfile's ustar and gnu formats now correctly calculate name andLars Gustäbel2016-04-191-5/+82
| | | | | | | | link field limits for multibyte character encodings like utf-8.
* | Issue #23883: grp and pwd are None on WindowsMartin Panter2016-01-161-1/+1
| |
* | Issue #23883: Removed redundant names from blacklists.Serhiy Storchaka2016-01-161-2/+2
| |
* | Issue #23883: Add missing APIs to tarfile.__all__Martin Panter2016-01-161-0/+18
|/ | | | Patch by Joel Taddei and Jacek Kołodziej.
* Use support.change_cwd() in tests.Serhiy Storchaka2015-09-061-9/+3
|\
| * Use support.change_cwd() in tests.Serhiy Storchaka2015-09-061-9/+3
| |
* | Merge with 3.4: Issue #24259: tarfile now raises a ReadError if an archive ↵Lars Gustäbel2015-07-061-0/+23
|\ \ | |/ | | | | is truncated inside a data segment.
| * Issue #24259: tarfile now raises a ReadError if an archive is truncated ↵Lars Gustäbel2015-07-061-0/+23
| | | | | | | | inside a data segment.
* | Merge with 3.4: Issue #24514: tarfile now tolerates number fields consisting ↵Lars Gustäbel2015-07-021-0/+4
|\ \ | |/ | | | | of only whitespace.