* [Cocci] Sources with high badcount
@ 2018-01-04 13:37 Francois-Xavier Le Bail
2018-01-04 13:49 ` Julia Lawall
2018-01-04 14:09 ` Julia Lawall
0 siblings, 2 replies; 7+ messages in thread
From: Francois-Xavier Le Bail @ 2018-01-04 13:37 UTC (permalink / raw)
To: cocci
Hi,
I got high badcounts with some sources.
One of them is:
https://raw.githubusercontent.com/the-tcpdump-group/tcpdump/master/print-bootp.c
Options are: --debug --verbose-parsing --no-includes
Partial log is:
=======================================================================
init_defs_builtins: /usr/local/bin/../lib/coccinelle/standard.h
-----------------------------------------------------------------------
processing semantic patch file: ../u_char_p.cocci
with isos from: /usr/local/bin/../lib/coccinelle/standard.iso
-----------------------------------------------------------------------
@@
u_char *p;
@@
* p
HANDLING: print-bootp.c
-----------------------------------------------------------------------
let's go
-----------------------------------------------------------------------
-----------------------------------------------------------------------
ERROR-RECOV: found sync '}' at line 402
parsing pass2: try again
(ONCE) CPP-DEFINE: inside function, I treat it as comment
(ONCE) CPP-UNDEF: inside function, I treat it as comment
ERROR-RECOV: found sync '}' at line 402
parsing pass3: try again
PB: not found closing brace in fuzzy parsing
ERROR-RECOV: found sync '}' at line 402
parsing pass4: try again
PB: not found closing brace in fuzzy parsing
ERROR-RECOV: found sync '}' at line 402
parse error
= File "print-bootp.c", line 1116, column 0, charpos = 31388
around = '',
whole content =
badcount: 125
bad: };
bad:
bad: /*
bad: * Print bootp requests
bad: */
bad: void
bad: bootp_print(netdissect_options *ndo,
bad: const u_char *cp, u_int length)
bad: {
bad: const struct bootp *bp;
bad: static const u_char vm_cmu[4] = VM_CMU;
bad: static const u_char vm_rfc1048[4] = VM_RFC1048;
bad: uint8_t bp_op, bp_htype, bp_hlen;
bad:
bad: bp = (const struct bootp *)cp;
bad: ND_TCHECK(bp->bp_op);
bad: bp_op = EXTRACT_U_1(bp->bp_op);
bad: ND_PRINT((ndo, "BOOTP/DHCP, %s",
bad: tok2str(bootp_op_values, "unknown (0x%02x)", bp_op)));
bad:
[...]
=======================================================================
The line 402 is the closing '}' of the 'bootp_print' function.
Any clue ?
--
Francois-Xavier
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cocci] Sources with high badcount
2018-01-04 13:37 [Cocci] Sources with high badcount Francois-Xavier Le Bail
@ 2018-01-04 13:49 ` Julia Lawall
2018-01-04 14:09 ` Julia Lawall
1 sibling, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2018-01-04 13:49 UTC (permalink / raw)
To: cocci
On Thu, 4 Jan 2018, Francois-Xavier Le Bail wrote:
> Hi,
>
> I got high badcounts with some sources.
What is strange is that there is no BAD line. I will try to see what the
problem is.
julia
>
> One of them is:
> https://raw.githubusercontent.com/the-tcpdump-group/tcpdump/master/print-bootp.c
>
> Options are: --debug --verbose-parsing --no-includes
> Partial log is:
> =======================================================================
> init_defs_builtins: /usr/local/bin/../lib/coccinelle/standard.h
> -----------------------------------------------------------------------
> processing semantic patch file: ../u_char_p.cocci
> with isos from: /usr/local/bin/../lib/coccinelle/standard.iso
> -----------------------------------------------------------------------
> @@
> u_char *p;
> @@
> * p
>
> HANDLING: print-bootp.c
> -----------------------------------------------------------------------
> let's go
> -----------------------------------------------------------------------
> -----------------------------------------------------------------------
> ERROR-RECOV: found sync '}' at line 402
> parsing pass2: try again
> (ONCE) CPP-DEFINE: inside function, I treat it as comment
> (ONCE) CPP-UNDEF: inside function, I treat it as comment
> ERROR-RECOV: found sync '}' at line 402
> parsing pass3: try again
> PB: not found closing brace in fuzzy parsing
> ERROR-RECOV: found sync '}' at line 402
> parsing pass4: try again
> PB: not found closing brace in fuzzy parsing
> ERROR-RECOV: found sync '}' at line 402
> parse error
> = File "print-bootp.c", line 1116, column 0, charpos = 31388
> around = '',
> whole content =
> badcount: 125
> bad: };
> bad:
> bad: /*
> bad: * Print bootp requests
> bad: */
> bad: void
> bad: bootp_print(netdissect_options *ndo,
> bad: const u_char *cp, u_int length)
> bad: {
> bad: const struct bootp *bp;
> bad: static const u_char vm_cmu[4] = VM_CMU;
> bad: static const u_char vm_rfc1048[4] = VM_RFC1048;
> bad: uint8_t bp_op, bp_htype, bp_hlen;
> bad:
> bad: bp = (const struct bootp *)cp;
> bad: ND_TCHECK(bp->bp_op);
> bad: bp_op = EXTRACT_U_1(bp->bp_op);
> bad: ND_PRINT((ndo, "BOOTP/DHCP, %s",
> bad: tok2str(bootp_op_values, "unknown (0x%02x)", bp_op)));
> bad:
> [...]
> =======================================================================
>
> The line 402 is the closing '}' of the 'bootp_print' function.
>
> Any clue ?
>
> --
> Francois-Xavier
> _______________________________________________
> Cocci mailing list
> Cocci at systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cocci] Sources with high badcount
2018-01-04 13:37 [Cocci] Sources with high badcount Francois-Xavier Le Bail
2018-01-04 13:49 ` Julia Lawall
@ 2018-01-04 14:09 ` Julia Lawall
2018-01-04 14:48 ` Francois-Xavier Le Bail
1 sibling, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2018-01-04 14:09 UTC (permalink / raw)
To: cocci
On Thu, 4 Jan 2018, Francois-Xavier Le Bail wrote:
> Hi,
>
> I got high badcounts with some sources.
Actually, in this case there are just some parse errrors in the code.
ND_PRINT((ndo, " from %s", etheraddr_string(... (line 302)
This is missing one )
ND_PRINT((ndo, ", hops %d", EXTRACT_U_1(... (line 322)
This has one ) too many.
julia
>
> One of them is:
> https://raw.githubusercontent.com/the-tcpdump-group/tcpdump/master/print-bootp.c
>
> Options are: --debug --verbose-parsing --no-includes
> Partial log is:
> =======================================================================
> init_defs_builtins: /usr/local/bin/../lib/coccinelle/standard.h
> -----------------------------------------------------------------------
> processing semantic patch file: ../u_char_p.cocci
> with isos from: /usr/local/bin/../lib/coccinelle/standard.iso
> -----------------------------------------------------------------------
> @@
> u_char *p;
> @@
> * p
>
> HANDLING: print-bootp.c
> -----------------------------------------------------------------------
> let's go
> -----------------------------------------------------------------------
> -----------------------------------------------------------------------
> ERROR-RECOV: found sync '}' at line 402
> parsing pass2: try again
> (ONCE) CPP-DEFINE: inside function, I treat it as comment
> (ONCE) CPP-UNDEF: inside function, I treat it as comment
> ERROR-RECOV: found sync '}' at line 402
> parsing pass3: try again
> PB: not found closing brace in fuzzy parsing
> ERROR-RECOV: found sync '}' at line 402
> parsing pass4: try again
> PB: not found closing brace in fuzzy parsing
> ERROR-RECOV: found sync '}' at line 402
> parse error
> = File "print-bootp.c", line 1116, column 0, charpos = 31388
> around = '',
> whole content =
> badcount: 125
> bad: };
> bad:
> bad: /*
> bad: * Print bootp requests
> bad: */
> bad: void
> bad: bootp_print(netdissect_options *ndo,
> bad: const u_char *cp, u_int length)
> bad: {
> bad: const struct bootp *bp;
> bad: static const u_char vm_cmu[4] = VM_CMU;
> bad: static const u_char vm_rfc1048[4] = VM_RFC1048;
> bad: uint8_t bp_op, bp_htype, bp_hlen;
> bad:
> bad: bp = (const struct bootp *)cp;
> bad: ND_TCHECK(bp->bp_op);
> bad: bp_op = EXTRACT_U_1(bp->bp_op);
> bad: ND_PRINT((ndo, "BOOTP/DHCP, %s",
> bad: tok2str(bootp_op_values, "unknown (0x%02x)", bp_op)));
> bad:
> [...]
> =======================================================================
>
> The line 402 is the closing '}' of the 'bootp_print' function.
>
> Any clue ?
>
> --
> Francois-Xavier
> _______________________________________________
> Cocci mailing list
> Cocci at systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cocci] Sources with high badcount
2018-01-04 14:09 ` Julia Lawall
@ 2018-01-04 14:48 ` Francois-Xavier Le Bail
2018-01-04 14:53 ` Julia Lawall
0 siblings, 1 reply; 7+ messages in thread
From: Francois-Xavier Le Bail @ 2018-01-04 14:48 UTC (permalink / raw)
To: cocci
On 04/01/2018 15:09, Julia Lawall wrote:
>
>
> On Thu, 4 Jan 2018, Francois-Xavier Le Bail wrote:
>
>> Hi,
>>
>> I got high badcounts with some sources.
>
> Actually, in this case there are just some parse errrors in the code.
>
> ND_PRINT((ndo, " from %s", etheraddr_string(... (line 302)
> This is missing one )
>
> ND_PRINT((ndo, ", hops %d", EXTRACT_U_1(... (line 322)
> This has one ) too many.
Bingo !
Thank you.
Do you have an option or a tool to find these errors ?
Because neither gcc nor clang find them !
--
Francois-Xavier
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cocci] Sources with high badcount
2018-01-04 14:48 ` Francois-Xavier Le Bail
@ 2018-01-04 14:53 ` Julia Lawall
2018-01-04 15:10 ` Francois-Xavier Le Bail
0 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2018-01-04 14:53 UTC (permalink / raw)
To: cocci
On Thu, 4 Jan 2018, Francois-Xavier Le Bail wrote:
> On 04/01/2018 15:09, Julia Lawall wrote:
> >
> >
> > On Thu, 4 Jan 2018, Francois-Xavier Le Bail wrote:
> >
> >> Hi,
> >>
> >> I got high badcounts with some sources.
> >
> > Actually, in this case there are just some parse errrors in the code.
> >
> > ND_PRINT((ndo, " from %s", etheraddr_string(... (line 302)
> > This is missing one )
> >
> > ND_PRINT((ndo, ", hops %d", EXTRACT_U_1(... (line 322)
> > This has one ) too many.
>
> Bingo !
>
> Thank you.
>
> Do you have an option or a tool to find these errors ?
> Because neither gcc nor clang find them !
No. Actually the parser is built on the assumption that the code has been
approved by the compiler. I'm really puzzled why gcc/clang did not
complain. Perhaps the whole fils is just ifdefd out.
I don't know why it didn't put BAD on some line, but I guess it was pretty
disoriented. It already seems to have a special handling of macros that
have a single argument that is an argument list, ie ND_PRINT. That macro
is mentioned at the top of the --parse-c output. Maybe it can be helpful
to look around the things that are mentioned there.
julia
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cocci] Sources with high badcount
2018-01-04 14:53 ` Julia Lawall
@ 2018-01-04 15:10 ` Francois-Xavier Le Bail
2018-01-04 15:19 ` Julia Lawall
0 siblings, 1 reply; 7+ messages in thread
From: Francois-Xavier Le Bail @ 2018-01-04 15:10 UTC (permalink / raw)
To: cocci
On 04/01/2018 15:53, Julia Lawall wrote:
>
>
> On Thu, 4 Jan 2018, Francois-Xavier Le Bail wrote:
>
>> On 04/01/2018 15:09, Julia Lawall wrote:
>>>
>>>
>>> On Thu, 4 Jan 2018, Francois-Xavier Le Bail wrote:
>>>
>>>> Hi,
>>>>
>>>> I got high badcounts with some sources.
>>>
>>> Actually, in this case there are just some parse errrors in the code.
>>>
>>> ND_PRINT((ndo, " from %s", etheraddr_string(... (line 302)
>>> This is missing one )
>>>
>>> ND_PRINT((ndo, ", hops %d", EXTRACT_U_1(... (line 322)
>>> This has one ) too many.
>>
>> Bingo !
>>
>> Thank you.
>>
>> Do you have an option or a tool to find these errors ?
>> Because neither gcc nor clang find them !
>
> No. Actually the parser is built on the assumption that the code has been
> approved by the compiler. I'm really puzzled why gcc/clang did not
> complain. Perhaps the whole fils is just ifdefd out.
Not ifdefd out in this case.
> I don't know why it didn't put BAD on some line, but I guess it was pretty
> disoriented. It already seems to have a special handling of macros that
> have a single argument that is an argument list, ie ND_PRINT. That macro
> is mentioned at the top of the --parse-c output. Maybe it can be helpful
> to look around the things that are mentioned there.
After doing the ')' fixes. I got:
BAD:!!!!! bp = (const struct bootp *);
The source line is:
bp = (const struct bootp *)cp;
I have also the message 'set verbose_parsing for more info' but the '--verbose-parsing' option was used.
--
Francois-Xavier
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Cocci] Sources with high badcount
2018-01-04 15:10 ` Francois-Xavier Le Bail
@ 2018-01-04 15:19 ` Julia Lawall
0 siblings, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2018-01-04 15:19 UTC (permalink / raw)
To: cocci
On Thu, 4 Jan 2018, Francois-Xavier Le Bail wrote:
> On 04/01/2018 15:53, Julia Lawall wrote:
> >
> >
> > On Thu, 4 Jan 2018, Francois-Xavier Le Bail wrote:
> >
> >> On 04/01/2018 15:09, Julia Lawall wrote:
> >>>
> >>>
> >>> On Thu, 4 Jan 2018, Francois-Xavier Le Bail wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> I got high badcounts with some sources.
> >>>
> >>> Actually, in this case there are just some parse errrors in the code.
> >>>
> >>> ND_PRINT((ndo, " from %s", etheraddr_string(... (line 302)
> >>> This is missing one )
> >>>
> >>> ND_PRINT((ndo, ", hops %d", EXTRACT_U_1(... (line 322)
> >>> This has one ) too many.
> >>
> >> Bingo !
> >>
> >> Thank you.
> >>
> >> Do you have an option or a tool to find these errors ?
> >> Because neither gcc nor clang find them !
> >
> > No. Actually the parser is built on the assumption that the code has been
> > approved by the compiler. I'm really puzzled why gcc/clang did not
> > complain. Perhaps the whole fils is just ifdefd out.
>
> Not ifdefd out in this case.
>
> > I don't know why it didn't put BAD on some line, but I guess it was pretty
> > disoriented. It already seems to have a special handling of macros that
> > have a single argument that is an argument list, ie ND_PRINT. That macro
> > is mentioned at the top of the --parse-c output. Maybe it can be helpful
> > to look around the things that are mentioned there.
>
> After doing the ')' fixes. I got:
> BAD:!!!!! bp = (const struct bootp *);
>
> The source line is:
> bp = (const struct bootp *)cp;
>
> I have also the message 'set verbose_parsing for more info' but the '--verbose-parsing' option was used.
My output is as follows for spatch --parse-c print-bootp.c. I have
attached my corrected file.
julia
init_defs_builtins: /home/jll/coccinelle/standard.h
PARSING: print-bootp.c
(ONCE) CPP-found define initializer: VM_RFC1048
(ONCE) CPP-TYPEDEF: promoting:(2) nd_byte on line 71
(ONCE) CPP-TYPEDEF: promoting:(5) netdissect_options on line 264
TYPEDEF CONFLICT:uint32_t
transforming some ident into a typedef
-----------------------------------------------------------------------
maybe 10 most problematic tokens
-----------------------------------------------------------------------
-----------------------------------------------------------------------
NB total files = 1; perfect = 1; pbs = 0; timeout = 0; =========> 100%
nb good = 1114, nb passed = 0 =========> 0.00% passed
nb good = 1114, nb bad = 0 =========> 100.00% good or passed
>
> --
> Francois-Xavier
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: print-bootp.c
Type: text/x-csrc
Size: 32503 bytes
Desc:
URL: <https://systeme.lip6.fr/pipermail/cocci/attachments/20180104/0c63ffdf/attachment-0001.bin>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-01-04 15:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-04 13:37 [Cocci] Sources with high badcount Francois-Xavier Le Bail
2018-01-04 13:49 ` Julia Lawall
2018-01-04 14:09 ` Julia Lawall
2018-01-04 14:48 ` Francois-Xavier Le Bail
2018-01-04 14:53 ` Julia Lawall
2018-01-04 15:10 ` Francois-Xavier Le Bail
2018-01-04 15:19 ` Julia Lawall
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.