Compression

Alex Aycinena alex.aycinena at gmail.com
Tue Feb 14 18:04:03 EST 2012


> ---------- Forwarded message ----------
> From: "Fred Bone" <Fred.Bone at dial.pipex.com>
> To: gnucash-user at gnucash.org
> Cc:
> Date: Sun, 12 Feb 2012 11:19:36 -0000
> Subject: Re: Compression
> On 11 February 2012 at 12:15, Derek Atkins said:
>
>> "Dustin Henning" <The00Dustin at gmx.net> writes:
>>
>> > For the record, 7zip has a gzip option (along with several others), this
>> > is the option I used.  Maybe the file is tarballed before it is
>> > gzipped? Otherwise the specific settings matter.  Regardless, it
>> > occurred to me after I sent the e-mail that I could open, save, and
>> > delete the uncompressed copy.
>>
>> I don't know what 7zip does.  It is possible that it uses some container
>> inside the gzip, which would cause GnuCash to barf.  The easiest thing to
>> do is, again, just have GnuCash open the uncompressed file, and then when
>> it writes back out it'll compress it again for you.  You do not need to
>> re-compress the file yourself; GnuCash can read uncompressed data even if
>> the preference for compression is on.
>
> One small data point FWIW: I took an old Gnucash uncompressed file (not
> sure which GNucash version) and compressed it in GZip format using 7-Zip.
> Gnucash declined to open it saying "This file/URL appears to be from a
> newer version of GnuCash. You must upgrade your version of GnuCash to
> work with this data." It is quite happy to open the uncompressed file,
> even though it's three years old, so I deduce that it's something about
> the compression that's the problem. However, if I extract the file it is
> identical to the original.
>
> The .gz file created by 7-Zip is (AFAICT) only gzipped, not otherwise
> modified or containerized. I tried asking for "fastest" (vs "normal")
> compression with a reduced dictionary wordsize (12 instead of 32) but
> that made no difference as far as Gnucash was concerned.
>
> I have in the past successfully used a GZip-aware editor, JEdit, to
> modify a compressed Gnucash file. So I tried opening my test file in that
> and saving in .gz format. Same result. However, opening a compressed
> file, modifying it, and re-saving produced a file Gnucash was happy to
> open.
>
> (Windows XP-SP2; 7-Zip 4.65)
>
Fred,

That message you got ("This file/URL appears to be from a newer
version of GnuCash. You must upgrade your version of GnuCash to work
with this data.") is from an update I put in just recently. You don't
say but, because of this, I assume you are using gnucash version
2.4.10 on your Windows platform. However, I don't understand why you
would get that particular message under these circumstances.

So I did some tests but could not reproduce your results. I don't have
gnucash running on Windows so what I did was to use version 2.4.10 on
linux to save a test file as uncompressed using gnucash. I then copied
the uncompressed file to my MS Vista platform. I used 7-Zip 4.44 to
compress it and copied the 7-Zip-compressed file back to linux where
gnucash was able to read it and load the file. So perhaps the
inability to read a 7-Zip-compressed gnucash file is only on Windows
versions of gnucash which I can't test (however, if it can't deal with
the file, it should give you a different message than the one above).

I also opened the uncompressed gnucash file using notepad on Windows
and changed the second line from "<gnc-v2" to "<gnc-v2.0.1" and saved
the file both uncompressed and compressed with 7-Zip. When I copied
both of these files back to linux, gnucash was able to open both files
but it recognized both files as later versions, displayed the message
you got (mentioned above) and didn't load the file, as it is supposed
to. The way the logic is supposed to work is that if it can't open the
file, it is supposed to say that it is not a gnucash file. If it can
open it and it doesn't start with "<?xml", it is supposed to say that
it is not a gnucash file. If it passes this test, it looks at the next
line and if it finds that it starts with exactly "<gnc-v2" followed by
a newline, it identifies the file as a gnucash version 2 file and
tries to load it, if it finds exactly "<gnc>" followed by a newline,
it identifies the file as a gnucash version 1 file and tries to load
it, if it fails both of these but finds that the string starts with
"<gnc-v", it assumes it is a gnucash file but of a later version and
gives you the message you saw. If none of these applies, it is
supposed to say that it is not a gnucash file.

So it is behaving properly in my tests but not in yours. Perhaps
someone with a windows gnucash development platform would be willing
to contact me and together we could run some more tests.

Regards,

Alex



More information about the gnucash-user mailing list