[Geany-devel] backup pref - Re: Changed file saving implementation for systems with GIO

Lex Trotman elextr at xxxxx
Thu Nov 18 21:20:58 UTC 2010


On 19 November 2010 06:04, Nick Treleaven <nick.treleaven at btinternet.com> wrote:
> On Mon, 15 Nov 2010 08:57:51 +1100
> Lex Trotman <elextr at 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 :-)
>
> Ok. We do have some backup functionality in the Save Actions plugin,
> but anyway this pref may be more efficient.

Yes, save actions is fine on a local disk and much more flexible since
you can choose name and location for backups, but it copies the file
which is a performance problem for remote filesystems which was one of
the initiating complaints on the long "safe file save" thread IIRC.

>
> I think either:
> 1. unsafe_save_backup should be renamed to gio_unsafe_save_backup to
> avoid confusion.

Ok, attached.

> 2. call the pref make_backup and make it work for all save
> implementations, and maybe have a GUI option for it.

To do this we would almost be writing the whole of GIO with the
algorithm I outlined previously.  So we probably should do that
instead.  For now lets just offer this easy option that provides
improved performance on remote filesystems.

Cheers
Lex

>
> Nick
> _______________________________________________
> Geany-devel mailing list
> Geany-devel at uvena.de
> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel
>



More information about the Devel mailing list