On Friday 21 January 2005 09:09 pm, Thomas Bushnell BSG wrote: > Create file named "foo.xac" > Do lots of edits on foo.xac [set 1] > Then open file named "foo.2004xxxxxx.xac" (a backup of foo). > Do lots of edits on foo.2004xxxxxx.xac [set 2] > Then open foo.xac again. > Do lots of edits on foo.xac [set 3], which triggers the backup purger and > � deletes foo.2004xxxxxx.xac, and all of the set 2 edits are now gone.
Yes, that's an accurate summary, except that it only took one edit on set 3
:).
> If you set the file retention days in preferences to 0, that has the
> effect of turning of the backup-pruning function entirely.
Yes, that's true, and as far as I'm concerned, making that the default would
be enough to close the bug. The main thing that bothered me is that you can
lose a lot of data with no warning just using the default behavior of the
program the way it's intended.
I think that you're right, though. Tightening the backup-purging function
is enough to eliminate the most pathological parts of this bug: right now it'll
match <base>.<date>* (if I follow the code), but it should only match
<base>.<date>.xac. Probably just checking that strcmp(res, "xac")==0 will do
it; ie:
--- gnucash-1.8.10/src/backend/file/gnc-backend-file.c 2003-07-27 00:04:42.0000
00000 -0400
+++ gnucash-1.8.10/src/backend/file/gnc-backend-file.c.new 2005-01-21 22:16
:08.000000000 -0500
@@ -630,8 +630,8 @@
days = (int)(difftime(now, file_time) / 86400);
/* Make sure this file actually has a date before unlinking */
- if (res && res != name+pathlen+1 &&
- /* We consumed some but not all of the filename */
+ if (res && res != name+pathlen+1 && strcmp(res, ".xac") == 0 &&
+ /* The filename has the form <name>.<date>.xac */
file_time > 0 &&
/* we actually have a reasonable time and it is old enough *
/
days > file_retention_days) {
(that's totally untested, just an example of what I meant)
Daniel
--
/----------------- Daniel Burrows <[EMAIL PROTECTED]> -----------------\
| "Do you know why the prisoner in the |
| tower watches the flight of birds?" |
| -- Terry Pratchett, _Reaper_Man_ |
\---------------- The Turtle Moves! -- http://www.lspace.org ---------------/
pgpJx7nlXr7Nj.pgp
Description: PGP signature

