Bug 492163

Summary: Creation of orphan sidecars
Product: [Applications] digikam Reporter: † <myaccount132>
Component: Tags-EngineAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: metzpinguin
Priority: NOR    
Version: 8.4.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 8.5.0
Sentry Crash Report:
Attachments: Screenshot of preview from NEW directory
Sidecar from NEW location
Sidecar from OLD location

Description 2024-08-25 13:22:36 UTC
SUMMARY
Orphan sidecars are created when moving files without first applying added tags and also database is not properly updated.

STEPS TO REPRODUCE
1.  Select bunch of photos (or maybe just one).
2. Add tags to photo(s) but do not apply them. Keep selection.
3. Move selected files with unapplied tags to different folder.

OBSERVED RESULT

UI shows that new tags are applied during moving photos BUT:
- Changes seems to be applied only to sidecars at OLD location where is now orphan sidecars.
- Changes are not applied to sidecars to NEW location where they're with actual image files.

EXPECTED RESULT

UI and file level behavior should be equivalent: If UI shows that tags are applied during moving (which saves time in cases there's lots of files as applying takes time), then they should be applied to sidecars in NEW location, and no orphan sidecars should be created to OLD location.

ADDITIONAL INFORMATION

This appears to be old bug/behavior and *possible* cause to bug https://bugs.kde.org/show_bug.cgi?id=458029

Please also tell is there a way to properly update the sidecars in these cases in NEW location and to avoid old data popping up from there. I have occasionally manually removed orphan sidecars that's possibly not proper way to handle these.
Comment 1 2024-08-25 13:39:48 UTC
Also should be noticed that xmp-files at OLD location are not perfect ones. While they have updated tags, they seems to lag exif and other data which now appear to be saved only at NEW location.
Comment 2 Maik Qualmann 2024-08-25 14:00:44 UTC

*** This bug has been marked as a duplicate of bug 204487 ***
Comment 3 2024-08-25 17:37:39 UTC
Created attachment 172941 [details]
Screenshot of preview from NEW directory
Comment 4 2024-08-25 17:39:03 UTC
Created attachment 172942 [details]
Sidecar from NEW location
Comment 5 2024-08-25 17:39:31 UTC
Created attachment 172943 [details]
Sidecar from OLD location
Comment 6 2024-08-25 20:43:18 UTC
So it appears that as expected choosing "Read metadata from file" removes all such tags from database too and thus looses data, whereas "Write metadata to file" saves the correct updated data from database to sidecars and retains integrity. Latter is what fixes data from possibly disappearing in future if this backup feature is used for some reason, unless the orphan sidecars are for some reason manually used to replace the ones with image files (which may actually happen when dealing with other hardware or filesystem related issues to rescue data). Orphan sidecars at old location are not fixed by either, but if files are moved back to old location sidecars are replaced as expected with the ones from new location.
Comment 7 Maik Qualmann 2024-08-27 06:30:42 UTC
Git commit 5c63386b0148124b101f6b568e99a8f25376ea7d by Maik Qualmann.
Committed on 27/08/2024 at 06:29.
Pushed by mqualmann into branch 'master'.

disable left sidebar if right sidebar modified
Related: bug 204487, bug 491778
FIXED-IN: 8.5.0

M  +3    -3    NEWS
M  +3    -0    core/app/views/stack/itemiconview.cpp
M  +1    -0    core/app/views/stack/itemiconview.h
M  +12   -0    core/app/views/stack/itemiconview_views.cpp
M  +7    -0    core/libs/properties/captions/itemdescedittab.cpp
M  +1    -0    core/libs/properties/captions/itemdescedittab.h
M  +3    -0    core/libs/properties/captions/itemdescedittab_p.cpp
M  +3    -0    core/libs/properties/itempropertiessidebardb.cpp
M  +1    -0    core/libs/properties/itempropertiessidebardb.h

https://invent.kde.org/graphics/digikam/-/commit/5c63386b0148124b101f6b568e99a8f25376ea7d