[GNC-dev] GnuCash 3 on Linux

Geert Janssens geert.gnucash at kobaltwit.be
Sun Feb 10 07:28:35 EST 2019


Op vrijdag 8 februari 2019 10:04:55 CET schreef Chris Good:
> Hi Geert,
> 
> Thanks very much for the above info.
> I'm afraid it has been quite a while since these emails but hopefully now I
> have a chance to follow up.
> 
> I was surprised to learn about the <optional _NUMBER> part of
> [BOOK-WITH-EXTENSION]<optional _NUMBER>.gcm as I have never seen this.
> I did some testing in Windows & Linux and I think I realise now how it
> works.
> 
> There is a guid in both the main data file and the metadata .gcm files.
> For example,
> In main data file:
> <book:id type="guid">fe06ec827c69b29977e25a7c6c090229</book:id>
> 
> In .gcm:
> BookGuid=fe06ec827c69b29977e25a7c6c090229
> 
> So when the metadata is saved, GnuCash looks for (or creates)  a .gcm file
> with a BookGuid matching book:id.
> 
Indeed.

> It seems that when you create a new book by using File, New, the
> subsequently saved main data file has a new book guid created.
> However, if you create a new book by either:
> 1) manually copying a main data file to a different directory and/or
> filename
> Or
> 2) using File, Save As
> there is no new book:id created so both books will continue to use the same
> .gcm file.
> 
> I suspect there may be people who may like to have different settings for
> different books but don't because they have created their new book by either
> of the 1) or 2) methods above.
> 
FTR this code is not written by me. I'm merely reading how it currently works.

That aside, it will continue to work as long as the user uses a different name 
when copying the file or using File, Save As

As there haven't been any complaints so far it looks that's what most people 
are doing anyway.

> As the book:id guid only appears once in my main data file, I assume it may
> be possible to correct this situation by:
> a) save the main data file uncompressed
> b) make a minor random(ish) change to the guid using a text editor (do NOT
> change the length of the guid)
> c) copy the old .gcm to a new .gcm (i.e. copy TEST.gnucash.gcm to
> TEST.gnucash_2.gcm)
> d) use a text editor to change the old guid to the new guid in the new .gcm
> 
> I'd like to document this in the wiki.
> Can you please let me know if I have made any errors in my above assumptions
> or forgotten anything important?
> 
I think you have all the proper details in a row.

> I think it would be useful if 2) above was changed so that a new book:id is
> generated. Shall I raise a bug?
> 
I don't know. As I said, if the file name is unique there's no need to rely on 
the GUID. It looks like it's fairly uncommon to want to use the same file name 
for books that are not related. On the other hand I may also want to simply 
copy my existing book to a new location and happen to use File, Save As to do 
so. I don't think gnucash can make an assumption that either is right or 
wrong.

In itself I think it's too ambiguous/insignificant to create a bug report for 
it. But on the other hand I also think this is something that we could analyze 
when we start revising our options/preferences system. On big aspect of this 
is evaluating for each setting whether it should be book specific (like book 
currency), computer specific (like saved window sizes) or user specific (like 
I have no example right now...). The metadata file is really meant to store 
computer specific data (though it currently does store more than that...).

Geert




More information about the gnucash-devel mailing list