-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
bpo-21987: fix TarFile.getmember getting a dir with a trailing slash #30283
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
bpo-21987: fix TarFile.getmember getting a dir with a trailing slash #30283
Conversation
Lib/test/test_tarfile.py
Outdated
self.add_dir_and_getmember('a'*101) | ||
|
||
def add_dir_and_getmember(self, name): | ||
tar = tarfile.open(tmpname, 'w') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use context managers.
You can use temp_cwd()
and temp_dir()
from test.support.os_helper
for creating temporary dirs.
Lib/test/test_tarfile.py
Outdated
tar.getmember(name) | ||
tar.getmember(name + '/') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe test that these two return the same info.
Thanks @akulakov for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10. |
…ythonGH-30283) (cherry picked from commit cfadcc3) Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
GH-30737 is a backport of this pull request to the 3.10 branch. |
…ythonGH-30283) (cherry picked from commit cfadcc3) Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
GH-30738 is a backport of this pull request to the 3.9 branch. |
Serhiy and Jelle, thanks for reviewing! |
…slash (pythonGH-30283) (pythonGH-30738) (cherry picked from commit cfadcc3) Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
https://bugs.python.org/issue21987
Co-authored with Matt Behrens