4 ms·
Presuming that you wouldn't invoke mv nanoseconds before creating the symlink, I think mv should resolve the symlink first and, if the move doesn't make sense,
by anon4 11y ago
Presuming that you wouldn't invoke mv nanoseconds before creating the symlink, I think mv should resolve the symlink first and, if the move doesn't make sense, abort. It will still need to handle the case where it looks like the move makes sense, but the kernel returns EINVAL or whatever.
- cbr 11y ago> Presuming that you wouldn't invoke mv nanoseconds before creating the symlink This kind of thinking has led to lots of security bugs around symlinks.
- mh- 11y agoindeed, and not just symlinks. being vigilant about not creating unnecessary race conditions is important. doubly so when you're building a tool upon which others will compose their own programs/scripts/etc.