Jim Meyering <[EMAIL PROTECTED]> writes:

> By the way, I've just realized that it *is* possible to implement these
> mkdir-like functions in a thread-safe manner (i.e. traversing via openat,
> operating on files via mkdirat, chmodat, etc.), while remaining efficient
> (O(n)).  The only assumption is that the target directory name does not
> contain too long a sequence of existing unreadable directories (sum
> of length of names + slashes > PATH_MAX).

I initially tried something like that, but got too confused by it,
perhaps partly because I wanted to fall back on something like the
current approach when mkdirat didn't work (which is a common case
these days, even on GNU/Linux systems, alas).

The current code is still too complicated for my taste -- I'd be quite
surprised if it were bug-free.  I considered ripping out the
open(".")/fchdir part of the code, since it's simpler if you assume
that you _always_ create a subprocess, but decided that in this case
simplicity had to yield to performance.

> One nit:

Thanks for catching that.  I fixed it and installed the result.


_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to