Sounds like a TOCTTOU waiting to happen
-
-
-
Predicting the filename is not terribly likely (it seems to use entropy from urandom). Just one of those "might break a production system somewhere some day when the stars align" things.
- Show replies
New conversation -
-
-
I've been repeatedly surprised by the number of colleagues who believe that link(2) and/or symlink(2) will atomically overwrite an existing file, without needing to unlink(2) the target and thus open the attendant race condition.
-
Well you can rename() over the target, and that works perfectly well for symlinks. The problem is that rename() has a stupidly defined corner case where it returns *successfully* and yet *does nothing* when both sides are the same inode. And that opens up another race.
- Show replies
New conversation -
-
-
there's a weird cheat in GNU land using ln and mv to do atomic replacement. I can never tell where it's used.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
It seems like Unix system calls are full of this kind of terrible design overall, and the POSIX spec has a lot of skeletons in its closet :(
-
Not helped by all the people who think POSIX is God's gift to the world and shouldn't be changed/should be changed as little as possible
End of conversation
New conversation -
-
-
did I ever tell you about the time when MinGW's ld could (and regularly did) have temp filename collisions with another ld executing in the same directory at the same time
-
oh actually it was ar, not ld: basically their implementation of mkstemp() would call _open() with _O_TEMPORARY, which is the "delete on close" flag; ar then close()s the fd it gets from mktemp() and reopens the path with different flags
- Show replies
New conversation -
-
-
UNIX has a lot of BS like this that make it unreliable sometimes.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.