fix bug #51076 (race condition in shtool's mkdir -p)