Skip to content

Fix DeviceSettings conversion and stage XMP sidecar exports - #9532

Open
wilx wants to merge 2 commits into
Exiv2:mainfrom
wilx:fix-xmp-device-settings
Open

wilx wants to merge 2 commits into
Exiv2:mainfrom
wilx:fix-xmp-device-settings

Conversation

@wilx

@wilx wilx commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3292. Addresses the encoding-failure data loss reported in #9551.

DeviceSettingDescription was exported as scalar text although XMP represents it as a struct. Add bidirectional conversion that preserves dimensions, ordered UCS-2 settings, TIFF byte order, empty entries, and unmapped fields. Preserve explicit XMP edits over unchanged reconstructed native values.

Report XMP encoding failures to callers and make the CLI return failure. New CLI sidecars are encoded in memory before creating the destination; existing sidecars finish encoding before BasicIo::transfer() writes any bytes. Failed encoding therefore preserves an existing sidecar or leaves a new one absent. Regression tests cover the malformed UserComment, Model, and Copyright values from #9551, alongside valid UTF-8 copyright text.

ImageFactory::create(type, path) retains its immediate-overwrite contract. Applications that create filesystem sidecars before encoding must adopt the documented sequence: create(ImageType::xmp), set metadata, writeMetadata(), then transfer sidecar->io() to FileIo(path). This uses existing APIs. Physical I/O failures can still leave partial output.

Validation:

AI assistance: implementation and tests developed with Codex.

Comment thread src/devicesettings_int.cpp Fixed
@wilx
wilx force-pushed the fix-xmp-device-settings branch from e866a5e to 4c550c0 Compare November 1, 2026 09:11
@codecov

codecov Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.97826% with 70 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.93%. Comparing base (32c380d) to head (fdf3b28).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
src/convert.cpp 79.55% 7 Missing and 30 partials ⚠️
src/devicesettings_int.cpp 81.61% 7 Missing and 18 partials ⚠️
src/xmpsidecar.cpp 77.77% 1 Missing and 3 partials ⚠️
src/xmp.cpp 75.00% 0 Missing and 3 partials ⚠️
src/tiffvisitor_int.cpp 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9532      +/-   ##
==========================================
+ Coverage   65.28%   65.93%   +0.65%     
==========================================
  Files         117      120       +3     
  Lines       21859    22228     +369     
  Branches    10806    10996     +190     
==========================================
+ Hits        14270    14657     +387     
+ Misses       5324     5250      -74     
- Partials     2265     2321      +56     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wilx
wilx marked this pull request as draft November 1, 2026 10:49
@wilx
wilx force-pushed the fix-xmp-device-settings branch from 6d6366c to f7af955 Compare November 1, 2026 18:29
@wilx wilx changed the title Fix DeviceSettingDescription conversion and XMP sidecar write errors Fix DeviceSettings conversion and stage XMP sidecar exports Nov 1, 2026
@wilx
wilx force-pushed the fix-xmp-device-settings branch from f7af955 to 919ca44 Compare November 1, 2026 18:36
@wilx
wilx marked this pull request as ready for review November 1, 2026 18:48
@wilx
wilx force-pushed the fix-xmp-device-settings branch from 919ca44 to ea8b3cd Compare November 4, 2026 22:19
wilx added 2 commits November 22, 2026 16:24
Map DeviceSettings as structured XMP, retaining TIFF byte order, dimensions,
ordered UCS-2 settings, empty entries and unmapped fields. Validate text and
preserve explicit XMP edits over unchanged reconstructed native values.

Add conversion, roundtrip and synthetic sidecar regression tests.

Fixes Exiv2#3292.
Create new CLI sidecars in memory and transfer their completed packets only
after successful conversion and encoding. Keep immediate filesystem creation
unchanged and document the existing in-memory API sequence for applications.

Report encoding failures and use ordinary BasicIo::transfer for existing
sidecars. Physical I/O failures retain the existing transfer semantics.

Add regressions derived from Exiv2#9551, covering invalid native text, valid UTF-8,
existing and missing destinations, retries, stdout, raw and empty packets.
@wilx
wilx force-pushed the fix-xmp-device-settings branch from ea8b3cd to fdf3b28 Compare November 22, 2026 15:24
@mergify

mergify Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed to write metadata in a special case

2 participants