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 615110 - write file ignore encoding errors
write file ignore encoding errors
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: File loading and saving
3.13.x
Other Linux
: Normal normal
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2010-04-07 22:26 UTC by Sebastien Bacher
Modified: 2014-08-20 21:28 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Sebastien Bacher 2010-04-07 22:26:06 UTC
Using gedit 2.30:

* open the gedit tarball ChangeLog
* try saving it in ISO-8859-15
* gedit raises an encoding error

the file is saved anyway with broken encoding
Comment 1 jessevdk@gmail.com 2010-04-07 23:07:36 UTC
Just so that I don't forget before trying to fix this, the output stream does the tmp-to-original copy when closing the stream. This now happens also when there is an error in reading from the input stream. The output stream is in a perfectly fine state, and when it's closed the copy happens. From reading the output stream code, the only way to disable this is to explicitly close the stream, with a GCancellable which is in the 'cancelled' state.

This might not really be the most intuitive thing to do, but at least we can fix the bug like that. The relevant part in the code is the function async_failed in gedit-gio-document-saver.c. Note that we also call this path, when closing the output stream fails. Obviously we wouldn't want to try to close it again, so we need to catch that case. In async_failed, we should preferably close the stream async, but it might need some more state keeping to implement that.
Comment 2 Paolo Borelli 2010-04-07 23:10:20 UTC
I think we can simply cancel before calling async_failed
Comment 3 jessevdk@gmail.com 2010-04-08 08:18:16 UTC
I don't think so. The cancellable is only associated with the write process, which at that point is finished for that chunk. I admit, it was the first thing I tried too, but it doesn't work (because the stream closing is called from somewhere else , we don't explicitly close it, and doesn't receive that cancellable).
Comment 4 Alexander Larsson 2010-04-08 18:53:19 UTC
This is bug 602412
Comment 5 jessevdk@gmail.com 2010-04-10 09:55:27 UTC
We've managed to put in a temporary fix for the problem. I'll leave the bug report open for reference if we want to add proper API for this case to gio.
Comment 6 Sébastien Wilmet 2014-08-20 21:28:54 UTC
This bug is referenced in the code in gtksourcefilesaver.c, no need to keep it open.