infra
infra copied to clipboard
fix(envd): handle TOCTOU race in EnsureDirs mkdir
Summary
- Fix TOCTOU race condition in
EnsureDirswhere two concurrent calls both see a directory as non-existent viaos.Stat(), both callos.Mkdir(), and the second fails with "file exists" - Ignore
os.IsExisterrors fromos.Mkdirso concurrent directory creation is safe
Test plan
- [ ] Verify
go build ./...passes for envd package - [ ] Verify existing tests pass:
go test ./internal/permissions/...
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. Credits must be used to enable repository wide code reviews.