|
11 | 11 | import shutil |
12 | 12 | import stat |
13 | 13 | import subprocess |
| 14 | +import sys |
14 | 15 | import tarfile |
15 | 16 | import tempfile |
16 | 17 | import urllib.request |
@@ -3191,7 +3192,14 @@ def pull_archive(cfg, subject): |
3191 | 3192 | os.mkdir(subject.prefix_dir) |
3192 | 3193 | with tarfile.open(subject.archive_file, "r:gz") as tar: |
3193 | 3194 | for info in tar: |
3194 | | - tar.extract(info, subject.prefix_dir) |
| 3195 | + if sys.version_info >= (3, 12): |
| 3196 | + # Maybe should have a more aggressive filter, but we have |
| 3197 | + # legitimate "evil-looking" tool tars (specifically, GCC |
| 3198 | + # tarballs link to the binutils directory, which is outside |
| 3199 | + # of the root) |
| 3200 | + tar.extract(info, subject.prefix_dir, filter="fully_trusted") |
| 3201 | + else: |
| 3202 | + tar.extract(info, subject.prefix_dir) |
3195 | 3203 | else: |
3196 | 3204 | # TODO: Also support packages here. |
3197 | 3205 | raise GenericError("Unexpected subject for pull-archive") |
@@ -3569,7 +3577,7 @@ def add_source_dependencies(s): |
3569 | 3577 |
|
3570 | 3578 | def add_tool_dependencies(s): |
3571 | 3579 | for subject_id in s.tool_stage_dependencies: |
3572 | | - (tool_name, stage_name) = (subject_id.name, subject_id.stage) |
| 3580 | + tool_name, stage_name = (subject_id.name, subject_id.stage) |
3573 | 3581 | dep_tool = self._cfg.get_tool_pkg(tool_name) |
3574 | 3582 | if self.build_scope is not None and dep_tool not in self.build_scope: |
3575 | 3583 | if self.pull_out_of_scope: |
@@ -3984,7 +3992,7 @@ def run_plan(self): |
3984 | 3992 | else: |
3985 | 3993 | _util.log_info("Nothing to do") |
3986 | 3994 | for item in printed: |
3987 | | - (action, subject) = (item.action, item.subject) |
| 3995 | + action, subject = (item.action, item.subject) |
3988 | 3996 | if self.explain: |
3989 | 3997 | symbol = f"#{numbering[item]}" |
3990 | 3998 | eprint(f"{symbol:>5} ", end="") |
@@ -4053,7 +4061,7 @@ def run_plan(self): |
4053 | 4061 |
|
4054 | 4062 | any_failed_items = False |
4055 | 4063 | for n, item in enumerate(scheduled): |
4056 | | - (action, subject) = (item.action, item.subject) |
| 4064 | + action, subject = (item.action, item.subject) |
4057 | 4065 |
|
4058 | 4066 | # Check if any prerequisites failed; this can generally only happen with --keep-going. |
4059 | 4067 | any_failed_edges = False |
@@ -4190,7 +4198,7 @@ def emit_progress(status): |
4190 | 4198 | if any_failed_items: |
4191 | 4199 | _util.log_info("The following steps failed:") |
4192 | 4200 | for item in scheduled: |
4193 | | - (action, subject) = (item.action, item.subject) |
| 4201 | + action, subject = (item.action, item.subject) |
4194 | 4202 | assert item.exec_status != ExecutionStatus.NULL |
4195 | 4203 | if item.exec_status == ExecutionStatus.SUCCESS: |
4196 | 4204 | continue |
|
0 commit comments