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 624794 - Can't show neither thumbnail nor image if xmp file's XML is empty (0 Bytes)
Can't show neither thumbnail nor image if xmp file's XML is empty (0 Bytes)
Status: RESOLVED FIXED
Product: f-spot
Classification: Other
Component: Metadata
GIT
Other Linux
: Normal major
: 0.7.2
Assigned To: F-spot maintainers
F-spot maintainers
Depends on:
Blocks:
 
 
Reported: 2010-07-20 06:24 UTC by Paul Wellner Bou
Modified: 2010-08-07 15:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Make Metadata and Sidecar file parsing more reliable (6.78 KB, patch)
2010-07-20 07:07 UTC, Mike Gemünde
none Details | Review
Make Metadata and Sidecar file parsing more reliable (6.63 KB, patch)
2010-07-20 08:00 UTC, Mike Gemünde
none Details | Review
Make Metadata and Sidecar file parsing more reliable (6.71 KB, patch)
2010-07-22 11:13 UTC, Mike Gemünde
none Details | Review
Add tests for reading broken sidecar fiels and broken metadata (10.88 KB, patch)
2010-07-22 11:13 UTC, Mike Gemünde
none Details | Review
Make Metadata and Sidecar file parsing more reliable (7.26 KB, patch)
2010-07-22 11:19 UTC, Mike Gemünde
reviewed Details | Review
Add tests for reading broken sidecar fiels and broken metadata (10.88 KB, patch)
2010-07-22 11:19 UTC, Mike Gemünde
needs-work Details | Review
Make Metadata and Sidecar file parsing more reliable (7.26 KB, patch)
2010-07-22 11:59 UTC, Mike Gemünde
committed Details | Review
Add tests for reading broken sidecar fiels and broken metadata (54.46 KB, patch)
2010-07-22 11:59 UTC, Mike Gemünde
committed Details | Review
Silence debug output. (2.56 KB, patch)
2010-08-07 14:59 UTC, Ruben Vermeersch
committed Details | Review

Description Paul Wellner Bou 2010-07-20 06:24:19 UTC
I would expect that F-Spot is not able to read the metadata then, but only because there is an FILENAME.xmp file (maybe modified/created by another application) which F-Spot can't read, F-Spot still should be able to show the image.

The thumbnail works only with a JPG, the RAW thumbnails did not show up.

This was the debug output:

[4 Debug 08:13:40.818] Failed loading image for thumbnailing: file:///home/paul/Photos/2010/07/17/DSC_6302.NEF
[4 Warn  08:13:40.818] Caught an exception - System.Xml.XmlException: Document element did not appear.  Line 1, position 1. (in `System.Xml')
  at Mono.Xml2.XmlTextReader.Read () [0x00000] 
  at System.Xml.XmlTextReader.Read () [0x00000] 
  at System.Xml.XmlDocument.ReadNodeCore (System.Xml.XmlReader reader) [0x00000] 
  at System.Xml.XmlDocument.ReadNode (System.Xml.XmlReader reader) [0x00000] 
  at System.Xml.XmlDocument.Load (System.Xml.XmlReader xmlReader) [0x00000] 
  at System.Xml.XmlDocument.LoadXml (System.String xml) [0x00000] 
  at TagLib.Xmp.XmpTag..ctor (System.String data) [0x00011] in /usr/src/f-spot/lib/TagLib/TagLib/src/TagLib/Xmp/XmpTag.cs:256 
  at FSpot.Utils.SidecarXmpExtensions.ParseXmpSidecar (TagLib.Image.File file, IFileAbstraction resource) [0x00039] in /usr/src/f-spot/src/Utils/SidecarXmpExtensions.cs:25 
  at FSpot.Utils.Metadata.Parse (Hyena.SafeUri uri) [0x00074] in /usr/src/f-spot/src/Utils/Metadata.cs:26 
  at FSpot.Imaging.BaseImageFile..ctor (Hyena.SafeUri uri) [0x00014] in /usr/src/f-spot/src/Imaging/ImageFile.cs:188 
  at FSpot.Imaging.Tiff.NefFile..ctor (Hyena.SafeUri uri) [0x00000] in /usr/src/f-spot/src/BitConverter.cs:1 
  at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (object,object[],System.Exception&)
  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] 
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. (in `mscorlib')
  at System.Reflection.MonoCMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] 
  at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] 
  at System.Activator.CreateInstance (System.Type type, BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) [0x00000] 
  at System.Activator.CreateInstance (System.Type type, System.Object[] args, System.Object[] activationAttributes) [0x00000] 
  at System.Activator.CreateInstance (System.Type type, System.Object[] args) [0x00000] 
  at FSpot.Imaging.ImageFile.Create (Hyena.SafeUri uri) [0x0001e] in /usr/src/f-spot/src/Imaging/ImageFile.cs:128
Comment 1 Mike Gemünde 2010-07-20 07:07:37 UTC
Created attachment 166195 [details] [review]
Make Metadata and Sidecar file parsing more reliable
Comment 2 Mike Gemünde 2010-07-20 08:00:51 UTC
Created attachment 166196 [details] [review]
Make Metadata and Sidecar file parsing more reliable
Comment 3 Ruben Vermeersch 2010-07-20 08:22:35 UTC
There are unit tests for the sidecars. Could you add test cases with these failure conditions?
Comment 4 Mike Gemünde 2010-07-22 11:13:05 UTC
Created attachment 166374 [details] [review]
Make Metadata and Sidecar file parsing more reliable

The application should not crash when reading metadata or sidecar files fail.
Comment 5 Mike Gemünde 2010-07-22 11:13:16 UTC
Created attachment 166375 [details] [review]
Add tests for reading broken sidecar fiels and broken metadata

The tests should ensure that broken sidecar files or broken image files
do cause metadata reading to fail. The new tests in MetadataTest.cs
are very similar to the ones in SidecarXmpExtensionsTests.cs, but they
use different utility methods, which also should be tested.
Comment 6 Mike Gemünde 2010-07-22 11:19:49 UTC
Created attachment 166376 [details] [review]
Make Metadata and Sidecar file parsing more reliable

The application should not crash when reading metadata or sidecar files fail.
Comment 7 Mike Gemünde 2010-07-22 11:19:53 UTC
Created attachment 166377 [details] [review]
Add tests for reading broken sidecar fiels and broken metadata

The tests should ensure that broken sidecar files or broken image files
do cause metadata reading to fail. The new tests in MetadataTest.cs
are very similar to the ones in SidecarXmpExtensionsTests.cs, but they
use different utility methods, which also should be tested.
Comment 8 Ruben Vermeersch 2010-07-22 11:45:13 UTC
Comment on attachment 166377 [details] [review]
Add tests for reading broken sidecar fiels and broken metadata

Test files missing.
Comment 9 Ruben Vermeersch 2010-07-22 11:49:54 UTC
Review of attachment 166376 [details] [review]:

Question:

::: src/Utils/SidecarXmpExtensions.cs
@@ +14,3 @@
         ///    tag of file by the parsed data.
         /// </summary>
+        public static bool ParseXmpSidecar (this TagLib.Image.File file, TagLib.File.IFileAbstraction resource)

Are the return values used anywhere?
Comment 10 Mike Gemünde 2010-07-22 11:59:53 UTC
Created attachment 166382 [details] [review]
Make Metadata and Sidecar file parsing more reliable

The application should not crash when reading metadata or sidecar files fail.
Comment 11 Mike Gemünde 2010-07-22 11:59:57 UTC
Created attachment 166383 [details] [review]
Add tests for reading broken sidecar fiels and broken metadata

The tests should ensure that broken sidecar files or broken image files
do cause metadata reading to fail. The new tests in MetadataTest.cs
are very similar to the ones in SidecarXmpExtensionsTests.cs, but they
use different utility methods, which also should be tested.
Comment 12 Ruben Vermeersch 2010-07-22 12:40:11 UTC
Attachment 166382 [details] pushed as fac7e48 - Make Metadata and Sidecar file parsing more reliable
Attachment 166383 [details] pushed as 9518bea - Add tests for reading broken sidecar fiels and broken metadata

Committed these patches. Would like to have the output silenced during tests though, so I'm not closing the bug yet. Would that be possible?
Comment 13 Ruben Vermeersch 2010-08-07 14:59:32 UTC
Created attachment 167323 [details] [review]
Silence debug output.
Comment 14 Ruben Vermeersch 2010-08-07 15:00:42 UTC
Attachment 167323 [details] pushed as 4d9ef47 - Silence debug output.


Silenced the debug output. Please make an effort to maintain what you submit Mike. I know this ain't exactly the most fun thing to do, but it's even less fun if I have to do all of it.