Skip to content

Commit 8edda42

Browse files
parona-sourcearthurzam
authored andcommitted
checks.git: Set tarfile filter
* Not setting it triggers a DeprecationWarning in python3.12. * Despite tarballs by git-archive being trusted, there isn't benefit in trusting it as the tarballs don't use metadata that would require it. Signed-off-by: Alfred Wingate <parona@protonmail.com> Closes: #638 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
1 parent d837ae2 commit 8edda42

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/pkgcheck/checks/git.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,10 @@ def _populate(self, pkgs):
283283
if old_files.poll():
284284
error = old_files.stderr.read().decode().strip()
285285
raise PkgcheckUserException(f"failed populating archive repo: {error}")
286+
# https://docs.python.org/3.12/library/tarfile.html#tarfile-extraction-filter
287+
if hasattr(tarfile, "data_filter"):
288+
# https://docs.python.org/3.12/library/tarfile.html#tarfile.TarFile.extraction_filter
289+
tarfile.TarFile.extraction_filter = staticmethod(tarfile.data_filter)
286290
with tarfile.open(mode="r|", fileobj=old_files.stdout) as tar:
287291
tar.extractall(path=self.location)
288292

0 commit comments

Comments
 (0)