how to patch GnuCash?

I run FBSD 7.1 and have gnucash-2.2.7_2 installed. Gnucash worked great till last week. I updated some ports, and afterward gnucash crashes with segfault 11 when trying to open an account. The only apparent error with gnucash is opening an account - even with a completely new file.

Searching led me here:
http://svn.gnucash.org/trac/changeset/17747
http://www.freebsd.org/cgi/query-pr.cgi?pr=133748

The reported problem sounds similar to mine. I want to either patch gnucash as described in the first link or portdowngrade to glib-2.18.4, the version I had installed when gnucash last worked.

I've never patched a diff file. I tried to get around it by manually editing the 2 c source files, since it's only a few lines. I used
Code:
cd /usr/ports/finance/gnucash
make

to unpack the tarball and set up the work directory. After which I edited the two source files. And then I'm stuck because issuing
Code:
make
again doesn't do anything. Is there an option, switch or target that will "re-build" even if the target has already been built?

Better yet, how can I patch the source the right way?

I was able to use portdowngrade to retrieve the version of glib I wanted. but
Code:
portupgrade -f glib
failed because "Patch patch-ae failed to apply cleanly."

A follow on question: if the patches are checked into svn, as the above URLs suggest, have they just not been released to the FreeBSD ports tree yet? I deleted the distfile, did cvsup, re-fetched latest gnucash distfile, and found no changes. I'm hoping the the changes suggest above work, and I can apply them. Else I'll be asking how to patch glib so I can biuld/install the 2.18 version ..

Thanks in advance
 
[SOLVED] patch gnucash

I found the answer I was looking for in the Porter's Handbook instead of the regular Handbook.

In sum I did
Code:
cd /usr/ports/finance/gnucash
make fetch
make extract
here I edited the source files as described in previous post. Then
Code:
make build
make deinstall
make reinstall
And the suggested fix really seems to work. Gnucash appears to be working as well as it ever has.

The section on patching isn't crystal clear to me yet. That's probably the preferred way to make the fix. But the above hack seems to have done the trick for now.
 
jarv said:
this didn't work for me sadly

I applied the patch in completely manual fashion, and it works. Here's how:

1. Copy /usr/ports/distfiles/gnucash-2.2.7.tar.bz2 to /tmp
2. cd /tmp
3. tar xjf gnucash-2.2.7.tar.bz2
4. You will now have a /tmp/gnucash-2.2.7 directory. Make the edits (two .c files) as specified in the description of the gnucash patch.
5. In the shell, with /tmp as the working directory,
tar cjf gnucash-2.2.7.tar.bz2 gnucash-2.2.7
6. md5 gnucash-2.2.7.tar.bz2 and replace the first line of /usr/ports/finance/gnucash/distinfo with the output.
7. sha256 gnucash-2.2.7.tar.bz2 and replace the second line of
/usr/ports/finance/gnucash/distinfo with the output.
8. ls -l gnucash-2.2.7.tar.bz2 and replace the number after the = sign in the third line of the distinfo file with the file size in the ls -l output (the number between the group and the month).
9. Save the edited /usr/ports/finance/gnucash/distinfo file.
10. Copy /tmp/gnucash-2.2.7.tar.bz2 to /usr/ports/distfiles.
11. In a root shell, cd /usr/ports/finance/gnucash
12. make deinstall
13. make install clean

During the above, you will like get errors of the form
Code:
===>  Checking if finance/p5-Finance-QuoteHist already installed
===>   p5-Finance-QuoteHist-1.11_1 is already installed
      You may wish to ``make deinstall'' and install this port again
      by ``make reinstall'' to upgrade it properly.
      If you really wish to overwrite the old port of finance/p5-Finance-QuoteHist
      without deleting it first, set the variable "FORCE_PKG_REGISTER"
      in your environment or the "make install" command line.
*** Error code 1
Follow the advice and go to the directory mentioned in the "Checking if" line and do a make deinstall. Then return to the finance/gnucash directory and do the make install clean again. Keep doing this until gnucash and gnucash-docs installs and if you have done the edits and followed these directions correctly, you will have a working gnucash 2.2.7.

The method described in the other post that was successful is probably preferable to mine, using the ports tools more correctly. I concocted this method in ignorance of the Porter's Manual (I'm a relatively new FreeBSD user). But I mention it since you were not successful using his method, and perhaps mine will get your gnucash working for you again.

/Don Allen
 
Back
Top