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-29612 : Fix hard link creation in tar extraction when it points to themselves #5753
Conversation
5aa1a9f
to
bb9e23c
Compare
Lib/tarfile.py
Outdated
| @@ -2272,6 +2272,13 @@ def makelink(self, tarinfo, targetpath): | |||
| (platform limitation), we try to make a copy of the referenced file | |||
| instead of a link. | |||
| """ | |||
| # do not create link if target path is equals to link target | |||
| if ( | |||
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.
could you use the PEP8 style for the condition?
for example
if hasattr(tarinfo, "_link_target") and tarinfo._link_target == targetpath: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.
The line is 83 characters long if I do not split it into two lines.
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.
The preferred way to split it is as follows:
if hasattr(tarinfo, "_link_target") and \
tarinfo._link_target == targetpath:
|
done When I do not split the condition into two lines, the result is 83 characters long, which is not pep8 right ? |
|
@j0ack not necessarily, the max length can be between 80 and 100, check the PEP8 https://www.python.org/dev/peps/pep-0008/#maximum-line-length |
|
That document says:
So, yes, 83 characters is too long. |
|
That's the reason why I splitted my condition into two lines. Let me know if I need to revert to my previous commit I can reduce the line length with getattr default parameter |
39194c2
to
f4eb463
Compare
|
Travis seems to fail on |
…7968) test_mymanager_context() now also accepts -SIGTERM as an expected exitcode for the manager process. The process is killed with SIGTERM if it takes longer than 1 second to stop.
bpo-30339, bpo-33913: * Increase timeout from 10 seconds to 1 minute in test_source_main_skipped_in_children source of test_multiprocessing_main_handling. * Replace time.time() with time.monotonic(). * On timeout, include the duration in the error message.
Increase timeouts from 10 seconds to 1 minute.
Rephrase it to "It raises a `ValueError`"
Some MacOS-tk combinations need .update_idletasks(). The call is both unneeded and innocuous on Linux and Windows. Patch by Kevin Waltzer.
Remove unnecessary "that" in the sentence.
sys_setcheckinterval() now uses a local variable to parse arguments, before writing into interp->check_interval.
…'t support them. (pythonGH-8656) When the filesystem doesn't support files with large timestamps, skip testing that such files can be zipped.
…GH-8658) If coerce_c_locale is already set (>= 0), use its value: don't override it.
bpo-34170, bpo-34326: Fix pymain_run_file(): use PyRun_AnyFileExFlags(closeit=1) instead of calling fclose(fp) explicitly to close the input file before running the code.
…sts (pythonGH-7683) * make CallTip and ToolTip sub-classes of a common abstract base class * remove ListboxToolTip (unused and ugly) * greatly increase test coverage * tested on Windows, Linux and macOS
* bpo-34273: Change 'Fixed point' to 'Fixed-point notation'. The change in the mini language floating point and decimal table is consistent with 'Exponential notation' and clarifies that we are referring to the output notation, not an object type. * Update string.rst * Update string.rst * Update string.rst * Update string.rst
|
@j0ack will try to commit this to master first then backport it to 2.7. |
|
See #8700 |
When creating a link from a tarball, if the link target and the file has the same path it raised an exception.
We simply ignore this case at the beginning of the method.
https://bugs.python.org/issue29612