in reply to Re: Safely create new directory
in thread Safely create new directory

Thanks all!

Together with the other information in this thread that mkdir is in fact atomic this will do.

Replies are listed 'Best First'.
Re^3: Safely create new directory
by BrowserUk (Patriarch) on Jul 26, 2012 at 14:51 UTC
    nformation in this thread that mkdir is in fact atomic

    I don't believe that atomicity of mkdir was ever in doubt as far as local filesystems are concerned.

    The question, I thought, was about whether it remained atomic for NFS mounted directories.

    My point in posting was -- on ancient HP/UX, where mkdir was tested and found atomic on NFS-mounted drives -- not just that that simple form of loop was sufficient to obtain a unique directory, but actually that it is far more likely to be reliable than the two-stage mechanisms that create files first, then directories.

    Tendered with the clear caveat of the ancient state of my knowledge, I fail to see that creating a file -- just another name in the directory space -- is any more likely to be atomic than creating a directory.

    But ... that is based on logic alone; not current, OS-specific knowledge.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?