Bug 508419 - Race condition with XMP files causes confusing tagging behavior
Summary: Race condition with XMP files causes confusing tagging behavior
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Metadata-Xmp (other bugs)
Version First Reported In: 8.7.0
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-08-18 12:11 UTC by HubMiner
Modified: 2025-08-18 17:51 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 8.8.0
Sentry Crash Report:


Attachments
Settings - Metadata - Behavior (50.27 KB, image/png)
2025-08-18 12:15 UTC, HubMiner
Details
Settings - Metadata - Sidecars (47.16 KB, image/png)
2025-08-18 12:16 UTC, HubMiner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description HubMiner 2025-08-18 12:11:01 UTC
SUMMARY:
when a photo/video files has a matching XMP file, and the current setting is not to use XMP files, Digikam can't remove old tags because it rereads old XMP on every save/sync.

STEPS:
- a test media file with a matching XMP file.
- Digikam settings: use XMP files.
- Change Digikam settings: Metadata - Write to sidecar files - Write to XMP for read-only item only.
- Create tag: TEST_TAG_OLD
- "write metadata to file", sync
- optionally: open file exporer, confirm that XMP is created and "date modified" is later then the media file.
- optionally: grep - XMP file mentions TEST_TAG_OLD

- Change Digikam settings: Metadata - Write to sidecar files - Write to XMP for read-only item only.
- For the same media file, add tag: TEST_TAG_NEW and remove tag: TEST_TAG_OLD
- save/sync
- confirm that media file has "date modified" newer then the XMP file.
- optionally: check with exiftool that the media has TEST_TAG_NEW tag.
- optionally: grep - XMP file only mentions TEST_TAG_OLD

OBSERVED BEHAVIOR:
- After the sync, Digikam rereads XMP and restores the TEST_TAG_OLD tag for the media file.

DESIRED BEHAVIOR:
- Media file needs to have tag TEST_TAG_NEW and no TEST_TAG_OLD

JUSTIFICATION
- If a user changed a tag, the new tag should be in affect, regardless of prior configuration setup.

WORKAROUND:
- remove XMP file or rename its extension.
Comment 1 HubMiner 2025-08-18 12:15:37 UTC
Created attachment 184208 [details]
Settings - Metadata - Behavior
Comment 2 HubMiner 2025-08-18 12:16:21 UTC
Created attachment 184209 [details]
Settings - Metadata - Sidecars
Comment 3 Maik Qualmann 2025-08-18 14:15:34 UTC
The behavior is clear and logical. If a sidecar exists for a file that isn't read-only, the sidecar won't be updated. The sidecar metadata takes precedence over the file metadata.
You must delete the sidecar or choose a different setting when creating the sidecar. There's no other way for digiKam to break this behavior for other users.

Maik
Comment 4 Maik Qualmann 2025-08-18 17:51:22 UTC
Git commit 6b3490c5ef86483e2784fc08086933828684b2f9 by Maik Qualmann.
Committed on 18/08/2025 at 17:50.
Pushed by mqualmann into branch 'master'.

write to the sidecar if it is available also in read only sidcare mode
FIXED-IN: 8.8.0

M  +1    -1    NEWS
M  +6    -2    core/libs/metadataengine/engine/metaengine_fileio.cpp

https://invent.kde.org/graphics/digikam/-/commit/6b3490c5ef86483e2784fc08086933828684b2f9