2010/11/16 Dimitar Zhekov dimitar.zhekov@gmail.com:
On Mon, 15 Nov 2010 08:57:51 +1100 Lex Trotman elextr@gmail.com wrote:
On 11 November 2010 00:27, Nick Treleaven nick.treleaven@btinternet.com wrote:
On Wed, 10 Nov 2010 10:13:29 +1100 Lex Trotman elextr@gmail.com wrote:
Also, g_file_replace_contents does have a make_backup argument we could provide an option for. This might handle the disk exhaustion problem.
To summarise the long thread for you Nick, g_file_replace_contents and g_file_replace can't be used because there is NO WAY to stop g_stream_close doing the rename of the temp file over the old file even if the write to the temp file fails. So you can get a broken output file.
I know. But at the least the user has the backup file then.
Attached is a patch to actually make the backup :-)
Whoever wants safe saving may set use_safe_file_saving=true, and that now works for GIO. Isn't unsafe_save_backup practically the same?..
Well no, GIO (correctly) is only used in the unsafe path.
Second, GIO file save has potential performance benefits for remote files, but is unsafe and networks are even more unsafe, making the backup mitigates some of the risks.
Third, making a backup also mitigates against some user errors of saving something you didn't mean to because it keeps the backup (filename~)
Cheers Lex
-- E-gards: Jimmy _______________________________________________ Geany-devel mailing list Geany-devel@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel