commit:     8edda4238ef614dfd848ff0e05167ccf1e8892f3
Author:     Alfred Wingate <parona <AT> protonmail <DOT> com>
AuthorDate: Mon Nov 27 10:58:11 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Dec  8 17:52:22 2023 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=8edda423

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 <AT> protonmail.com>
Closes: https://github.com/pkgcore/pkgcheck/pull/638
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 src/pkgcheck/checks/git.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/pkgcheck/checks/git.py b/src/pkgcheck/checks/git.py
index 525bf693..31f1dc69 100644
--- a/src/pkgcheck/checks/git.py
+++ b/src/pkgcheck/checks/git.py
@@ -283,6 +283,10 @@ class _RemovalRepo(UnconfiguredTree):
         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)
 

Reply via email to