3 ms·
I am not sure what TTCTTOU is, but what you are saying needs transaction like semantics in filesystems. So its more of a property of an FS instead of a language
by sudeepj 6y ago
I am not sure what TTCTTOU is, but what you are saying needs transaction like semantics in filesystems. So its more of a property of an FS instead of a language.
All the common FS (in linux .. ext* xfs) do not have that these.
- merrywhether 6y ago“time to check to time to use” As you intuited, a problem that arises in environments that lack transactions/locks/etc
- Iwan-Zotow 6y ago> All the common FS (in linux .. ext* xfs) do not have that these You know that files are nameless on Unix, right?
- sudeepj 6y ago> do not have that these I was referring to the transaction semantics
- Iwan-Zotow 6y ago> let f = File::open("username.txt"); > /what if the file is deleted here?/ you don't need transaction semantics here. On Unix file is basically inode with counter. If it doesn't have record (aka name) in directory but non-zero counter, it would exist. So on open(2) counter is bumped up and is equal to 2 (or higher if there are hardlinks), one for the directory record and one for program running it. If you remove record from directory (aka `rm filename`), counter would decrease by 1, but it is still non-zero, program still has it open, could read its content, etc. Only after close(2) counter would decrease to 0 and file would be gone. Just tested it on Ubuntu 20.4 with simple C program