Failing to parse a raw value silently fails

Bug #644143 reported by Olivier Tilloy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pyexiv2
Fix Released
High
Olivier Tilloy

Bug Description

Version of pyexiv2: bzr head (lp:pyexiv2 as of 2010-09-21, revision 325).
Version on libexiv2: 0.20.0

Script to reproduce the issue:

import pyexiv2
fn = 'test/data/smiley1.jpg'
m = pyexiv2.ImageMetadata(fn)
m.read()
value = '2 0 0 0 '
m['Exif.GPSInfo.GPSVersionID'] = value
m.write()
del m
m = pyexiv2.ImageMetadata(fn)
m.read()
assert(m['Exif.GPSInfo.GPSVersionID'].value == value)

Expected result: no-op.
Current result: an AssertionError is raised.

Revision history for this message
Olivier Tilloy (osomon) wrote :

Note: the behaviour seems to be different if the tag is already present in the image. If not present yet, it will be written with an empty value as shown in the script above. If already present, its value is simply not overwritten.

Revision history for this message
Olivier Tilloy (osomon) wrote :

Running Ubuntu 10.10 beta, that ships with libexiv2 0.19, I can’t reproduce the issue. I’ll test with 0.20.

Revision history for this message
Olivier Tilloy (osomon) wrote :

I can reproduce the issue with libexiv2 0.20 compiled from source.
0.19 (package in ubuntu and compiled from source) works fine, 0.20 doesn’t.

summary: - Writing tags with type "Byte" silently fails
+ Writing tags with type "Byte" silently fails with libexiv2 0.20
Revision history for this message
Olivier Tilloy (osomon) wrote : Re: Writing tags with type "Byte" silently fails with libexiv2 0.20

The issue seems to be with the trailing white space in the value. When setting the value of 'Exif.GPSInfo.GPSVersionID' to '2 0 0 0', this works as expected (with libexiv2 0.20).
It is easy enough to suppress trailing spaces on the fly and to make sure that pyexiv2.utils.string_to_undefined(...) returns strings with no trailing spaces. I will add corresponding unit tests.

Changed in pyexiv2:
status: Confirmed → In Progress
Revision history for this message
Olivier Tilloy (osomon) wrote :

Additionally, the code should check the return value of Exiv2::Metadatum::setValue(const std::string &) and throw an exception if ≠ 0.

Revision history for this message
Olivier Tilloy (osomon) wrote :

Fix committed to trunk at revision 328.

summary: - Writing tags with type "Byte" silently fails with libexiv2 0.20
+ Failing to parse a raw value silently fails
Changed in pyexiv2:
status: In Progress → Fix Committed
Olivier Tilloy (osomon)
Changed in pyexiv2:
milestone: none → 0.3
Olivier Tilloy (osomon)
Changed in pyexiv2:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.