GNOME Bugzilla – Bug 101340
Saving .xcf on full filesystem hangs GIMP
Last modified: 2009-08-15 18:40:50 UTC
I was trying to save a small image with two layers as XCF on a floppy. As it turned out, the floppy had not enough capacity. However GIMP did not present an error message, nor did it finish the save dialog. Even when deleting a file from the floppy using another command window, GIMP remained unresponsive. I had to terminate the application. (This was with Windows/XP SP1)
Looked at the code and found that it doesn't check the return value of the call to fwrite() and thus gets stuck in an endless loop in case of an error. That's pretty bad and needs to be fixed in the stable tree as well. Not trivial since the error needs to be propagated up thru all the xcf functions.
2003-12-19 Nathan Summers <rock@gimp.org> * app/xcf.c: actually check to make sure writes are successful, instead of unconditionally assuming that they are. Fixes bug #101340. Tested with a loopback device on an absurdly small file. It works. The write complained and exited instead of hanging. It did leave a tile reference count of 1, however.
Reopening this report since the bug is still present in GIMP-1.3.
Quick note to whoever wants to try a fix in HEAD: Let's handle the error reporting in HEAD using GError so that we can pass the error message all the way up instead of using g_message() all over the code. So instead of introducing a gboolean parameter, please use GError.
Fixed in HEAD as well. 2002-12-20 Nathan Summers <rock@gimp.org> * app/xcf/xcf-write.[ch] * app/xcf/xcf-save.c * app/xcf/xcf.c: ported the fix for bug #101340 over from the stable branch. Uses GError to report errors, unlike the stable version, which uses a pointer to gboolean. * app/xcf/xcf-seek.[ch]: check the return value of fseek and ftell for errors. Return FALSE and set GError if an error is detected. * app/xcf/xcf-load.c: since the xcf-seek functions use GError now, added a NULL for the error parameter. Added basic error checking on the return value of the xcf-seek functions. In the future, changing xcf-load.c to use GError more completely should be considered. * po/POTFILES.in: mark the error messages added for translation
The fix is part of the stable release 1.2.4. Closing this bug.