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 6, 2024
1 parent d71da88 commit 5aeb9ab
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 5aeb9ab

Please sign in to comment.