1
0
Fork 0
mirror of synced 2024-05-06 21:42:42 +12:00
czkawka/czkawka_core/src
Thomas Andreas Jung 03d41e173f
Keep original file if replacing duplicate with hardlink fails (#253)
If the user could not create a hard link (due to permissions or
different block devices) then czkawka lost the duplicate file.

```
$ mkdir hardlink
$ cd hardlink
$ echo a > a
$ cp a b
$ chown thetestuser:thetestuser a
$ ls -il .

25169246 -rw-rw-r-- 1 thetestuser thetestuser 2 Feb  7 11:18 a
25169641 -rw-rw-r-- 1 thomas      thomas      2 Feb  7 11:18 b

$ cargo run --bin czkawka_cli dup --directories $(pwd) -m 1 -f
test101.result --delete-method HARD

[...]
-------------------------------WARNINGS--------------------------------
Failed to link /home/thomas/Development/czkawka/hardlink/b ->
/home/thomas/Development/czkawka/hardlink/a
---------------------------END OF WARNINGS-----------------------------

$ ls -il .
25169246 -rw-rw-r-- 1 thetestuser thetestuser 2 Feb  7 11:18 a
```

Now czkawka keeps all files and the warning provides more information
why czkawka can't replace the duplicate with a hard link.

```
$ cargo run --bin czkawka_cli dup --directories $(pwd) -m 1 -f
test101.result --delete-method HARD

-------------------------------WARNINGS--------------------------------
Failed to link /home/thomas/Development/czkawka/hardlink/b ->
/home/thomas/Development/czkawka/hardlink/a (Operation not permitted (os
error 1))
---------------------------END OF WARNINGS-----------------------------
[...]

25169246 -rw-rw-r-- 1 thetestuser thetestuser 2 Feb  7 11:18 a
25169641 -rw-rw-r-- 1 thomas      thomas      2 Feb  7 11:18 b
```
2021-02-11 19:04:23 +01:00
..
big_file.rs Fix included/excluded files which contains commas (#195) 2021-01-10 20:44:10 +01:00
broken_files.rs Update list of checked images (#252) 2021-02-06 14:24:15 +01:00
common.rs Adds Mac GUI (#160) 2020-12-31 19:53:49 +01:00
common_directory.rs Fix included/excluded files which contains commas (#195) 2021-01-10 20:44:10 +01:00
common_extensions.rs Add cache for broken files (#204) 2021-01-13 16:03:05 +01:00
common_items.rs Fix included/excluded files which contains commas (#195) 2021-01-10 20:44:10 +01:00
common_messages.rs Improve code quality. (#52) 2020-10-09 22:32:08 +02:00
common_traits.rs Big code refactoring 2020-09-26 16:52:13 +02:00
duplicate.rs Keep original file if replacing duplicate with hardlink fails (#253) 2021-02-11 19:04:23 +01:00
empty_files.rs Fix included/excluded files which contains commas (#195) 2021-01-10 20:44:10 +01:00
empty_folder.rs Fix included/excluded files which contains commas (#195) 2021-01-10 20:44:10 +01:00
invalid_symlinks.rs Fix included/excluded files which contains commas (#195) 2021-01-10 20:44:10 +01:00
lib.rs Add broken files support (#202) 2021-01-12 20:06:12 +01:00
same_music.rs Decrease ram usage (#212) 2021-01-15 12:41:45 +01:00
similar_images.rs Uncomment code about saving similar images result to file 2021-02-09 17:29:49 +01:00
temporary.rs Fix included/excluded files which contains commas (#195) 2021-01-10 20:44:10 +01:00
zeroed.rs Decrease ram usage (#212) 2021-01-15 12:41:45 +01:00