mv(1) may delete more than it should
Bug #48066 reported by
Johan Kiviniemi
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
coreutils |
New
|
Undecided
|
Unassigned | ||
coreutils (Ubuntu) |
Confirmed
|
Wishlist
|
Unassigned |
Bug Description
1) mv huge_directory /nfs_mountpoint
2) During the transfer, mv other_directory huge_directory
3) After the first mv process has completed, it removes huge_directory, including huge_directory/
Expected result:
3) After the first mv process has completed, it should print "Cannot delete huge_directory: directory not empty". The remaining huge_directory should only contain other_directory.
The target doesn't need to be a NFS mountpoint. One was only used as an example.
To post a comment you must log in.
This has been the behaviour of mv since it supported migration between filesystems. Until this is addressed, a simple workaround is to always use `mkdir nfsmountpoint/ huge_directory; mv huge_directory/* /nfs_mountpoint /huge_directory ` to be sure of allowing additional files to be copied to the directory during the move operation.