[Geany-devel] Changed file saving implementation for systems with GIO

Dimitar Zhekov dimitar.zhekov at xxxxx
Thu Nov 4 20:42:04 UTC 2010


On Thu, 4 Nov 2010 17:53:47 +0000
Nick Treleaven <nick.treleaven at btinternet.com> wrote:

> So it seems that function doesn't handle disk exhaustion safely. (But
> this is no worse than before for Geany).

Before we had safe or unsafe file saving. Let's keep that choice, shall
we? I can write the patch, it's only a few lines.

For more than 20 years now, the only safe save is to write the data
into a temporary file in the same directory, and then rename it over
the target file. Even if the rename fails, you still have the temporary
file. That changes the onwership and permissions, which is exactly the
behaviour of the safe g_file_set_contents().

The documentation of g_file_replace() may state "will try to replace
the file in the safest way possible", but I don't believe in miracles,
much less in ones from the glib developers.

> Perhaps you might like to file a bug against GIO. Perhaps first use gdb
> to break on that function just to be absolutely sure.

Perhaps. But bugs filed to gnome and kde may take years to resolve...

-- 
E-gards: Jimmy



More information about the Devel mailing list