IgnorantGuru / spacefm

SpaceFM File Manager
http://ignorantguru.github.com/spacefm/
GNU General Public License v3.0
490 stars 72 forks source link

copy or move over hard link to same file, destroys both #805

Open db-inf opened 1 year ago

db-inf commented 1 year ago

Say you have a file foo/myfile and a file bar/myfile, which are hard linked to the same inode (e.g. with the command ln foo/myfile bar.). If you mv foo/myfile bar/myfile or cp foo/myfile bar/myfile in a terminal, you get an error message mv: 'foo/myfile' and 'bar/myfile' are the same file, and similarly for the copy.

SpaceFM, either when dragging myfile from foo/ to bar/ (for move, or with [Ctrl] down for copy), or via the clipboard with [Ctrl]+x or [Ctrl]+c followed by [Ctrl]+v, pops up a confirmation dialog, stating that both files are the same size and timestamp, but does not mention they are the same file. If you confirm the move or copy, both foo/myfile and bar/myfile are truncated to 0 bytes.

Note: the tests were performed on a tmpfs file system.