Bug 373100 - Deleting duplicate image in "Find duplicates" removes all other found duplicates
Summary: Deleting duplicate image in "Find duplicates" removes all other found duplicates
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Searches-Similarity (show other bugs)
Version: 5.4.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-30 07:21 UTC by Kristian Karl
Modified: 2016-11-30 21:02 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.4.0


Attachments
Screenshot (120.45 KB, image/png)
2016-11-30 07:21 UTC, Kristian Karl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kristian Karl 2016-11-30 07:21:20 UTC
Created attachment 102537 [details]
Screenshot

When removing a duplicate image, all other found duplicates are removed.

1) Create a folder 'bug_test'.
2) In folder 'bug_test', put some images in there. (I used these: http://snippets.khromov.se/wp-content/uploads/2013/08/stock_pictures_from_morguefile.zip from: https://snippets.khromov.se/stock-photo-archive-zip-77-images/
3) In folder 'bug_test', create another folder called 'dupes'. Copy some images from step 2) and put them into 'bug_test'.
4) Start digikam in folder 'bug_test': 'digikam --database-directory .'
5) Add folder 'bug_test' as a collection.
6) Open view 'Fuzzy'
7) In tab 'Duplicates' do 'Update fingerprints'.
8) Set 'Similarity range:' to from 100% to 100%.
9) Click button 'Find duplicates'
10) When done, select the first pair of duplicates in the list to the left.
11) Delete one of the duplicate in the view to the right.

Expected result
===============
The selected image to be deleted, was deleted. The pair of duplicates in the list to the left is removed from the list of duplicates.

Actual result
=============
The selected image to be deleted, was deleted. But, all items in the list to the left was removed. The list of duplicates was cleared.

Additional info
===============
I compiled from sources. Source is the master branch latest commit from core: 88e7d6fef15790d3588c6d9307e9fe45104ba778
I tested this on an Linux KDE Neon desktop machine.

This was perpahs a wall of text, so I added a screenshot as well :-)
Comment 1 Kristian Karl 2016-11-30 07:23:07 UTC
I noticed afterwards that step 8) is not necessary.
Comment 2 Mario Frank 2016-11-30 07:52:00 UTC
(In reply to Kristian Karl from comment #1)
> I noticed afterwards that step 8) is not necessary.

Hi,

I stumbled over this one yesterday, too. This dysfunction was not present before.
Will trace it today. The other duplicate albums are cleared since when the image is deleted, a rescan of duplicates is done. What I found is that if you apply your steps, you should see a progress bar which does not increase its value. Can you confirm this?
Comment 3 Simon 2016-11-30 08:25:52 UTC
Hi Frank,

Why do you want to rescan on a delete? This is extremely time consuming when the duplicate search is done over a big amount of pictures. The expected result described by Kristian would be sane, i.e. just remove the item that is no longer a duplicate, but leave everything else (or even leave everything, having a "duplicate" group with just one picture is ok when the second picture was removed manually).
Comment 4 Mario Frank 2016-11-30 09:19:47 UTC
(In reply to Simon from comment #3)
> Hi Frank,
> 
> Why do you want to rescan on a delete? This is extremely time consuming when
> the duplicate search is done over a big amount of pictures. The expected
> result described by Kristian would be sane, i.e. just remove the item that
> is no longer a duplicate, but leave everything else (or even leave
> everything, having a "duplicate" group with just one picture is ok when the
> second picture was removed manually).

Hi Simon,
a rescan is necessary since the deleted picture may be present in other SAlbums than the one where the image was deleted from. Moreover, the patch fixed the bug where the duplicates count was not reduced by deletion. And I would never do a complete rescan. This would really be time consuming and insane. A rescan is only done over the pictures of the SAlbums that were modified by the deletion. And this usually involves only few pictures. A rescan over 20 images is done really fast. In fact, leaving a stale SAlbum with only one picture may be really bad user experience if you really do scan in a big album. As user, you would expect to only see duplicates.
There was a quite longish discussion in https://bugs.kde.org/show_bug.cgi?id=261417 about this topic.
Comment 5 Mario Frank 2016-11-30 10:59:55 UTC
I could confirm the problem.
Comment 6 Mario Frank 2016-11-30 11:09:33 UTC
Okay, I found the evil guy. Some small bug. Will fix that today.
Comment 7 Mario Frank 2016-11-30 14:15:45 UTC
Git commit 1a1583d2fded99bdee3a0c9be77498649e721db3 by Mario Frank.
Committed on 30/11/2016 at 12:23.
Pushed by mfrank into branch 'master'.

The set of images to rescan was empty due to erroneously using intersect instead of intersects.
Thus, no images were present and the duplicates search ended prematurely and the search result
pane was empty.
FIXED-IN: 5.4.0

M  +5   -7    libs/album/albummanager.cpp

M  +5    -7    libs/album/albummanager.cpp

https://commits.kde.org/digikam/1a1583d2fded99bdee3a0c9be77498649e721db3
Comment 8 Kristian Karl 2016-11-30 21:02:29 UTC
I can confirm that the fix works.
Thanks for the quick fix!