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: Mon, 13 Feb 2023 09:17:59 -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 4:30 PM, Pádraig Brady wrote:

In this case coreutils tries the mkdir() and handles exceptions.

   if mkdir(d) == EEXIST
     return stat(d) == S_ISDIR

I see the bash example mkdir loadable here:
http://git.savannah.gnu.org/gitweb/?p=bash.git;a=blob;f=examples/loadables/mkdir.c
The final stat/mkdir call looks like the following,
and could possibly be adjusted to the pattern above?

Sure, that's not unreasonable. I'll see what I can do.

Also worth noting that using a mkdir loadable for speed
should be carefully considered, as mkdir isn't a trivial
operation wrt cross platform issues, permissions,
and SELinux contexts etc.

I'm pretty sure the bash loadable implements the POSIX mkdir as specified.

Chet
--
``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]