python / python/cpython

test_tarfile_vs_tar fail on macOS (again)

Offen
#140,072 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

OS-mac tests type-bug
Vorherrschende Sprache
Python
Sterne
77.2k
Forks
35.9k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne in Lib/test/test_shutil.py bei test_tarfile_vs_tar und dem tar-Befehl in Zeile 1740. Reproduziere den Fehler auf macOS mit einem nicht von Apple stammenden tar, der in PATH weiter vorne steht, und vergleiche anschließend das Testverhalten mit /usr/bin/tar. Erledigt ist die Aufgabe, wenn der Selbsttest mit der unterstützten tar-Auswahl funktioniert und der Regressionsfall abgedeckt ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
macos, python
Bereich
operating-systems, testing-qa
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.