python / python/cpython

test_tarfile_vs_tar fail on macOS (again)

未关闭
#140,072 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

OS-mac tests type-bug
主要语言
Python
星标
77.2k
派生
36k
PR 合并指标
PR 指标待抓取

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 Lib/test/test_shutil.py 中的 test_tarfile_vs_tar 附近以及第 1740 行的 tar 命令开始。使用 PATH 中位置更靠前的非 Apple tar,在 macOS 上重现该失败,然后将测试行为与 /usr/bin/tar 进行比较。当 self-test 能够使用受支持的 tar 选择运行,并且回归案例已覆盖时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
macos, python
领域
operating-systems, testing-qa
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。