|
2026-10-21
| ||
| 10:03 | • Closed ticket [2406596fff]: file delete reports an error on non-existent file</i... artifact: 83e45c63fb user: serhiy.storchaka | |
|
2018-07-09
| ||
| 13:16 | • Closed ticket [270f78ca95]: mkdir failing when running on parallel on nfs pl... artifact: 973a9279ee user: sebres | |
|
2018-04-30
| ||
| 11:10 | merge fix-1613456fff, closes [1613456fffffffff] and [27b682284974d0cd] check-in: 92c4bfbe32 user: sebres tags: core-8-5-branch | |
|
2018-04-09
| ||
| 10:12 | • Ticket [27b6822849] file delete can return an error if file was already deleted<... artifact: 2de79b4b2f user: sebres | |
|
2018-04-06
| ||
| 18:44 | • Ticket [27b6822849]: 5 changes artifact: b092b10dd2 user: raimue | |
| 17:37 | • Closed ticket [27b6822849]. artifact: fa3b191db7 user: sebres | |
| 17:28 | [27b682284974d0cd] command "file delete": avoid possible race condition if file/directory deleted af... check-in: 5acb57c7ae user: sebres tags: fix-1613456fff | |
| 14:05 | • Add attachment file-delete-racecond.diff to ticket [27b682284974d0cd|27... artifact: 51168879d0 user: raimue | |
| 14:05 | • New ticket [27b6822849] file delete can return an error if file was already dele... artifact: 59328670a3 user: raimue | |
| Ticket UUID: | 27b682284974d0cdf4686f31adcb9ee39a0befa6 | ||
| Title: | file delete can return an error if file was already deleted | ||
| Type: | Bug | Created on: | 2018-04-06 14:05:10 |
| Submitter: | raimue | Assigned to: | nobody |
| Subsystem: | 37. File System | Severity: | Severe |
| Priority: | 5 Medium | Last modified: | 2018-04-09 10:12:02 |
| Status: | Closed | Closed by: | sebres |
| Resolution: | Fixed | Closed on: | 2018-04-09 10:12:02 |
| Version: | 8.5 | ||
| Description: | ||||
The 'file delete' command can fail with "no such file or directory", but it is supposed to return successfully in this case. This can happen when another process removes the file exactly between the system calls to stat(2) and unlink(2) in TclFileDeleteCmd(), which is a classic TOCTTOU race condition. I will attach a patch that adds an additional check for the result of Tcl_FSDeleteFile() and if it was ENOENT, the command is considered successful. | ||||
| User Comments: | ||||
sebres added on 2018-04-06 17:37:45:
I've fixed it in [5acb57c7aec45e05] (although other 8.5th branch, but if not whole accepted this commit can be easy cherry-picked into core-8-5-branch). Deviations from suggested patch: I've rewritten it also to catch the same race-condition in case of deleted directory. Thanks you Rainer. raimue added on 2018-04-06 18:44:52:
Thank you for the quick response. Applying the same change to directories makes sense, it just did not occur to me. Looking at the patch, I see you removed result = TCL_ERROR; before the break statement, but I think this was actually needed as Tcl_FSRemoveDirectory() and Tcl_FSDeleteFile() return -1 on error. sebres added on 2018-04-09 10:12:02:
I was confused by the comment header of both. Corresponding it Tcl_FSDeleteFile as well as Tcl_FSRemoveDirectory returns "Standard Tcl error code" (what is indeed wrong). So fixed now in [6627aeef8ecda182] for TclFileDeleteCmd. But I guess we have to fix all the comments "Returns" in tclIOUtil.c. | ||||
Attachments:
- file-delete-racecond.diff [download] added by raimue on 2018-04-06 14:05:33. [details]
