4 ms·
The kernel has to resolve the symbolic link - /bin/mv should not try because it cannot do so without a race.
by caf 11y ago
The kernel has to resolve the symbolic link - /bin/mv should not try because it cannot do so without a race.
- anon4 11y agoPresuming 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.