Opened 11 years ago
Last modified 2 years ago
#1146 new defect
create-temporary-file and create-temporary-directory are subject to race conditions
| Reported by: | Mario Domenech Goulart | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 6.0.0 |
| Component: | core libraries | Version: | 4.10.x |
| Keywords: | create-temporary-file, create-temporary-directory | Cc: | |
| Estimated difficulty: | medium |
Description (last modified by )
Both use the non-atomic strategy of checking if a file system object exists then act, which may lead to race conditions.
create-temporary-directory is specially more fragile because it uses directory-exists? to check if a file system object exists. So, for example, if a regular file with the same name as the attempted one exists, create-temporary-directory will fail.
Change History (4)
comment:1 by , 11 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 9 years ago
| Estimated difficulty: | → medium |
|---|
comment:3 by , 2 years ago
| Milestone: | someday → 6.0.0 |
|---|
comment:4 by , 2 years ago
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.
Note:
See TracTickets
for help on using tickets.

What would be a suitable approach to make this work?