911d380296
Extracted from #54314 (@flag0x369), re-derived onto current main: macOS ships bash 3.2 as /bin/bash, which lacks $BASHPID entirely — the variable expands to empty string, collapsing every concurrent writer's 'unique' temp path onto the same file (torn snapshot writes under concurrency). mktemp allocates per-writer unique paths portably. Live-verified: /bin/bash -c 'echo $BASHPID' prints empty on this box.