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
分支
35.9k
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 摘要。