After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 526727 - Parsing dates in extractors
Parsing dates in extractors
Status: RESOLVED FIXED
Product: tracker
Classification: Core
Component: Extractor
unspecified
Other All
: Normal minor
: ---
Assigned To: Jamie McCracken
Jamie McCracken
Depends on:
Blocks:
 
 
Reported: 2008-04-07 14:28 UTC by Ivan Frade
Modified: 2008-04-07 20:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Uses strptime strftime to convert dates to iso8601 (16.81 KB, patch)
2008-04-07 14:33 UTC, Ivan Frade
committed Details | Review

Description Ivan Frade 2008-04-07 14:28:24 UTC
Please describe the problem:
In some random cases, the Image:Date metadata is missing using tracker-extract with a jpeg.

Steps to reproduce:
1. Choose a fotograph with XMP and/or EXIF metadata
2. tracker-extract /home/xxx/yyy/zzzz/file.jpeg image/jpeg
3. Check the output for an Image:Date


Actual results:
The Image:Date metadata is in the output only some times. 

Expected results:
Image:Date must be present every time, because the image file contains the metadata.

Does this happen every time?
No, run it some times to check the result. Try with different images. 

Other information:
It is caused by an uninitialized array in tracker-extract.c - tracker_generic_date_extractor():

 timezone_buffer[6] can be used in g_strconcat without initialization, with undefined content.

 I will attach a patch that solves this bug and simplify the code, replacing the current hand-made date parsing functions with strptime and strftime C standard library functions.
Comment 1 Ivan Frade 2008-04-07 14:33:27 UTC
Created attachment 108784 [details] [review]
Uses strptime strftime to convert dates to iso8601

1) The iso standard for date and time is ISO 8601 (and not 8160 as the code said). This patch rename all iso8160 to iso8601.

2) Replaced the old and complex code with strftime and strptime functions. These functions return a NULL terminated string, and the result has as maximum 25 characters (24 + '\0')
Comment 2 Ivan Frade 2008-04-07 20:08:32 UTC
Committed.