[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mkdir -p competition on the same directory?
From: |
Rob Landley |
Subject: |
Re: mkdir -p competition on the same directory? |
Date: |
Thu, 9 Feb 2023 11:11:47 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 |
On 2/9/23 10:33, Pádraig Brady wrote:
> On 09/02/2023 16:28, Peng Yu wrote:
>> OK.
>>
>> I see the following output of `sudo dtruss mkdir -p d`. So
>> essentially, coreutils first calls system function mkdir to make the
>> directory. On error of the system call, it will check the target is a
>> directory. If the target is indeed a directory, then no error message
>> will be printed. Do I understand it correctly?
>>
>> ...
>> mkdir("d\0", 0x1FF, 0x0) = -1 Err#17
>> stat64("d\0", 0x7FFEE9953D20, 0x0) = 0 0
>> ...
>>
>> 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. :)
Rob