Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tarfile ignores an error when trying to extract a directory on top of a file #114959

Closed
serhiy-storchaka opened this issue Feb 3, 2024 · 0 comments
Assignees
Labels
3.11 only security fixes 3.12 bugs and security fixes 3.13 new features, bugs and security fixes type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Feb 3, 2024

Bug report

During review of #112966 and #103263 I found inconsistency between zipfile and tarfile. When zipfile tries to extract a directory on top of an existing file, it fails. When tarfile tries to extract a directory on top of an existing file, it silently returns, keeping an existing file. This is an obvious bug in tarfile.

Both modules should be more cautious when extract on top of symlinks, but this is a different issue.

Linked PRs

@serhiy-storchaka serhiy-storchaka added type-bug An unexpected behavior, bug, or error 3.11 only security fixes 3.12 bugs and security fixes 3.13 new features, bugs and security fixes labels Feb 3, 2024
@serhiy-storchaka serhiy-storchaka self-assigned this Feb 3, 2024
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Feb 3, 2024
…ry on top of a file

Also, add tests common to tarfile and zipfile.
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Feb 3, 2024
…ry on top of a file

Also, add tests common to tarfile and zipfile.
serhiy-storchaka added a commit that referenced this issue Feb 3, 2024
…top of a file (GH-114960)

Also, add tests common to tarfile and zipfile.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Feb 3, 2024
…ry on top of a file (pythonGH-114960)

Also, add tests common to tarfile and zipfile.
(cherry picked from commit 96bce03)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Feb 3, 2024
…ry on top of a file (pythonGH-114960)

Also, add tests common to tarfile and zipfile.
(cherry picked from commit 96bce03)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this issue Feb 3, 2024
…ory on top of a file (GH-114960) (GH-114963)

Also, add tests common to tarfile and zipfile.
(cherry picked from commit 96bce03)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this issue Feb 3, 2024
…ory on top of a file (GH-114960) (GH-114964)

Also, add tests common to tarfile and zipfile.
(cherry picked from commit 96bce03)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
…ry on top of a file (pythonGH-114960)

Also, add tests common to tarfile and zipfile.
fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this issue Feb 14, 2024
…ry on top of a file (pythonGH-114960)

Also, add tests common to tarfile and zipfile.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes 3.12 bugs and security fixes 3.13 new features, bugs and security fixes type-bug An unexpected behavior, bug, or error
Projects
Status: Done
Development

No branches or pull requests

1 participant