I get a seg fault from the g.parser module if I have a stray
#%option
in the script before the call to g.parser.
What do you mean by "stray"? Without a "%key:" line?
Obviously wrong syntax, but maybe it should fail in a more graceful manner...
My guess is that G_parser() dereferences the "key" field without
checking that it is non-NULL.
I suspect there are probably other ways in which you can construct
options which G_parser() won't like. I'm not sure how practical it is
to fix this in g.parser rather than G_parser() itself.
> Subject: g.parser: SegFault
>
> I get a seg fault from the g.parser module if I have a stray
> #%option
>
> in the script before the call to g.parser.
What do you mean by "stray"? Without a "%key:" line?
Without #%end even. I commented out an option but missed the first line.
Thus just a #%option line by itself before the g.parser call.
> Obviously wrong syntax, but maybe it should fail in a more graceful
> manner...
My guess is that G_parser() dereferences the "key" field without
checking that it is non-NULL.
I suspect there are probably other ways in which you can construct
options which G_parser() won't like. I'm not sure how practical it is
to fix this in g.parser rather than G_parser() itself.