GNOME Bugzilla – Bug 744035
Save As creates corrupt file
Last modified: 2016-05-03 12:38:17 UTC
Created attachment 296186 [details] Associated GIMP file demonstrating bug Saving the attached file ("Save As") which was created under older version of GIMP (2.6.?) - without making a single change to the file - reliably creates a corrupted file which will not load. There seems to be no issue loading the original file, yet any attempt to make a backup copy will not work.
Neglected to add full version information, as follows: GNU Image Manipulation Program version 2.8.14 git-describe: GIMP_2_8_12-2-ge62e6fe using GEGL version 0.2.0 (compiled against version 0.2.0) using GLib version 2.40.0 (compiled against version 2.40.0) using GdkPixbuf version 2.30.8 (compiled against version 2.30.8) using GTK+ version 2.24.24 (compiled against version 2.24.23) using Pango version 1.36.5 (compiled against version 1.36.5) using Fontconfig version 2.11.1 (compiled against version 2.11.1) using Cairo version 1.12.16 (compiled against version 1.12.16)
Just tried with GIMP 2.8.14 from debian unstable. Saving as a different filename creates an XCF that can be loaded without any problem. Can somebody try on Windows please?
Works fine for me. Can you attach one example - or maybe two, to be able to check for differences - of the corrupt file?
Created attachment 296280 [details] Additional source file
Created attachment 296281 [details] Corrupt output for original example file
Created attachment 296282 [details] Corrupt output for second example file
Files attached as requested. I have two copies of the original (V 2.6.x) xcf file, each exhibiting the same problem. The two copies were suffixed "1" and "2" for various editing stages. In each instance I simply opened the File, make no changes and do a Save As to create a new file, suffixed with "-Save As". Both save as files are corrupt, are slightly larger than the originals and fail at different points when opening: The "1-Save As" puts a message on the main window footer "This file is corrupt! I have loaded as much of it as I can, but it is incomplete.". Very little of the file loads. The "2-Save As" shows a GIMP Dialog "GIMP Message" "Opening <filename> failed: This xcf file is corrupt! I could not even salvage any partial image from it.". Thanks for looking into this problem.
I compared with an hex editor (vim in effect) the corrupt file attached to comment #5 with a copy saved locally and valid. The difference is that many text layer parasites have a property size of 0. The question is: does this happen saving to a local disk or is a network file system (SAMBA, NAS) involved? The code, as in many other places, seeks back and forth: first it writes a zero as the property size then it writes the whole property, moves back to the size position, overwrites the size and moves forward to the end. In the case of a text layer the property size of the parasite is redundant and after patching GIMP it is possible to load the corrupt file. Patch only for experimentation, not meant to be pushed to the sources tree. diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c index b180377..93e93b9 100644 --- a/app/xcf/xcf-load.c +++ b/app/xcf/xcf-load.c @@ -879,7 +879,7 @@ xcf_load_layer_props (XcfInfo *info, { glong base = info->cp; - while (info->cp - base < prop_size) + do { GimpParasite *p = xcf_load_parasite (info); @@ -889,8 +889,9 @@ xcf_load_layer_props (XcfInfo *info, gimp_item_parasite_attach (GIMP_ITEM (*layer), p, FALSE); gimp_parasite_free (p); } + while (info->cp - base < prop_size); - if (info->cp - base != prop_size) + if (prop_size && info->cp - base != prop_size) gimp_message_literal (info->gimp, G_OBJECT (info->progress), GIMP_MESSAGE_WARNING, "Error while loading a layer's parasites");
Hi Massimo, Thanks for looking into this issue. Your comments gave me pause to consider what I am doing: Replacement of my desktop unit a while back resulted in the locally stored files being put onto a networked drive (NAS), including the ones I was having issue with. I only attempted to edit them directly on the networked storage - it never occurred to me that this could be an issue, as no other applications had problems. After your post, I have copied the files back to local storage and can successfully edit/save them there. So the actual "Save As" issue relates to GIMP writing to a NAS device. Apologies for the misdirection - will this bug be reassigned to one about GIMP writes the xcf files to networked drives? Many Thanks.
(In reply to Hz4Daz from comment #9) > Hi Massimo, > > Thanks for looking into this issue. > > Your comments gave me pause to consider what I am doing: > Replacement of my desktop unit a while back resulted in the locally stored > files being put onto a networked drive (NAS), including the ones I was > having issue with. I only attempted to edit them directly on the networked > storage - it never occurred to me that this could be an issue, as no other > applications had problems. > > After your post, I have copied the files back to local storage and can > successfully edit/save them there. So the actual "Save As" issue relates to > GIMP writing to a NAS device. > I did a search on: corrupt files saving NAS and there are many results. I'd make sure to have all software updated and if it is a dedicated hardware perhaps report the issue to their support forums. > Apologies for the misdirection - will this bug be reassigned to one about > GIMP writes the xcf files to networked drives? > > Many Thanks. Regarding GIMP probably it is the case to add a big warning in the release notes or README or KNOWN_ISSUES to try to prevent future data loss.
Is this a duplicate of bug 730211?
Let's assume that it is. Thanks for taking the time to report this. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of bug 730211 ***