python / python/cpython

Tarfile regression

Open
#144,755 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pending stdlib type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Bug report

Bug description:

The function _get_filtered_attrs in tarfile.py references the special value os.path.ALLOW_MISSING. This is a problem because this value was only introduced in Python 3.14. However, the reference to this value has been backported to earlier supported Python versions. The result is that tarfile.py can throw an exception when being called from Python versions prior to 3.14.

  File "/usr/local/lib/python3.12/tarfile.py", line 845, in data_filter
    new_attrs = _get_filtered_attrs(member, dest_path, True)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/tarfile.py", line 770, in _get_filtered_attrs
    dest_path = os.path.realpath(dest_path, strict=os.path.ALLOW_MISSING)
                                                   ^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'posixpath' has no attribute 'ALLOW_MISSING'

In Python 3.12, the bug first appears in version 3.12.11.

In the Python 3.13 branch, the bug was introduced in 3.13.4, and persists in all subsequent versions.

In Python 3.11, it appears in all versions after and including 3.11.13

And in the Python 3.10 line, 3.10.18 is the first version where this value appears.

Personally, my symptom of this problem is that this bug prevents me from installing common libraries such as numpy because pip uses the tarfile library to unpack the download from PyPI.

CPython versions tested on:

3.12

Operating systems tested on:

Linux

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in tarfile.py at _get_filtered_attrs, then reproduce the reported data_filter failure on supported Python versions before 3.14. Verify that tarfile operations no longer raise AttributeError for os.path.ALLOW_MISSING and confirm the reported installation scenario is addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.