bpo-29694: race condition in pathlib mkdir with flags parents=True by arigo · Pull Request #1089 · python/cpython (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation11 Commits4 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

arigo

@arigo

@the-knights-who-say-ni

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA. This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

Thanks again to your contribution and we look forward to looking at it!

@arigo arigo changed the titleIssue #29694: race condition in pathlib mkdir with flags parents=True bpo-29694: race condition in pathlib mkdir with flags parents=True

Apr 12, 2017

serhiy-storchaka

got_exception = False
except FileExistsError:
got_exception = True
self.assertEqual(str(p12) in concurrently_created, got_exception)

Choose a reason for hiding this comment

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

assertIn()/assertNotIn()? This will give more information in the case of failure.

try:
    ...
except FileExistsError:
    self.assertIn(str(p12), concurrently_created)
else:
    self.assertNotIn(str(p12), concurrently_created)
os.mkdir(path, mode) # from another process
concurrently_created.add(path)
os.mkdir(path, mode) # our real call
org_mkdir = pathlib._normal_accessor.mkdir

Choose a reason for hiding this comment

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

Seems this is not used.

@@ -306,6 +306,9 @@ Extension Modules
Library
-------
- bpo-29694: race condition in pathlib mkdir with flags parents=True

Choose a reason for hiding this comment

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

Add "Fixed" at the start, add a period at the end.

@serhiy-storchaka

In general LGTM, just few minor comments.

@arigo

serhiy-storchaka

Choose a reason for hiding this comment

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

LGTM.

berkerpeksag

# just before we try to create it ourselves. We do it
# in all possible pattern combinations, assuming that this
# function is called at most 5 times (dirCPC/dir1/dir2,
# dirCPC/dir1, dirCPC, dirCPC/dir1, cirCPC/dir1/dir2).

Choose a reason for hiding this comment

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

cirCPC looks like a typo here.

@@ -306,6 +306,10 @@ Extension Modules
Library
-------
- bpo-29694: Fixed race condition in pathlib mkdir with flags
parents=True.

Choose a reason for hiding this comment

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

You can also add "Patch by Armin Rigo.".

Choose a reason for hiding this comment

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

Since Armin is a core developer and will merge the PR himself this is not necessary.

@arigo

@arigo

I may be a core developer but nowadays I'd call this "historical reasons". I didn't commit anything for ages. Please merge this for me.

@Mariatta

@Mariatta

I updated Misc/NEWS. I will merge and backport once travis CI is completed.
Thanks :)

Mariatta pushed a commit to Mariatta/cpython that referenced this pull request

Apr 14, 2017

@arigo @Mariatta

Mariatta pushed a commit to Mariatta/cpython that referenced this pull request

Apr 14, 2017

@arigo @Mariatta

Mariatta added a commit that referenced this pull request

Apr 14, 2017

@Mariatta

Mariatta added a commit that referenced this pull request

Apr 14, 2017

@Mariatta

Labels

type-bug

An unexpected behavior, bug, or error