[issue30400] Race condition in shutil.copyfile()

2017-05-18 Thread Preston Moore
New submission from Preston Moore: A race condition exists in shutil.copyfile() that allows the file being copied to be replaced between the time it was initially checked with stat() in this function and when it is actually open()'d and copied. This issue can be triggered from shutil.move

[issue30400] Race condition in shutil.copyfile()

2017-05-18 Thread Preston Moore
Preston Moore added the comment: It looks like the PR is not passing 3 tests. I think this might be a result of the mock file objects not having inode numbers? Any feedback on this front? -- ___ Python tracker <rep...@bugs.python.org>

[issue30400] Race condition in shutil.copyfile()

2017-06-14 Thread Preston Moore
Preston Moore added the comment: Pull request is now passing with no conflicts. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue30400] Race condition in shutil.copyfile(): source file replaced file during copy

2018-08-13 Thread Preston Moore
Preston Moore added the comment: Hello everyone, I've just updated my pull request to include an additional test so everything should be in shape testing wise. Once I get confirmation that this strategy is acceptable and/or this PR is merged I will get to work addressing the other

[issue30400] Race condition in shutil.copyfile(): source file replaced file during copy

2018-07-23 Thread Preston Moore
Preston Moore added the comment: Hey everyone, I have updated the pull request to include a version of copyfile() that attempts to address the discussed race condition by open()’ing a file descriptor to the relevant files as early as possible and maintaining it throughout processing

[issue30400] Race condition in shutil.copyfile()

2018-07-06 Thread Preston Moore
Preston Moore added the comment: Sure. I'll get everything up to date for 3.8 and create and required test. Thanks! -- ___ Python tracker <https://bugs.python.org/issue30

[issue30400] Race condition in shutil.copyfile(): source file replaced file during copy

2018-07-13 Thread Preston Moore
Preston Moore added the comment: I like Victor's idea for updating public functions to support file descriptors. I could submit a patch for this instead if desired. In the meantime, I've updated the pull request for this issue so the patch I originally created that compares inode numbers