GnuCash
Contact   Instructions
Bug 797027 - After Upgrade to 3.4, File is Always Unsaved
Summary: After Upgrade to 3.4, File is Always Unsaved
Status: RESOLVED NOTABUG
Alias: None
Product: GnuCash
Classification: Unclassified
Component: General (show other bugs)
Version: 3.4
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: general
QA Contact: general
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-07 19:50 EST by Robert Chapin
Modified: 2019-04-30 22:42 EDT (History)
3 users (show)

See Also:


Attachments

Description Robert Chapin 2019-01-07 19:50:13 EST
Maybe I'm not understanding this new interface, but every time I open one of my files in version 3.4, it appears with an asterisk in the title bar, and when I attempt to close GnuCash it asks me to Close Without Saving, even though I have made no changes to the file.

This behavior is persistent until I click the Save button, as though the new version was waiting for me to upgrade each file.

I think it would be better to respect the user's understanding of whether the file is already saved or not.
Comment 1 John Ralls 2019-01-07 20:41:43 EST
That's more than likely because of a repair function we call a "scrub". When we fix a bug in GnuCash we sometimes find that it has introduced errors in the data. When we do we add a "scrub" function as part of loading the file to correct the errors. The most recent one, added in GnuCash 3.4, removes superfluous slots for color in accounts when no color is set. 

I'll leave this open as it would be helpful to pop a dialog box explaining why the data needs to be saved when the user hasn't done anything to it.
Comment 2 Robert Chapin 2019-04-28 16:22:57 EDT
I'm having a similar problem now in 3.5-27 where I open an old file and it appears normal until I expand or collapse any placeholder in the accounts list, and then the file switches to unsaved.  Is this the same bug?
Comment 3 John Ralls 2019-04-28 16:48:21 EDT
Is the "old" file one that you haven't opened with 3.5 and re-saved before? If so then it's a combination of this bug and a new one where the save button doesn't light up until something else causes a redraw. 

If it's a file that you have opened before then it's a new problem. Changing the window appearance shouldn't make the book dirty.
Comment 4 Robert Chapin 2019-04-29 14:59:16 EDT
The particular file I tested was dated 02/02/2019 and does not appear to be in XML format anymore.  Begins with 1f 3c 08 00 00 00 00 00 00 0a.
Comment 5 John Ralls 2019-04-29 15:02:21 EDT
You probably turned on compression in Preferences>General. It's gzip and 7Zip can unzip it for you.
Comment 6 Robert Chapin 2019-04-29 15:04:08 EDT
Indeed.  Is there anything version-related you need from the XML?
Comment 7 John Ralls 2019-04-29 17:57:48 EDT
UNfortunately we don't write version information into the data file so there's no way to recover anything useful from that. Since you apparently started using 3.4 around the first of the year it's presumably a file you'd opened before.
Comment 8 Robert Chapin 2019-04-29 22:54:31 EDT
If you like, I could re-save the file and see if the bug goes away.  I was just curious if there is something the program looks for in an "old" file that triggers the scrub.
Comment 9 John Ralls 2019-04-29 23:09:45 EDT
No harm in trying, GnuCash always renames the old XML file and writes a new one.
Comment 10 Robert Chapin 2019-04-29 23:20:06 EDT
Running 3.5-126 now it's back to always unsaved instead of waiting for a redraw.

I opened that same file, saved it, and then the symptoms went away again.
Comment 11 John Ralls 2019-04-30 00:56:08 EDT
Good, I guess.

Just to make sure I'm clear, you opened the file from 2 Feb and it wanted to be saved so you did and now when you open it it doesn't want to be saved anymore, right?
Comment 12 Robert Chapin 2019-04-30 01:56:55 EDT
Correct.  So is it finding version info in the file or is it tracking paths to updated files?
Comment 13 John Ralls 2019-04-30 10:15:29 EDT
Neither, it's examining the data stream as it loads the file.

I ran a test by loading an old file and saving it, then ran a programming tool called "diff" on the backup and the new file. It shows all of the changes in the file. The changes were the removal of an account slot called "color-key" having value "not set" and creating a slot on the book, "remove-color-not-set-slots", recording that this was done.  

That scrub was created in https://github.com/Gnucash/gnucash/commit/5c524c31b2c953087b70305c24547960e0d5e585.
Comment 14 Robert Chapin 2019-04-30 20:36:50 EDT
My file from 2/2/2019 already had those changes.  I will diff them and see what's going on here.
Comment 15 Robert Chapin 2019-04-30 20:42:13 EDT
Two things:

-    <slot:key>book</slot:key>
-    <slot:value type="frame">
-      <slot>
-        <slot:key>tax_US</slot:key>
+    <slot:key>tax_US</slot:key>

And then later in the file it looks like every <ts:date> value has been revised.
Comment 16 John Ralls 2019-04-30 22:42:46 EDT
The test file I used didn't have any tax_US keys... and I imagine none of my regular ones would either because I don't use the txf report. Just another scrub from 7d0adfd0c6.

The date change is a side effect. It doesn't affect the internal representation at all, it just gets rid of noise in the file and saves a tiny amount of work when parsing it.

Note You need to log in before you can comment on or make changes to this bug.