On Mon Mar 17 12:08:08 2025 +0000, Jinoh Kang wrote:
I notice you dropped the fstatat(). It was there to reduce chance for race and/or conflict with accidental leftover tmpnames. If you don't like the fstatat(), we can use `mkdirat( dirfd, tmpname, 0777 )` to atomically probe for existence and create an empty directory that will be replaced by `renameat()`. (Yes, rename(2) replaces empty directories.)
I mean yeah, I didn't really like it, if we're going to do something against TOCTTOU, that fstatat seemed like needless complication since it doesn't *solve* it anyway. But your mkdir idea is great, I didn't even know it works on empty dirs to replace them.
The new version should address all the issues, but if I understand correctly, on filesystems not supporting hardlinks (like FAT32), casefold rename to same file won't work correctly, right?
I mean, it's not that I messed something up, or is it?
(the latest version fails to rename casefold files to same name but different case in FAT32, even *if* in this case it's passed the correct case, so it's not affected by my other MR, but works fine for ext4)