You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] mv of a symlink on a direct bind renames the link's target #386
As in bash: the link is renamed and the file is untouched.
-rw-rw-r-- f
lrwxrwxrwx moved -> f
Actual Behavior
mv exits 0, but it renamed the link's target and left the link dangling:
lrwxrwxrwx lf -> f
-rw-rw-r-- moved
Additional Context
VfsKernel::rename (src/vfs_kernel.rs:727-728) maps both paths with resolve_host, which canonicalizes and so follows a final symlink; std::fs::rename then runs on the target. Same class as #254. Unchanged by #377, which covers lstat, remove_file and remove_dir only. Found while reviewing #377.
A dangling link fails differently: mv /b/dangling x reports "cannot rename between host and virtual filesystem", because resolve_host returns None for it.
Possible Solution
Resolve the source with resolve_host_nofollow (as read_link does since #194) so std::fs::rename gets the link's own path; the destination needs the same treatment when it is an existing link.
Activity