[espidf] Fix tarfile extract crashing on Python 3.11 with None mode (#16530)
This commit is contained in:
1 parent
90715373f2
commit
f2bfe5cd17
1 file changed
+5
-5
@@ -549,11 +549,11 @@ def _tar_extract_all(
|
|||||||
if not (mode & stat.S_IXUSR):
|
if not (mode & stat.S_IXUSR):
|
||||||
mode &= ~(stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
|
mode &= ~(stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
|
||||||
mode |= stat.S_IRUSR | stat.S_IWUSR
|
mode |= stat.S_IRUSR | stat.S_IWUSR
|
||||||
elif member.isdir() or member.issym():
|
elif not (member.isdir() or member.issym()):
|
||||||
# Ignore mode for directories & symlinks
|
# Block special files. Directories and symlinks keep
|
||||||
mode = None
|
# their masked-original mode — passing None here would
|
||||||
else:
|
# crash tarfile.extract on Python <3.12 (its chmod
|
||||||
# Block special files
|
# path calls os.chmod unconditionally).
|
||||||
continue
|
continue
|
||||||
|
|
||||||
member.mode = mode
|
member.mode = mode
|
||||||
|
|||||||
Reference in new issue
Block a user