Bug 395914

Summary: Sidecar files are replaced if reading sidecar files is not enabled
Product: [Applications] digikam Reporter: grego <grzegorz.adamiak>
Component: Metadata-SidecarAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: aabarkley3, caulier.gilles, james, metzpinguin
Priority: NOR    
Version First Reported In: 5.9.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In: 8.2.0
Sentry Crash Report:
Attachments: darktable XMP
digiKam XMP with Read from sidecar files enabled
digiKam XMP with Read from sidecar files disabled

Description grego 2018-06-27 08:14:29 UTC
digiKam replaces existing sidecar file (at least for CR2), resulting in loosing existing information, if "Read from sidecar files" option is not enabled (Configure→Metadata→Sidecars). This is unexpected given the option name. If that's a feature not a bug at least a warning should be displayed that existing sidecar will be replaced or wiped.

The expected effect of the option would be to preserve existing sidecar file with all information on writing and skipping it on reading. At least that's what the option name implies.
Comment 1 Maik Qualmann 2018-06-27 11:05:02 UTC
That the sidecare file is changed is normal, if the writing is activated. In digiKam-6.0.0 it is also possible to clean up information that no longer exists in the sidecar or image from the database. What information is lost exactly. Possibly upload a sidecar file before and after.

Maik
Comment 2 grego 2018-06-27 11:24:36 UTC
Created attachment 113592 [details]
darktable XMP

The source XMP coming from darktable containing processing history
Comment 3 grego 2018-06-27 11:26:09 UTC
Created attachment 113593 [details]
digiKam XMP with Read from sidecar files enabled

The darktable XMP after updating from digiKam with the "Read from sidecar files" option enabled
Comment 4 grego 2018-06-27 11:26:46 UTC
Created attachment 113594 [details]
digiKam XMP with Read from sidecar files disabled

The darktable XMP after updating from digiKam with the "Read from sidecar files" option disabled
Comment 5 Maik Qualmann 2018-06-27 11:49:29 UTC
Ok, I think the correct solution is always to mix the sidecar metadata when writing. The digiKam metadata will then have the higher priority when writing.

Maik
Comment 6 grego 2018-06-27 13:23:43 UTC
(In reply to Maik Qualmann from comment #5)
> Ok, I think the correct solution is always to mix the sidecar metadata when
> writing.

That's what I'd expect. Always merge, never overwrite.
Comment 7 Maik Qualmann 2021-03-15 17:57:20 UTC
*** Bug 434438 has been marked as a duplicate of this bug. ***
Comment 8 Maik Qualmann 2021-03-15 18:01:15 UTC
I think we should always treat sidecars as a unit with the image. We should remove the option to read from sidecars and always read from sidecars if they are available. Gilles, do you see a use case to disable reading from sidecar when writing to sidecar is enabled?

Maik
Comment 9 caulier.gilles 2022-01-10 07:55:21 UTC
Hi Maik,

No, i don't remember a specific case to disable reading from sidecar when writing to sidecar is enabled.

Gilles
Comment 10 caulier.gilles 2023-04-29 07:08:43 UTC
M
Comment 11 caulier.gilles 2023-04-29 07:09:29 UTC
Maik, 

I think we needs to let the choice to the users at end in all cases, to read or not the XMP sidecars.

Gilles
Comment 12 caulier.gilles 2023-10-15 12:42:20 UTC
Maik,

We needs to take a decision about this file. Removing code is easy but can have side effects with users workflow. I vote to let's reading XMP sidecar option available but force to read when writing option is turned on.

Gilles
Comment 13 Maik Qualmann 2023-10-15 19:07:45 UTC
Git commit 1d7c8ae301946d363838df04ec6d33a827661598 by Maik Qualmann.
Committed on 15/10/2023 at 21:06.
Pushed by mqualmann into branch 'master'.

always read from sidecar when write is enabled
FIXED-IN: 8.2.0

M  +1    -1    NEWS
M  +5    -0    core/libs/metadataengine/engine/metaengine.cpp
M  +12   -3    core/utilities/setup/metadata/setupmetadata.cpp
M  +0    -3    core/utilities/setup/metadata/setupmetadata_sidecars.cpp

https://invent.kde.org/graphics/digikam/-/commit/1d7c8ae301946d363838df04ec6d33a827661598