Can't update preferences and can't get rid of Welcome dialog in Gnucash 2.4.7 (OS X 2.6.8)

prl prl at ozemail.com.au
Tue Aug 9 00:20:34 EDT 2011


On 9/08/11 12:49, John Ralls wrote:
> On Aug 8, 2011, at 3:45 PM, prl wrote:
>
>> On 9/08/11 4:48, John Ralls wrote:
>>> It seems that both "$*" and "$@" work, at least on Snow Leopard. I think, though, that "$@" is a bit safer, so I'll put that into the next release. Thanks.
>>>
>>> Regards,
>>> John Ralls
>>>
>> Hi, John. In this context, "$@" is IMO the correct subtitution (and not just "a bit safer").
>>
>> "$*" expands as "$1 $2 $3 $4 ..."
>> "$@" expands as "$1" "$2" "$3" "$4" ...
>>
>> So, for example, if you ran:
>> /Applications/.../Gnucash --extra --logto="/path/that has/spaces"
>>
>> The --debug comes from $EXTRA_ARGS.
>>
>> If you use "$@" then the final effect of the script would be:
>>     exec /Applications/.../Gnucash-bin --debug "--extra" "--logto=/path/that has/spaces"
>> which is correct.
>>
>> However, if you use "$*", then the final effect is:
>>     exec /Applications/.../Gnucash-bin --debug "--extra --logto=/path/that has/spaces"
>> which is really not what you want.
>>
>> I think that what you've tested may not adequately test the difference between "$*" and "$@". They have the same effect if at the time that they are expanded, there is only one command-line argument. They only behave differently if, when they are expanded, there are two or more command line arguments, as in the example I've given above.
> No arguments, but it sure looks to me that g_option_context_parse can figure it out, which is why I say "safer". But you're right, I didn't test it rigorously enough to be sure. If it does break, it will be with "--logto=/path/that has/spaces --extra", so g_option can't assume that everything after the "=" belongs to logto.
>
> Anyway, no sense in arguing about it, it went in as "$@".
>
> Regards,
> John Ralls

I tested it. I changed my Gnucash script to run Gnucash-bin as:
     $EXEC "$bundle_contents/MacOS/$name-bin" $EXTRA_ARGS "$*"

and I ran:
     /Applications/Gnucash.app/Contents/MacOS/Gnucash --logto=/path/that 
has/spaces --extra

And I got the error I expected:
     * 13:30:32  CRIT <qof.log> Cannot open log output file "/path/that 
has/spaces --extra", using stderr.

That is, the --logto and --extra options are being passed as a single 
argument into Gnucash-bin, and g_option_context_parse() doesn't try to 
parse for more than one long option inside an argument, and so includes 
" --extra" as part of the filename argument of --logto.

g_option_context_parse() is working in just the way that I'd expect a 
Unix argument parser to work.

There really is a big difference between "$@" and "$*", and I'm strongly 
of the opinion that "$@" is correct to use in this context, and not just 
"a bit safer".

Regards,
Peter


More information about the gnucash-user mailing list