Summary

create-temporary-file and create-temporary-directory are subject to race conditions

Metadata

Description

Both use the non-atomic strategy of checking if a file system object exists then act, which may lead to race conditions.

Changes and comments

[2014-08-05 16:47:21 UTC] mario changed description

[2016-08-25 20:22:22 UTC] sjamaan set difficulty to medium

[2023-11-06 23:50:20 UTC] felix changed milestone from someday to 6.0.0

[2023-11-06 23:50:20 UTC] felix wrote:

What would be a suitable approach to make this work?

[2023-11-07 00:23:48 UTC] wasamasa wrote:

The recommended approach is to remove the check bit and instead handle any error happening during file/directory creation. While it's uglier, it avoids the race condition.