new auparse question
I have an issue now with auparse_find_field.
I work around it fine though but maybe it's worth reporting. There is a place where I do this:
const char *result;
...
result=auparse_find_field(au, "res");
and get a segfault.
If I instead do this:
const char *result;
...auparse_first_field(au);
result=auparse_find_field(au, "res");
then it is fine.
A quick gdb test shows me :
0x00007ffff7dd2a7d in nvlist_get_cur_name (au=0x617a90, name=0x4022a8 "res") at nvlist.h:40
40 static inline const char *nvlist_get_cur_name(const nvlist *l)
{return l->cur->name;}
Looking at my own code, I believe I previously had walked through the event record using this loop:
...auparse_first_field(au);
do {
...
} while (auparse_next_field(au) > 0);
...
and so I guess that the "cur" field was undefined when used the auparse_find_field call.
It (auparse_find_field) calls:
...cur_name = nvlist_get_cur_name(&r->nv);
and I guess that's were the problem happened.
So my question is - is this a bug (I would think so) or should I always precede any auparse call sequence with at least one fresh auparse_first_field call?
Thx,
LCB
Signature · 2 lines
LC (Lenny) Bruzenak [email protected]
Quoted 3 lines · LC Bruzenak
So my question is - is this a bug (I would think so) or should I always precede any auparse call sequence with at least one fresh
auparse_first_fieldcall?
A segfault is a bug as far as this library is concerned. I know other libraries let you segfault if you do something wrong. I'll try to make a reproducer and see what's going on.
-Steve
Quoted 8 lines · Steve Grubb
Quoted 3 lines · LC Bruzenak
So my question is - is this a bug (I would think so) or should I always precede any auparse call sequence with at least one fresh
auparse_first_fieldcall?A segfault is a bug as far as this library is concerned. I know other libraries let you segfault if you do something wrong. I'll try to make a reproducer and see what's going on.
Patch applied to svn:
https://fedorahosted.org/audit/changeset/567
-Steve