Skip to content

the extract() function in tarball has changed in python3.14 and causes issues in avocado #6302

@arif-ali

Description

@arif-ali

Describe the bug
When extracting a tarball that has special files, it will complain and fail as shown below

Steps to reproduce
Clone our repo https://github.com/sosreport/sos, and then run tox -e stagetwo_tests, and that will show the initial error, and looking through the avocado logs

Expected behavior
I would expect it to work, and not error

Current behavior

[stdlog] 2026-04-29 16:45:51,351 avocado.test stacktrace       L0041 ERROR| 
[stdlog] 2026-04-29 16:45:51,351 avocado.test stacktrace       L0043 ERROR| Reproduced traceback from: /root/sos/.tox/stagetwo_tests/lib/python3.14/site-packages/avocado/core/test.py:591
[stdlog] 2026-04-29 16:45:51,353 avocado.test stacktrace       L0050 ERROR| Traceback (most recent call last):
[stdlog] 2026-04-29 16:45:51,353 avocado.test stacktrace       L0050 ERROR|   File "/root/sos/tests/sos_tests.py", line 493, in _extract_archive
[stdlog] 2026-04-29 16:45:51,353 avocado.test stacktrace       L0050 ERROR|     archive.extract(arc_path, _extract_path)
[stdlog] 2026-04-29 16:45:51,353 avocado.test stacktrace       L0050 ERROR|     ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
[stdlog] 2026-04-29 16:45:51,353 avocado.test stacktrace       L0050 ERROR|   File "/root/sos/.tox/stagetwo_tests/lib/python3.14/site-packages/avocado/utils/archive.py", line 521, in uncompr
ess
[stdlog] 2026-04-29 16:45:51,353 avocado.test stacktrace       L0050 ERROR|     return x.extract(path)
[stdlog] 2026-04-29 16:45:51,353 avocado.test stacktrace       L0050 ERROR|            ~~~~~~~~~^^^^^^
[stdlog] 2026-04-29 16:45:51,353 avocado.test stacktrace       L0050 ERROR|   File "/root/sos/.tox/stagetwo_tests/lib/python3.14/site-packages/avocado/utils/archive.py", line 365, in extract
[stdlog] 2026-04-29 16:45:51,353 avocado.test stacktrace       L0050 ERROR|     self._engine.extractall(path)
[stdlog] 2026-04-29 16:45:51,353 avocado.test stacktrace       L0050 ERROR|     ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
[stdlog] 2026-04-29 16:45:51,353 avocado.test stacktrace       L0050 ERROR|   File "/usr/lib/python3.14/tarfile.py", line 2430, in extractall
[stdlog] 2026-04-29 16:45:51,353 avocado.test stacktrace       L0050 ERROR|     tarinfo, unfiltered = self._get_extract_tarinfo(
[stdlog] 2026-04-29 16:45:51,354 avocado.test stacktrace       L0050 ERROR|                           ~~~~~~~~~~~~~~~~~~~~~~~~~^
[stdlog] 2026-04-29 16:45:51,354 avocado.test stacktrace       L0050 ERROR|         member, filter_function, path)
[stdlog] 2026-04-29 16:45:51,354 avocado.test stacktrace       L0050 ERROR|         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[stdlog] 2026-04-29 16:45:51,354 avocado.test stacktrace       L0050 ERROR|   File "/usr/lib/python3.14/tarfile.py", line 2519, in _get_extract_tarinfo
[stdlog] 2026-04-29 16:45:51,354 avocado.test stacktrace       L0050 ERROR|     self._handle_fatal_error(e)
[stdlog] 2026-04-29 16:45:51,354 avocado.test stacktrace       L0050 ERROR|     ~~~~~~~~~~~~~~~~~~~~~~~~^^^
[stdlog] 2026-04-29 16:45:51,354 avocado.test stacktrace       L0050 ERROR|   File "/usr/lib/python3.14/tarfile.py", line 2517, in _get_extract_tarinfo
[stdlog] 2026-04-29 16:45:51,354 avocado.test stacktrace       L0050 ERROR|     filtered = filter_function(unfiltered, path)
[stdlog] 2026-04-29 16:45:51,354 avocado.test stacktrace       L0050 ERROR|   File "/usr/lib/python3.14/tarfile.py", line 859, in data_filter
[stdlog] 2026-04-29 16:45:51,354 avocado.test stacktrace       L0050 ERROR|     new_attrs = _get_filtered_attrs(member, dest_path, True)
[stdlog] 2026-04-29 16:45:51,354 avocado.test stacktrace       L0050 ERROR|   File "/usr/lib/python3.14/tarfile.py", line 816, in _get_filtered_attrs
[stdlog] 2026-04-29 16:45:51,354 avocado.test stacktrace       L0050 ERROR|     raise SpecialFileError(member)
[stdlog] 2026-04-29 16:45:51,354 avocado.test stacktrace       L0050 ERROR| tarfile.SpecialFileError: 'sosreport-host1-2021-08-03-qpkxdid/run/systemd/sessions/1.ref' is a special file

System information (please complete the following information):

  • OS: Ubuntu 26.04 LTS
  • Avocado version: 113.0
  • Avocado installation method: pip via tox

Additional information
It would be worth to be able to add the filter option to the extract function, so that we can use the fully_trusted filter. This is the change we'll be making in the sos code itself with the extract function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions