GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `tarfile.TarFile.add()` does not normalize symlink targets on Windows · Issue #151669 · python/cpython

tarfile.TarFile.add() does not normalize symlink targets on Windows #151669

New issue
Copy link
New issue
Copy link
Closed
Closed
tarfile.TarFile.add() does not normalize symlink targets on Windows#151669
Copy link
Labels
OS-windowsrelease-blockerstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@dnicolodi
dnicolodi
opened on Jun 18, 2026
Issue body actions

Bug report

Bug description:

In #138309 tarfile.TarFile.extract() has been modified to replace / in symlink targets with \ on Windows. I believe that the opposite normalization should be done in tarfile.TarFile.add().

I have noticed this in a downstream project that extracts tar archives generated by git dist, adds some additional files, and recreates the archive. When the git repository contains a symbolic link, the repacked archive contains symbolic link with the wrong path separators.

Before #138309, the extracted symbolic links on Windows were not functional (I believe) but the repacked archive had the same content as the original one. After #138309, this is not true anymore.

CPython versions tested on:

3.15

Operating systems tested on:

Windows

Linked PRs

  • gh-151669: Normalize symlink targets in tarfile.TarFile.gettarinfo() #151671
  • [3.15] gh-151669: Normalize symlink targets in tarfile.TarFile.gettarinfo() (GH-151671) #153517

Activity

  1. dnicolodi
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Jun 18, 2026
  2. aisk
    added
    OS-windows
    on Jun 19, 2026
  3. aisk
    added this to Tarfile issues 🗄️on Jun 19, 2026
  4. aisk
    changed the title [-]`tarfile.TYarFile.add()` does not normalize symlink targets on Windows[/-] [+]`tarfile.TarFile.add()` does not normalize symlink targets on Windows[/+] on Jun 19, 2026
  5. picnixz
    added
    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
    release-blocker
    on Jun 27, 2026
  6. github-project-automation
    added this to Release and Deferred blockers 🚫on Jun 27, 2026
  7. github-project-automation
    moved this to Todo in Release and Deferred blockers 🚫on Jun 27, 2026
  8. picnixz commented on Jun 27, 2026

    @picnixz
    picnixz
    on Jun 27, 2026
    Member
    More actions

    Considering this affects meson dist, I'm marking it as a release blocker to draw attention.

    cc @hugovk @encukou @eli-schwartz

  9. eli-schwartz commented on Jun 28, 2026

    @eli-schwartz
    eli-schwartz
    on Jun 28, 2026
    Contributor
    More actions

    Thanks. I'm subscribed to this ticket but most of the discussion seems to have been happening appended to #138309 (which I'm also subscribed to).

    From the meson side, I had this comment:

    If I understand correctly, using tarfile on windows to create an archive has always been wrong by default, but previously when taking a git generated tar, it was possible to roundtrip (unpack and repack) while preserving the target location set by git archive. And the roundtripping now causes a problem because unpacking will "destroy" information?

    Of course destroying information (that did not used to be destroyed) is a regression. But the discussion from the older PR has not been looking promising, unfortunately. :(

    I do hope this gets solved before final release, but a suitable fallback might, I suppose, be that meson dist can simply reject running on the combination of windows + 3.15 with an error message pointing to this ticket. I understand that that might be problematic to people whose build backend relies on a working tarfile module, but the good news is that many python developers just do releases via SaaS cloud providers (notably GitHub Actions) and aren't necessarily affected in the first place.

  10. encukou
    added a commit that references this issue on Jul 10, 2026

    gh-151669: Normalize symlink targets in tarfile.TarFile.gettarinfo() (G…

    cc31641
  11. hugovk
    added a commit that references this issue on Jul 17, 2026

    [3.15] gh-151669: Normalize symlink targets in tarfile.TarFile.gettar…

    fefc0b4
  12. hugovk
    closed this as completedon Jul 17, 2026
  13. github-project-automation
    moved this from Todo to Done in Release and Deferred blockers 🚫on Jul 17, 2026
  14. github-project-automation
    moved this to Done in Tarfile issues 🗄️on Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-windowsrelease-blockerstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    • Release and Deferred blockers 🚫
      Status
      Done
      Show more project fields
    • Tarfile issues 🗄️
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.