Everything is part of your interface, mkdir edition: if mkdir (the program) races with something else on the directory creation (starts out with the directory not there, both do mkdir(2)), Coreutils mkdir apparently exits status 1 while the Ubuntu 26.04 Rust uutils mkdir exits status 0 even after its mkdir(2) fails because hey, the directory's there. OpenZFS's test suite turned out to depend on the Coreutils behavior.
0 Boosts
0 Likes
@cks Seems a bit strange, POSIX-wise mkdir -p should exit successfully on EEXIST, while without it seems undefined (see exit status section of mkdir(1)).
And without the -p option, mkdir(1) is stuck to being racy anyway and typically exits unsuccessfully when anything already exists.
POSIX/SUS seems to be unambiguous that if you mkdir with the directory already existing at the start, mkdir exits status 1 (and 26.04 Rust uutils does). But a race while mkdir is running is something you can argue about even within the POSIX specifications language, at least as far as I can see.
Interested parties can peruse the relevant SUS page and argue about it: https://pubs.opengroup.org/onlinepubs/9799919799/
The Open Group Base Specifications Issue 8