help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: can't always get make to auto create build directory


From: David Boyce
Subject: Re: can't always get make to auto create build directory
Date: Wed, 29 Jun 2016 20:24:47 -0700

On Wed, Jun 29, 2016 at 7:53 PM, Paul Smith <address@hidden> wrote:

> Not only is there no value in it, it's actually LESS robust to make the
> check because between the time make checks for the directory and the
> time it runs "mkdir", some other program could have created it.


To be painfully precise, the same race condition exists with and without
the explicit check because mkdir -p does the same check+create internally.
The only difference is the width of the race window; internally to mkdir
the window is between two system calls (stat() and mkdir()) whereas with
the explicit check there's a fork/exec interposed which is much wider.
There's always a race when mkdir -p is used.

-David


reply via email to

[Prev in Thread] Current Thread [Next in Thread]