https://bugs.kde.org/show_bug.cgi?id=528918

            Bug ID: 528918
           Summary: Files can be silently overwritten when moving them in
                    the similarity search view
    Classification: Applications
           Product: digikam
      Version First 9.1.0
       Reported In:
          Platform: Microsoft Windows
                OS: Microsoft Windows
            Status: REPORTED
          Severity: grave
          Priority: NOR
         Component: Searches-Similarity
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

DESCRIPTION
Moving 2 files (same name, different folders) at the same time to a third
location can silently lose one of the files. I encountered this a few times
when using the similarity search result view UI.

(I used chatgpt to generate the steps to reproduce, they look identical to what
I experienced with using the GUI during my work.)
STEPS TO REPRODUCE
1. Create three albums named `A`, `B`, and `C` in a disposable collection. Use
three copies of the same JPEG with distinct JPEG comments so the decoded pixels
match and each file has a different SHA-256 hash. Keep the originals outside
the test collection.
2. Put the files at `A/photo.jpg`, `B/photo.jpg`, and `C/reference.jpg`. Start
with no `C/photo.jpg`, `C/photo_v1.jpg`, groups, or sidecars.
3. In **Similarity → Duplicates**, search across the three albums with **Limit
Search to** set to **None**. Update fingerprints if needed. Open the result
that contains the three copies.
4. Select only the files from `A` and `B`. Choose **Move to Album…** and select
`C`. Dragging the same selection onto album `C` and choosing **Move Here**
reaches the same move implementation.
5. When the job finishes, compare the on-disk files with the original hashes. 

OBSERVED RESULT
Both source paths disappeared and `C/photo.jpg` contained only one input’s
bytes in 11 of 12 trials. `C/reference.jpg` retained its bytes. The source
shows why the GUI would skip the prompt for this setup. It compares the
incoming filenames with the initial contents of `C`. The two workers can then
pass identical destination-existence checks before either creates the file.
This path bypasses digiKam’s collection trash.

EXPECTED RESULT
digiKam detects that both incoming images need `C/photo.jpg` and lets the user
resolve the conflict before either image is lost. Keeping both should produce
two files with distinct names and preserve both input hashes.

## When the third copy is also named `photo.jpg`

Start over with `C/photo.jpg` in place of `C/reference.jpg`, leaving
`C/photo_v1.jpg` absent. Select the same two inputs from `A` and `B` and move
them into `C`. The existing file should trigger **File Conflict**. Choose
**Rename Automatically**. In 12 of 12 worker trials, `C/photo.jpg` retained its
original bytes, both source paths disappeared, and only one incoming payload
survived at `C/photo_v1.jpg`. The two workers can select the same available
suffix. In the **Skip Automatically** control, the destination and both source
files survived.

SOFTWARE/OS VERSIONS
Operating System (available in the Info Center app, or by running `kinfo` in a
terminal window): Windows 11
KDE Plasma Version: ?
KDE Frameworks Version: ?
Qt Version: digiKam-9.1.0-Qt6-Win64.exe

ADDITIONAL INFORMATION

I suspect there are more situtations where this can happen...

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to