Today in POSIX surprises: `ln -f` is not *quite* atomic due to the combined semantics of link() and rename(); it racily uses a temp file and if the stars align might unlink() an identially-named temp file created by another process.
-
-
Replying to @marcan42
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
1 reply 0 retweets 4 likes -
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
1 reply 0 retweets 0 likes -
but nothing ever seeded the RNG mkstemp() used, and closing the file and reopening it left a brief window during which another ar instance could land on the same temp file, which regularly resulted in corruption and build failures until I tracked down a patch fixing the issue
1 reply 0 retweets 3 likes
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.