Skip to content

Commit

Permalink
checks.git: Set tarfile filter
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
parona-source authored and arthurzam committed Dec 8, 2023
1 parent d837ae2 commit 8edda42
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pkgcheck/checks/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ def _populate(self, pkgs):
if old_files.poll():
error = old_files.stderr.read().decode().strip()
raise PkgcheckUserException(f"failed populating archive repo: {error}")
# https://docs.python.org/3.12/library/tarfile.html#tarfile-extraction-filter
if hasattr(tarfile, "data_filter"):
# https://docs.python.org/3.12/library/tarfile.html#tarfile.TarFile.extraction_filter
tarfile.TarFile.extraction_filter = staticmethod(tarfile.data_filter)
with tarfile.open(mode="r|", fileobj=old_files.stdout) as tar:
tar.extractall(path=self.location)

Expand Down

0 comments on commit 8edda42

Please sign in to comment.