Skip to content

Commit

Permalink
TarFile.extractall() now warns when not specifying extraction filter (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
berquist committed Sep 18, 2024
1 parent 312d1df commit 25f7fc4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/sst/core/testingframework/sst_unittest_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -1670,15 +1670,18 @@ 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)
log_error(errmsg)
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:
Expand Down

0 comments on commit 25f7fc4

Please sign in to comment.