Summary
create-temporary-file and create-temporary-directory are subject to race conditions
Metadata
- Id: f598bc17026468d3b75cbe36589b2f0321f72fa1
- Trac id: 1146
- Type: defect
- Reporter: mario
- Owner:
- Cc:
- Status: new
- Component: core libraries
- Estimated difficulty: medium
- Resolution:
- Priority: major
- Milestone: 6.0.0
- Version: 4.10.x
- Changetime: 2023-11-07 00:23:48 UTC
- Created: 2014-08-05 16:46:58 UTC
- Keywords: create-temporary-file, create-temporary-directory
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.