Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TrySaveXML erases existing metadata #1430

Closed
normanb opened this issue Apr 8, 2019 · 2 comments
Closed

TrySaveXML erases existing metadata #1430

normanb opened this issue Apr 8, 2019 · 2 comments
Assignees
Labels
Milestone

Comments

@normanb
Copy link
Contributor

normanb commented Apr 8, 2019

Expected behavior and actual behavior.

When asking for stats on a file I would expect the original image metadata to be maintained.

TileDB::TrySaveXML in #1402 has the same issue so I will try and fix this there. Creating this issue for tracking purposes.

Steps to reproduce the problem.

wget https://download.osgeo.org/geotiff/samples/spot/chicago/UTM2GTIF.TIF
gdal_translate -OF PNG UTM2GTIF.TIF output.png
cp output.png.aux.xml original.png.aux.xml
gdalinfo -stats output.png
diff original.png.aux.xml output.png.aux.xml

I would expect the only difference to be the stats in the new metadata file, the old metadata has been removed.

Operating system

Ubuntu 18.04 64 bit

GDAL version and provenance

Current master

@normanb
Copy link
Contributor Author

normanb commented Apr 8, 2019

I put a simple fix in https://github.com/OSGeo/gdal/pull/1402/files#diff-9a223edcf74381629981a9396dcdc1db it is sufficient to check whether the serialized return is null or not.

@rouault rouault closed this as completed in 22a7608 Apr 9, 2019
rouault added a commit that referenced this issue Apr 9, 2019
PAM: preserve existing metadata when setting new one (fixes #1430)
@rouault
Copy link
Member

rouault commented Apr 9, 2019

@normanb You can back out your change. I've fixed the issue slightly differently per #1431

@rouault rouault self-assigned this Apr 9, 2019
@rouault rouault added the bug label Apr 9, 2019
@rouault rouault added this to the 2.4.2 milestone Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants