[GNC] Should the gnc-fq-* helper scripts be invoked as commands, or as an arg to perl?

Jim DeLaHunt list+gnucash at jdlh.com
Sun Jun 13 23:44:18 EDT 2021


On 2021-06-13 00:39, Jim DeLaHunt wrote:

> Am I correct in guessing that GnuCash 4.5 internally invokes these 
> scripts (maybe just gnc-fq-helper) as an argument to a perl command?

After a fairly quick read of the source code, I think the answer is, 
"Yes, for over 14 years". I see in gnucash/price-quotes.scm:120-122:

     (define (start-quoter)
           (set! quoter
             (gnc-spawn-process-async (list "perl" "-w" 
gnc:*finance-quote-helper*) #t)))

I interpret this as meaning that GnuCash fetches quotes by spawning a 
process with arguments like:

perl -w /path/to/helpers/gnc-fq-helper ...[args giving security for 
which to get quotes]...

It looks to me like this code has been much the same since commit 
c38bcd3 on 2007-04-28.  Looking at the code it replaced, I suspect that 
GnuCash used to invoke the scripts directly, without the "perl" "-w" 
part. But that was long ago.

There are comments in libgnucash/quotes/gnc-fq-help.in:75,92 which imply 
direct invocation. They have examples like:

$ echo '(alphavantage "CSCO" "JDSU" "^IXIC")' | ./gnc-fq-helper

But that will only get read by developers, who aren't as easily misled 
as non-developer users.


> If so, should the wiki page 
> https://wiki.gnucash.org/wiki/Online_Quotes use the same invocation?

I am now of the opinion that, yes, it should.

I think that we should guide users to invoke the helper scripts is a 
similar way to how GnuCash actually invokes them. This will help reduce 
user confusion, by making their results more closely match GnuCash's 
results.

I propose to change every invocation on that page from a bare name of 
the helper script

e.g. gnc-fq-dump currency USD EUR

to something like

perl -w gnc-fq-dump currency USD EUR

I will also make sure there is a clear explanation that the above 
abbreviates the path to the helper scripts and the AlphaVantage key. The 
actual invocation is actually more like:

$ ALPHAVANTAGE_API_KEY=01234ABCD perl -w 
/Applications/Gnucash.app/Contents/Resources/bin/gnc-fq-dump currency 
USD EUR

I will also deemphasise the mention of the shebang (#!). It looks like 
the invocation which GnuCash actually uses does not rely on shebang, so 
we should not be leading users to pay attention to it.


Are there objections to me being bold and making such changes?

Best regards,
      —Jim DeLaHunt




More information about the gnucash-user mailing list