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

gh-107845: Fix symlink handling for tarfile.data_filter #107846

Merged
merged 7 commits into from
Aug 21, 2023

Conversation

encukou
Copy link
Member

@encukou encukou commented Aug 10, 2023

@encukou encukou marked this pull request as draft August 15, 2023 11:59
@encukou encukou marked this pull request as ready for review August 16, 2023 09:54
Copy link
Contributor

@frenzymadness frenzymadness left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've found only one comment which might be improved.

As I'm thinking about more possible tests, I can imagine two more types:

  1. Chains of symlinks/hardlinks, something like symlink → hardlink → file or hardlink → symlink → file etc.
  2. (This can be combined with idea 1) Tests of archives where the symlinks/hardlinks are added before their destinations. So for the first example above, it'd be add symlink pointing to nonexisting hardlink, add hardlink to nonexisting file, and then add the target file.

Lib/test/test_tarfile.py Outdated Show resolved Hide resolved
Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

The doc and tarfile file LGTM. I didn't have time to review carefully the tests. Maybe first merge into main, see how it goes on buildbots, and only later backport to all branches. Sometimes, we have bad surprises.

Doc/library/tarfile.rst Outdated Show resolved Hide resolved
Doc/library/tarfile.rst Outdated Show resolved Hide resolved
encukou and others added 2 commits August 17, 2023 15:07
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Lumír 'Frenzy' Balhar <frenzy.madness@gmail.com>
Lib/test/test_tarfile.py Outdated Show resolved Hide resolved
@encukou
Copy link
Member Author

encukou commented Aug 17, 2023

AFAIK you can't extract a hardlink to file that's later in the archive (unless the file already exists on disk). Tarfile only searches entries before the link.
I added a test for link chains.

encukou and others added 2 commits August 17, 2023 15:21
@encukou encukou added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Aug 17, 2023
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @encukou for commit cebb318 🤖

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Aug 17, 2023
@encukou encukou added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Aug 21, 2023
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @encukou for commit cebb318 🤖

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Aug 21, 2023
@encukou
Copy link
Member Author

encukou commented Aug 21, 2023

Can't seem to get the buildbots to run, so I'll watch them after merging.

@miss-islington
Copy link
Contributor

Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry, @encukou, I could not cleanly backport this to 3.8 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker acbd3f9c5c5f23e95267714e41236140d84fe962 3.8

@miss-islington
Copy link
Contributor

Sorry, @encukou, I could not cleanly backport this to 3.9 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker acbd3f9c5c5f23e95267714e41236140d84fe962 3.9

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 21, 2023
…GH-107846)

(cherry picked from commit acbd3f9)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Lumír 'Frenzy' Balhar <frenzy.madness@gmail.com>
@bedevere-bot
Copy link

GH-108209 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Aug 21, 2023
@bedevere-bot
Copy link

GH-108210 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Aug 21, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 21, 2023
…GH-107846)

(cherry picked from commit acbd3f9)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Lumír 'Frenzy' Balhar <frenzy.madness@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 21, 2023
…GH-107846)

(cherry picked from commit acbd3f9)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Lumír 'Frenzy' Balhar <frenzy.madness@gmail.com>
@bedevere-bot
Copy link

GH-108211 is a backport of this pull request to the 3.12 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.12 bug and security fixes label Aug 21, 2023
Yhg1s pushed a commit that referenced this pull request Aug 21, 2023
…7846) (#108211)

gh-107845: Fix symlink handling for tarfile.data_filter (GH-107846)

(cherry picked from commit acbd3f9)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Lumír 'Frenzy' Balhar <frenzy.madness@gmail.com>
encukou added a commit that referenced this pull request Aug 22, 2023
…7846) (GH-108209)

gh-107845: Fix symlink handling for tarfile.data_filter (GH-107846)

(cherry picked from commit acbd3f9)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Lumír 'Frenzy' Balhar <frenzy.madness@gmail.com>
encukou added a commit to encukou/cpython that referenced this pull request Aug 22, 2023
…ythonGH-107846) (pythonGH-108209)

pythongh-107845: Fix symlink handling for tarfile.data_filter (pythonGH-107846)

(cherry picked from commit acbd3f9)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Lumír 'Frenzy' Balhar <frenzy.madness@gmail.com>
@bedevere-bot
Copy link

GH-108274 is a backport of this pull request to the 3.9 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Aug 22, 2023
encukou added a commit to encukou/cpython that referenced this pull request Aug 22, 2023
…ythonGH-107846) (pythonGH-108209)

pythongh-107845: Fix symlink handling for tarfile.data_filter (pythonGH-107846)

(cherry picked from commit acbd3f9)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Lumír 'Frenzy' Balhar <frenzy.madness@gmail.com>
@bedevere-bot
Copy link

GH-108279 is a backport of this pull request to the 3.8 branch.

encukou added a commit to encukou/cpython that referenced this pull request Aug 22, 2023
…ythonGH-107846) (pythonGH-108209)

pythongh-107845: Fix symlink handling for tarfile.data_filter (pythonGH-107846)

(cherry picked from commit acbd3f9)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Lumír 'Frenzy' Balhar <frenzy.madness@gmail.com>
encukou added a commit to encukou/cpython that referenced this pull request Aug 22, 2023
…ythonGH-107846) (pythonGH-108209)

pythongh-107845: Fix symlink handling for tarfile.data_filter (pythonGH-107846)

(cherry picked from commit acbd3f9)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Lumír 'Frenzy' Balhar <frenzy.madness@gmail.com>
ambv pushed a commit that referenced this pull request Aug 22, 2023
) (#108274)

(cherry picked from commit acbd3f9)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Lumír 'Frenzy' Balhar <frenzy.madness@gmail.com>
ambv pushed a commit that referenced this pull request Aug 22, 2023
) (#108279)

(cherry picked from commit acbd3f9)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Lumír 'Frenzy' Balhar <frenzy.madness@gmail.com>
carlosroman pushed a commit to DataDog/cpython that referenced this pull request Oct 11, 2023
…ythonGH-107846) (python#108274)

(cherry picked from commit acbd3f9)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Lumír 'Frenzy' Balhar <frenzy.madness@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants