python / python/cpython

test_tarfile_vs_tar fail on macOS (again)

Open
#140,072 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

OS-mac tests type-bug
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

Bug report

Bug description:

Python-3.14 on macOS 26.0 (Tahoe) failed a self-test:

test_tarfile_vs_tar (test.test_shutil.TestArchives.test_tarfile_vs_tar) ... tar: unrecognized option '--no-mac-metadata'
Try 'tar --help' or 'tar --usage' for more information.
ERROR

The full detail is:

======================================================================
ERROR: test_tarfile_vs_tar (test.test_shutil.TestArchives.test_tarfile_vs_tar)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/sw/build.build/python314-3.14.0-1/Python-3.14.0/Lib/test/test_shutil.py", line 1752, in test_tarfile_vs_tar
    subprocess.check_call(tar_cmd, cwd=root_dir,
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
                          stdout=subprocess.DEVNULL)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/sw/build.build/python314-3.14.0-1/Python-3.14.0/Lib/subprocess.py", line 419, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['tar', '--no-mac-metadata', '-cf', 'archive2.tar', 'dist']' returned non-zero exit status 64.

----------------------------------------------------------------------

I have another 'tar' ahead of Apple's in my path that does not have the Apple-specific flag features. if I remove the addition of '--no-mac-metadata' (added to resolve #109980) it passes. Or if I hardcode the test to use Apple's at line 1740:

-       tar_cmd = ['tar', '-cf', 'archive2.tar', base_dir]
+       tar_cmd = ['/usr/bin/tar', '-cf', 'archive2.tar', base_dir]

it passes. But interestingly, if I hardcode to use Apple's and remove that flag, it still passes.

CPython versions tested on:

3.14

Operating systems tested on:

macOS

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 Lib/test/test_shutil.py around test_tarfile_vs_tar and the tar command at line 1740. Reproduce the failure on macOS with a non-Apple tar earlier in PATH, then compare the test behavior with /usr/bin/tar. Done means the self-test works with the supported tar selection and the regression case is covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, python
Domain
operating-systems, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.