On Thu, 23 Sep 2010, Sam Morris wrote:
> On Mon, 2010-09-13 at 23:38 -0700, Don Armstrong wrote:
> > Can you try this with a more recent version of gnucash (at least
> > 2.2.9-6), and also with --debug on? (You should see output like
> > "unlink lock file: blah", etc.)
> 
> This has remained quite reproducible for me with 2.2.9-7~squeeze1. The
> trick is to let a few backup/log files accumulate over a few days, then
> save the account file.
>
> I did so with --debug bug saw no output other than the usual message
> about binreloc relocation support.

It'll be logged to /tmp/gnucash.trace. You can redirect it to stderr
with "--logto stderr" or similar.
 
> The last time I tried to debug this I used strace and got the following
> output while saving the account file:
> 
[..]
>         stat("/home/sam/Documents/Gnucash/gnucash.xac.LCK", {st_mode=S_IFREG, 
> st_size=0, ...}) = 0

The above bit is it saving the previous files and such.

And here it begins to try to clean up files. The relevant code is in
src/backend/files/gnc-backend-file.c.

>         open("/home/sam/Documents/Gnucash", 
> O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 21
>         getdents(21, /* 35 entries */, 32768)   = 1752

[...]
>         stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=3661, ...}) = 0
>         unlink("/home/sam/Documents/Gnucash/gnucash.xac.20091221230758.xac") 
> = 0

This is the relevant code.

memset(&file_tm, 0, sizeof(file_tm));
res = strptime(name+pathlen+1, "%Y%m%d%H%M%S", &file_tm);
file_time = mktime(&file_tm);
days = (int)(difftime(now, file_time) / 86400);
if (res
    && res != name+pathlen+1
    && (strcmp(res, ".xac") == 0
        || strcmp(res, ".log") == 0)
    && file_time > 0
    && days > be->file_retention_days)
{
    PINFO ("g_unlink stale (%d days old) file: %s", days, name);
    g_unlink(name);
}


>         stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=3661, ...}) = 0
>         unlink("/home/sam/Documents/Gnucash/gnucash.xac") = 0

In order for this unlink to be called, res needs to be non NULL and
not equal to name+pathlen+1, and it must end with ".xac" or ".log".
The debugging output above would be really useful, because I have a
feeling that something here has gone horribly wrong.

>         stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=3661, ...}) = 0
>         unlink("/home/sam/Documents/Gnucash/gnucash.xac.20091221233939.log") 
> = 0

The rest of these deletions are all reasonable.


Don Armstrong

-- 
I may not have gone where I intended to go, but I think I have ended
up where I needed to be.
 -- Douglas Adams _The Long Dark Tea-Time of the Soul_

http://www.donarmstrong.com              http://rzlab.ucr.edu



-- 
To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to