[Geany] Problems when "no space left on device"

FD Cami francois.cami at xxxxx
Sun Apr 27 10:37:28 UTC 2008


On Sun, 27 Apr 2008 11:30:50 +0200
Enrico Tröger <enrico.troeger at uvena.de> wrote:

> On Sat, 26 Apr 2008 13:45:19 +0200, FD Cami <francois.cami at free.fr>
> wrote:
> 
> > On Sat, 26 Apr 2008 13:34:49 +0200
> > FD Cami <francois.cami at free.fr> wrote:
> > 
> > > On Fri, 25 Apr 2008 15:12:17 +0200
> > > Enrico Tröger <enrico.troeger at uvena.de> wrote:
> > > 
> > > > yesterday an user reported that Geany behaves badly when there is
> > > > no free disk space on the disk where the current file should be
> > > > saved. That is, when you are editing a file in Geany, meanwhile
> > > > your disk runs out of free space (extensive logging, copying
> > > > large files, some process gone bad, ...) and you then save the
> > > > file in Geany, it gets overwritten and the file is emptied.
> > > > This is indeed bad.
> > > > And there seems to be no easy way to fix it.
> > > > 
> > > > The only solution which comes to my mind would be to check for
> > > > available disk space before trying to write the file.
> > > > Unfortunately, there seems to be no portable way of doing this.
> > 
> > This does not work everytime, as far as I know there still could be a
> > minute chance of another process writing stuff and filling up the disk
> > before geany manages to write the file to disk.
> > 
> > > It may be that one way to do it is :
> > > * move "file" to "file~"
> > > * save memory buffer to "file"
> > > * remove "file~"
> > > Since this does not scale very well for big files, there should be
> > > some on/off option in preferences.
> 
> Well, this has no real effect in comparison to the current code.

It has. If step #2 "save memory buffer to file" fails, you do not remove
file~. You do not lose all data, which is the current behaviour.
I should have explained the logic better.

> Anyway, I don't like the "file~" stuff very much.

Me neither. That's why I proposed to remove the file~ after successfully
saving the current one.
 
> > I am going to work on that, unless a better idea comes up.
> 
> I'm not sure whether this is necessary. Wait a few days, I recently
> written a "backupcopy" plugin which copies the current file to a given
> directory after it was saved. So, this has basically the same effect as
> the the left "file~" in case of an error. But instead of the (IMO) ugly
> "~" extension, the extension can be configured, e.g. to contain a
> timestamp.

If your filesystem is full, I fail to see how this avoids losing data.

> I guess using the backupcopy plugin is probably enough to solve the
> problem together with a dialog box reporting the problem to the user
> (as Jeff suggested).

The dialog box is subject to the same race-condition problem I explained
above. Also, it will not work for windows users, because they mostly
have a single partition, which is full or not, so you cannot save to
another location (ok, perhaps a USB key or network drive) easily.

> And as I told before, when the system of the user is running out of
> disk space there are most probably bigger problems than the changes in
> the current file in Geany.

Yes, but losing the content of the file makes it even worse.

Cheers

F




More information about the Users mailing list