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

Race condition in os.makedirs #44301

Closed
jbowes mannequin opened this issue Dec 4, 2006 · 3 comments
Closed

Race condition in os.makedirs #44301

jbowes mannequin opened this issue Dec 4, 2006 · 3 comments
Labels
stdlib Python modules in the Lib dir

Comments

@jbowes
Copy link
Mannequin

jbowes mannequin commented Dec 4, 2006

BPO 1608579
Nosy @birkenfeld
Files
  • mkdirs-catch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2006-12-09.09:10:51.000>
    created_at = <Date 2006-12-04.16:52:43.000>
    labels = ['library']
    title = 'Race condition in os.makedirs'
    updated_at = <Date 2006-12-09.09:10:51.000>
    user = 'https://bugs.python.org/jbowes'

    bugs.python.org fields:

    activity = <Date 2006-12-09.09:10:51.000>
    actor = 'georg.brandl'
    assignee = 'none'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2006-12-04.16:52:43.000>
    creator = 'jbowes'
    dependencies = []
    files = ['7638']
    hgrepos = []
    issue_num = 1608579
    keywords = ['patch']
    message_count = 3.0
    messages = ['51471', '51472', '51473']
    nosy_count = 3.0
    nosy_names = ['georg.brandl', 'hanwen', 'jbowes']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1608579'
    versions = []

    @jbowes
    Copy link
    Mannequin Author

    jbowes mannequin commented Dec 4, 2006

    os.makedirs first checks if the non-leaf part of the path exists, and then calls makedirs on this part of the path to create it. If the path is created in between the call to path.exists, and the recursive call to os.makedirs, then os.makedirs will raise an exception.

    The attached patch catches this exception, and then tests if the exception is caused by a the file/directory's existence. If it is, the exception is ignored. If not, it is rasied.

    @jbowes jbowes mannequin closed this as completed Dec 4, 2006
    @jbowes jbowes mannequin added the stdlib Python modules in the Lib dir label Dec 4, 2006
    @jbowes jbowes mannequin closed this as completed Dec 4, 2006
    @jbowes jbowes mannequin added the stdlib Python modules in the Lib dir label Dec 4, 2006
    @hanwen
    Copy link
    Mannequin

    hanwen mannequin commented Dec 5, 2006

    looks good to me.

    @birkenfeld
    Copy link
    Member

    Committed as rev. 52972, 52973 (2.5).

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant