GNOME Bugzilla – Bug 629712
Crash in inner_main_get_price_quotes when running from bundle
Last modified: 2018-06-29 22:44:47 UTC
On Sep 14, 2010, at 1:37 PM, David T. wrote: I guess this question is directed mostly to John Ralls: If I wanted to adopt Frank's suggestion of a shell script for this, how might I do it in the Mac OS X realm that you have packaged? In a terminal window, I tried: dhtmbp:~ david$ /Applications/Gnucash.app/Contents/MacOS/Gnucash --add-price-quotes Found Finance::Quote version 1.15 Abort trap OS X also gave me an application crash. Then I tried: dhtmbp:~ david$ /Applications/Gnucash.app/Contents/MacOS/Gnucash --add-price-quotes=/Volumes/Records/Financials/My\ Accounts /Applications/Gnucash.app/Contents/MacOS/Gnucash: line 130: [: too many arguments Found Finance::Quote version 1.15 Abort trap With another system crash. Note: This succeeds when run from the build directory and crashes when run in a bundle. In src/bin/gnucash-bin.c, in inner_main_get_price_quotes, is the snippet: /* Don't load the modules since the stylesheet module crashes if the GUI is not initialized */ #ifdef PRICE_QUOTES_NEED_MODULES load_gnucash_modules(); #endif
Created attachment 170290 [details] Crash Report on inner_main_get_price_quotes crash
I've not used the Quartz version of GnuCash on MacOSX, so I don't know what's wrong, but that code snippet isn't what is crashing since it generates no code. PRICE_QUOTES_NEED_MODULES is never set so the call to load_gnucash_modules is not compiled. That call was crashing which is why I put the ifdef around it. I did it that way instead of deleting it entirely so anyone tempted to put it back would know why I had deleted it.
OK, but look at the crash dump in the attachment. Frames 71 and 72 show that it's executing. No, I don't know how that can happen, and the only way to find out is to make a debug build and step through it.
I won't be able to look at this for at least 10 days. I'm in Italy right now and won't be home for a while. I have neither the facilities nor the time to work on it here. I also have never built the Quartz version of GnuCash and don't have the prerequisites installed. Since I know it works fine in the X11 version on MacOSX, it must be something about the Quartz version that is causing trouble. It would be much better if someone who is (a) at home and (b) able to build the Quartz version looks at this. If no one else is able to look at this, I'll try to do something around the beginning of October.
Hmmph. I just tried this with a bundle of r19911, and it worked fine: Gnucash Gnucash-bin $ manjusri:ash-svn/src/gnucash-svn> ~/Gnucash.app/Contents/MacOS/Gnucash --add-price-quotes This is a development version. It may or may not work. Report bugs and other problems to gnucash-devel@gnucash.org. You can also lookup and file bug reports at http://bugzilla.gnome.org The last stable version was GnuCash 2.2.9 The next stable version will be GnuCash 2.4 Found Finance::Quote version 1.17 $ manjusri:ash-svn/src/gnucash-svn> ~/Gnucash.app/Contents/MacOS/Gnucash --add-price-quotes=/Users/john/Accounts/household This is a development version. It may or may not work. Report bugs and other problems to gnucash-devel@gnucash.org. You can also lookup and file bug reports at http://bugzilla.gnome.org The last stable version was GnuCash 2.2.9 The next stable version will be GnuCash 2.4 Found Finance::Quote version 1.17 $ manjusri:ash-svn/src/gnucash-svn> ls -l ~/Accounts/household -rw-r--r-- 1 john staff 31863080 Dec 7 16:10 /Users/john/Accounts/household $ manjusri:ash-svn/src/gnucash-svn> ls -l ~/Accounts/household.db.gnucash -rw-r--r-- 1 john staff 19041280 Dec 7 14:49 /Users/john/Accounts/household.db.gnucash $ manjusri:ash-svn/src/gnucash-svn> ~/Gnucash.app/Contents/MacOS/Gnucash --add-price-quotes=/Users/john/Accounts/household.db.gnucash This is a development version. It may or may not work. Report bugs and other problems to gnucash-devel@gnucash.org. You can also lookup and file bug reports at http://bugzilla.gnome.org The last stable version was GnuCash 2.2.9 The next stable version will be GnuCash 2.4 Found Finance::Quote version 1.17 $ manjusri:ash-svn/src/gnucash-svn> ls -l ~/Accounts/household.db.gnucash-rw-r--r-- 1 john staff 19041280 Dec 7 16:13 /Users/john/Accounts/household.db.gnucash $ manjusri:ash-svn/src/gnucash-svn>
I also ran it successfully with 2.3.17 from my /Applications folder. David, can you try it with 2.3.17 and see if it still crashes for you?
Well, it doesn't crash--I'll say that. It also doesn't update the stock prices, unfortunately.
Try updating prices from the GUI and see what error messages you get. You may have something configured wrong or some price updates are failing for some reason.
GUI Get Quotes returns no errors, and a full complement of updated prices. I can't imagine why it would affect anything, but I note that I do have a number of stocks that do not have the Check Online box ticked; these are stocks that I no longer own, or which have been superceded by mergers or other actions. This doesn't affect GUI retrieval, though.
(In reply to comment #8) > Well, it doesn't crash--I'll say that. > > It also doesn't update the stock prices, unfortunately. Odd. It did mine. Is there anything in gnucash.trace that might be helpful?
Following instructions here: http://wiki.gnucash.org/wiki/Stack_Trace, I get: dhtmbp:~ david$ gdb "/Applications/Gnucash-2.3.17.app/Contents/MacOS/Gnucash-bin --add-price-quotes" GNU gdb 6.3.50-20050815 (Apple version gdb-768) (Tue Oct 2 04:07:49 UTC 2007) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-apple-darwin"..."/Applications/Gnucash-2.3.17.app/Contents/MacOS/Gnucash": not in executable format: File format not recognized (gdb) run Starting program: No executable file specified. Or is there something else you're asking for?
Yeah, the trace file. It's /var/folders/something/something_longer/-Tmp-/gnucash.trace (something is 2 random characters and something longer is a bunch of random characters. It's a mystery to me how and how often they're generated, but that's not really important.) `find /var/folders -name gnucash.trace` will get you the path. It has all of the log output from the current/last gnucash session. You can get more by adding options when you launch gnucash from the command line (--help will explain them; Gnucash.app/Contents/MacOS/Gnucash already adds --debug).
Created attachment 176207 [details] Trace from Mac not getting quotes
Here is the trace file. It ends abruptly, and there's mention of SQLite loading (my file is XML still).
Here's what's going on: Gnucash, the launcher file, invokes Gnucash-bin as exec "$bundle_contents/MacOS/Gnucash-bin $* $EXTRA_ARGS where EXTRA_ARGS=--debug, so when you add --add-price-quotes to the command line, it's invoked as Gnucash-bin --add-price-quotes --debug. Add price quotes requires an argument, so the command line parser gives it --debug, which isn't a valid file name, so it fails. It fails in the sqlite3 backend because unless the filename looks like a fully qualified path, that's where Gnucash sends it. If you want to use ~ in your path, use --add-price-quotes ~/foo instead of --add-price-quotes=~/foo, because the shell won't expand the ~ unless it starts a token, and Gnucash doesn't know how to expand it. (Reversing the $* and $EXTRA_ARGS and then passing --add-price-quotes without a filename gets you * 16:32:35 WARN <gnc.bin> Error parsing command line arguments: [Missing argument for --add-price-quotes]; try `gnucash --help` for available options. on the terminal. Since that's vastly preferable to silently failing, I'll switch it for future packages. I'm also about to check in a change which actually provides an error message to print so that the last line in gnucash.trace isn't just "System Error:".
Well. The problem here has to do with the fact that my data file is "My Accounts". The ~ is immaterial, since my data file lives in a separate disk image outside of my home directory. No combination of quotation marks or Unix character escaping will work to run the get-price-quotes on my file when it has this name. When I renamed my file "Accounts", the routine ran successfully. I'm not sure how that's supposed to be fixed, but this will no doubt come back to bite someone down the line.
That's a different problem than the crash, but it's a valid problem.
It would appear that the original crash is fixed in 2.3.17. I will put in a new bbug for the filename parsing under OS X.
Which is Bug 637414. Closing this one, as that's the current problem.
Unfortunately, I am receiving this problem again under 2.4.0, and the filename does not contain any spaces. For reference, the filename is AllAccounts.gnucash. Attempts to use the command: /Applications/Gnucash.app/Contents/MacOS/Gnucash --add-price-quotes /Volumes/Records/Financials/AllAccounts.gnucash yield no modifications to the AllAccounts.gnucash data file. I will double-check gnucash.trace later today to see what is there (last night when I tried that, I ran into load-time problems that distracted me from looking for this problem).
Created attachment 178093 [details] This is the latest trace file. It shows errors accessing SQLite3 file
It seems that add-price-quotes is assuming that all files are sql?
No, it just looks for sqlite3 files first, so if the filename that you give it doesn't exist it's the sqlite3 routine that throws the error. PEBKAC: Sqlite3 file /Volumes/Records/Financials/AllAcounts.gnucash not found ^
Indeed. In the example enclosed, it is user error. I will double-check whether it is remedied by using file that actually exists; ISTR that I received errors with other iterations of the command. 8-)
... which were all wrong as well. Sorry (he says sheepishly). This *does* indicate that a configuration option would be useful--for me at least!
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=629712. Please update any external references or bookmarks.