[Unison-hackers] move instead of copy

Hadmut Danisch hadmut at danisch.de
Wed Sep 16 17:44:21 EDT 2015



On 15.09.2015 23:51, Julian Squires wrote:
> At least in the case of Posix systems, couldn't one rename(2) and if
> it fails with EXDEV, then fall back to copy-and-delete?

Well, you could stat (2) the source file and the target directory and
compare st_dev, and try the move only if equal, i.e. both on the same
file system. (needs to be verified for nested file systems in zfs or
btrfs).


Another option would be to make a hard link and then remove, but I would
not do this since it is not atomar and could cause race conditions.

regards
Hadmut



More information about the Unison-hackers mailing list