[Geany-devel] GIO saving made configurable?
elextr at xxxxx
Tue Jun 14 00:28:00 UTC 2011
On 14 June 2011 08:54, Colomban Wendling <lists.ban at herbesfolles.org> wrote:
> During the phase of removing code that is not relevant anymore since the
> dependency bump, I fatally came out to write_data_to_disk(). Now we can
> assume we have GIO, it may seem sensible to drop completely the C API
> file saving code...
> ...However, GIO saving seems to cause some problems on some complex
> (and maybe more -- at least one on IRC).
> So I'm wondering: do we really want to drop the C API-using code path,
> or do we want to make it configurable (like safe file saving)?
> Well, since I'm not completely sure of what causes the problems and what
> are the downsides (either I don't remember or I did not participate to
> the discussion...), I prefer to ask you what do you
> think/know/remember/whatever about this.
Having been involved in some of the previous discussions here is what
The methods of saving files are:
1. g_file_set_contents, saves to a temporary file and renames, our
safe file saving setting. Safe, but permissions can change. On
windows has to close the old file and delete it before renaming the
temporary, on Unix just renames. Thus won't work if running on Unix
and accessing Windows files.
2. g_file_replace, tries to do the same as g_file_set_contents but
checks if it can change the permissions first and, if it can't, falls
back to copying the old file to a temporary then truncating the old
file and writing over it. On slow remote filesystems this gives lousy
performance as it transfers data three times not just once (subject of
several complaints). Because it has better knowledge of which
filesystems are which, can work on windows files from Unix. Not safe,
unless set to provide a permanent backup, will still delete the
temporary file even if writing the new file fails. Option for keeping
the backup is in Geany SVN version only.
3. c library write, unsafe but works fast on all filesystems.
At the moment the c library option is only available if compile time
determines GIO is not available or the user configures to not use GIO.
Looking at these methods, they each address differing situations. As
Enrico once said, 'who knew it was so hard to just write a file' :-).
So I would say that all three need to stay, and the choice between GIO
and the c library needs to be made a preference not a compile time
So your patch looks good to me (by inspection only).
> I join a sample patch that make GIO saving configurable (just like safe
> file saving) with it enabled by default, if anybody wants to check it out.
> So, what's your opinion?
> Geany-devel mailing list
> Geany-devel at uvena.de
More information about the Devel