From 25f7fc40a25191d7cab72ddb3a778668a635fbb5 Mon Sep 17 00:00:00 2001 From: Eric Berquist <727571+berquist@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:46:59 -0400 Subject: [PATCH] TarFile.extractall() now warns when not specifying extraction filter (#1125) See https://docs.python.org/3/library/tarfile.html#tarfile-extraction-filter for more information. --- src/sst/core/testingframework/sst_unittest_support.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/sst/core/testingframework/sst_unittest_support.py b/src/sst/core/testingframework/sst_unittest_support.py index f47a89c55..5fb46232e 100644 --- a/src/sst/core/testingframework/sst_unittest_support.py +++ b/src/sst/core/testingframework/sst_unittest_support.py @@ -1670,7 +1670,7 @@ def os_extract_tar(tarfilepath, targetdir="."): targetdir (str): Where to extract to [.] Returns: - (bool) True if wget is successful. + (bool) True if untar is successful. """ if not os.path.isfile(tarfilepath): errmsg = "tar file{0} does not exist".format(tarfilepath) @@ -1678,7 +1678,10 @@ def os_extract_tar(tarfilepath, targetdir="."): return False try: this_tar = tarfile.open(tarfilepath) - this_tar.extractall(targetdir) + if sys.version_info.minor >= 12: + this_tar.extractall(targetdir, filter="data") + else: + this_tar.extractall(targetdir) this_tar.close() return True except tarfile.TarError as exc_e: