coreutils
[Top][All Lists]
Advanced

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

Re: mkdir -p competition on the same directory?


From: Chet Ramey
Subject: Re: mkdir -p competition on the same directory?
Date: Thu, 9 Feb 2023 14:57:55 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.7.1

On 2/9/23 12:11 PM, Rob Landley wrote:

Therefore, when there is competition among many calls to coreutils
`mkdir -p`. The first instance will create the target, and the rest
instances will fail on the system call of mkdir. But since they find
the target is already created and is a directory, they will not
complain about the error system call mkdir. That is why I never see an
error similar to that of bash loadable `mkdir -p`. Is it so?

Right. That suggests a bug in the bash loadable,
as it should not fail in this case.

Which would be a question for bash's maintainer, not coreutils. :)

It's a question of how you deal with the race condition in the original
script. Do you check first, then mkdir (bash loadable), or mkdir, then
check failure (coreutils)? There's a race condition with either approach.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/




reply via email to

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