* [Cocci] hi all, how to match the args in function @ 2014-01-02 8:27 林嘉(程二 福州) [not found] ` <alpine.DEB.2.02.1401020939060.2182@localhost6.localdomain6> 0 siblings, 1 reply; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-01-02 8:27 UTC (permalink / raw) To: cocci I just began to learn cocci recently. How to write a patch match the following? Void func1(int s, bri_vlan_set_t t, char x) yes Void func2(int s, char x) no Void func3(int s, bri_vlan_set_t t) yes bri_vlan_set_t is defined type I wrote: @@ identifier fn, vp; typedef bri_vlan_set_t; @@ -fn(...bri_vlan_set_t vp...) But it reports Fatal error: exception Failure("minus: parse error: = File "r.cocci", line 5, column 7, charpos = 60 around = 'bri_vlan_set_t', whole content = -fn(...bri_vlan_set_t vp...) -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://systeme.lip6.fr/pipermail/cocci/attachments/20140102/cfded7ef/attachment.html> ^ permalink raw reply [flat|nested] 53+ messages in thread
[parent not found: <alpine.DEB.2.02.1401020939060.2182@localhost6.localdomain6>]
[parent not found: <041CF35939B5534D851F16C30DD0B8CF727F485B@fzex.ruijie.com.cn>]
* [Cocci] 答复: hi all, how to match the args in function [not found] ` <041CF35939B5534D851F16C30DD0B8CF727F485B@fzex.ruijie.com.cn> @ 2014-01-02 9:16 ` Julia Lawall [not found] ` <041CF35939B5534D851F16C30DD0B8CF727F488A@fzex.ruijie.com.cn> 0 siblings, 1 reply; 53+ messages in thread From: Julia Lawall @ 2014-01-02 9:16 UTC (permalink / raw) To: cocci On Thu, 2 Jan 2014, ??(?? ??) wrote: > Well, now I wrote as following: > > @@ > identifier fn, vp; > typedef bri_vlan_set_t; > @@ > fn(...,bri_vlan_set_t vp,...); Oops sorry. I you want to match only the prototype, you do need to put the type out front. So it would be @@ identifier fn, vp; typedef bri_vlan_set_t; type T; @@ T fn(...,bri_vlan_set_t vp,...); julia ^ permalink raw reply [flat|nested] 53+ messages in thread
[parent not found: <041CF35939B5534D851F16C30DD0B8CF727F488A@fzex.ruijie.com.cn>]
* [Cocci] 答复: 答复: hi all, how to match the args in function [not found] ` <041CF35939B5534D851F16C30DD0B8CF727F488A@fzex.ruijie.com.cn> @ 2014-01-02 9:33 ` Julia Lawall 2014-01-02 10:04 ` [Cocci] 答复: " 林嘉(程二 福州) 0 siblings, 1 reply; 53+ messages in thread From: Julia Lawall @ 2014-01-02 9:33 UTC (permalink / raw) To: cocci On Thu, 2 Jan 2014, ??(?? ??) wrote: > Thank you very much, and > I wrote as following which works now: > > ------------ > @@ > identifier fn, vp; > typedef bri_vlan_set_t; > @@ > -fn(...,bri_vlan_set_t *vp,...) > -{ > -... > -} > ------------- > > Now, here comes another problem, I want to find out those functions matching the prototype and memset vp in this function, for example > > void vl_conbitmap(bri_vlan_set_t *vlanset) <-- condition 1 > { > if (action == BITMAP_EXCEPT) { > memset(vlanset, 0xff, sizeof(bri_vlan_set_t)); <-- condition2 > } > } > > > How to write the patch? > > I tried this: > @@ > identifier fn, vp; > typedef bri_vlan_set_t; > expression e1,e2; > @@ > -fn(...,bri_vlan_set_t *vp,...) > -{ > -... > -memset(vp, e1, e2); > -... > -} > > But it seems failed, nothing output. This means that every execution path has exactly one call to memset with vp as the first argument. If you just mean that there should be at least one on every (non error) execution path, then you can put the following: @@ identifier fn, vp; typedef bri_vlan_set_t; expression e1,e2; @@ -fn(...,bri_vlan_set_t *vp,...) -{ -<+... -memset(vp, e1, e2); -...+> -} If you want that there is at least one somewhere, with no constraints on the execution path, and you just want to find out about this, then you can put the following: @@ identifier fn, vp; typedef bri_vlan_set_t; expression e1,e2; @@ fn(...,bri_vlan_set_t *vp,...) { <+... *memset(vp, e1, e2); ...+> } * implicitly checks for the existence of such an execution path with the property, rather than requiring that all execution paths have the property. If you really want to completely remove such functions, it is a bit more complicated. First, you need the following rule, which explicitly uses exists, to find a fuction of interest: @r exists@ <----- new identifier fn, vp; typedef bri_vlan_set_t; expression e1,e2; position p; <----- new @@ fn@p(...,bri_vlan_set_t *vp,...) <----- new { <+... memset(vp, e1, e2); ...+> } And then the following rule, which considers all execution paths to remove the whole function: @@ identifier r.fn; position r.p; @@ - fn at p(...) { ... } The position variable is used to be sure that the second rule is matching the same function as the first one. With ifdefs, you could have two definitions of functions with the same name. julia PS, please keep the mailing list in CC, as others could be interested in your question. ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: 答复: hi all, how to match the args in function 2014-01-02 9:33 ` [Cocci] 答复: " Julia Lawall @ 2014-01-02 10:04 ` 林嘉(程二 福州) 2014-01-02 10:18 ` Julia Lawall 0 siblings, 1 reply; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-01-02 10:04 UTC (permalink / raw) To: cocci Thank you very much, it works now! And do u know where can I get more document about SmPL grammer? I only have a < The SmPL Grammar (version 0.1.4)Research group on Coccinelle June 5, 2009> Which describe some simply, and there are not enough examples, Btw, I will cc maillist, :) Thank you. -----????----- ???: Julia Lawall [mailto:julia.lawall at lip6.fr] ????: 2014?1?2? 17:33 ???: ??(?? ??) ??: cocci at systeme.lip6.fr ??: Re: ??: ??: [Cocci] hi all, how to match the args in function On Thu, 2 Jan 2014, ??(?? ??) wrote: > Thank you very much, and > I wrote as following which works now: > > ------------ > @@ > identifier fn, vp; > typedef bri_vlan_set_t; > @@ > -fn(...,bri_vlan_set_t *vp,...) > -{ > -... > -} > ------------- > > Now, here comes another problem, I want to find out those functions > matching the prototype and memset vp in this function, for example > > void vl_conbitmap(bri_vlan_set_t *vlanset) <-- condition 1 { > if (action == BITMAP_EXCEPT) { > memset(vlanset, 0xff, sizeof(bri_vlan_set_t)); <-- condition2 > } > } > > > How to write the patch? > > I tried this: > @@ > identifier fn, vp; > typedef bri_vlan_set_t; > expression e1,e2; > @@ > -fn(...,bri_vlan_set_t *vp,...) > -{ > -... > -memset(vp, e1, e2); > -... > -} > > But it seems failed, nothing output. This means that every execution path has exactly one call to memset with vp as the first argument. If you just mean that there should be at least one on every (non error) execution path, then you can put the following: @@ identifier fn, vp; typedef bri_vlan_set_t; expression e1,e2; @@ -fn(...,bri_vlan_set_t *vp,...) -{ -<+... -memset(vp, e1, e2); -...+> -} If you want that there is at least one somewhere, with no constraints on the execution path, and you just want to find out about this, then you can put the following: @@ identifier fn, vp; typedef bri_vlan_set_t; expression e1,e2; @@ fn(...,bri_vlan_set_t *vp,...) { <+... *memset(vp, e1, e2); ...+> } * implicitly checks for the existence of such an execution path with the property, rather than requiring that all execution paths have the property. If you really want to completely remove such functions, it is a bit more complicated. First, you need the following rule, which explicitly uses exists, to find a fuction of interest: @r exists@ <----- new identifier fn, vp; typedef bri_vlan_set_t; expression e1,e2; position p; <----- new @@ fn@p(...,bri_vlan_set_t *vp,...) <----- new { <+... memset(vp, e1, e2); ...+> } And then the following rule, which considers all execution paths to remove the whole function: @@ identifier r.fn; position r.p; @@ - fn at p(...) { ... } The position variable is used to be sure that the second rule is matching the same function as the first one. With ifdefs, you could have two definitions of functions with the same name. julia PS, please keep the mailing list in CC, as others could be interested in your question. ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: 答复: hi all, how to match the args in function 2014-01-02 10:04 ` [Cocci] 答复: " 林嘉(程二 福州) @ 2014-01-02 10:18 ` Julia Lawall 2014-01-02 12:57 ` [Cocci] 答复: " 林嘉(程二 福州) 0 siblings, 1 reply; 53+ messages in thread From: Julia Lawall @ 2014-01-02 10:18 UTC (permalink / raw) To: cocci On Thu, 2 Jan 2014, ??(?? ??) wrote: > Thank you very much, it works now! > > And do u know where can I get more document about SmPL grammer? I only > have a < The SmPL Grammar (version 0.1.4)Research group on Coccinelle > June 5, 2009> Which describe some simply, and there are not enough > examples, I wonder where you got that version? The version on the Coccinelle web page is for version 1.0.0-rc18 and is available here: http://coccinelle.lip6.fr/docs/main_grammar.pdf It is probably not very useful for learning Coccinelle, though. If you are using Coccinelle version 0.1.4 you will need to upgrade. One good resource is the mailing list, which is archived on gmane: http://blog.gmane.org/gmane.comp.version-control.coccinelle There are some examples with explanations on the web page: http://coccinelle.lip6.fr/rules/ There are many examples without explanations here: https://github.com/coccinelle/coccinellery There are also examples in the Linux kernel source tree, in the scripts/coccinelle directory. julia ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: 答复: 答复: hi all, how to match the args in function 2014-01-02 10:18 ` Julia Lawall @ 2014-01-02 12:57 ` 林嘉(程二 福州) 2014-01-02 13:20 ` Julia Lawall 0 siblings, 1 reply; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-01-02 12:57 UTC (permalink / raw) To: cocci Cocc version? I guess it's got by -v? # spatch -version spatch version 0.2.3 with Python support maybe it is up to date? and old version of grammer pdf is downloaded from: http://www.emn.fr/z-info/coccinelle/docs/main_grammar.pdf thank you tell me the new version of pdf -----????----- ???: Julia Lawall [mailto:julia.lawall at lip6.fr] ????: 2014?1?2? 18:18 ???: ??(?? ??) ??: cocci at systeme.lip6.fr ??: Re: ??: ??: ??: [Cocci] hi all, how to match the args in function On Thu, 2 Jan 2014, ??(?? ??) wrote: > Thank you very much, it works now! > > And do u know where can I get more document about SmPL grammer? I > only have a < The SmPL Grammar (version 0.1.4)Research group on > Coccinelle June 5, 2009> Which describe some simply, and there are not > enough examples, I wonder where you got that version? The version on the Coccinelle web page is for version 1.0.0-rc18 and is available here: http://coccinelle.lip6.fr/docs/main_grammar.pdf It is probably not very useful for learning Coccinelle, though. If you are using Coccinelle version 0.1.4 you will need to upgrade. One good resource is the mailing list, which is archived on gmane: http://blog.gmane.org/gmane.comp.version-control.coccinelle There are some examples with explanations on the web page: http://coccinelle.lip6.fr/rules/ There are many examples without explanations here: https://github.com/coccinelle/coccinellery There are also examples in the Linux kernel source tree, in the scripts/coccinelle directory. julia ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: 答复: 答复: hi all, how to match the args in function 2014-01-02 12:57 ` [Cocci] 答复: " 林嘉(程二 福州) @ 2014-01-02 13:20 ` Julia Lawall 2014-01-03 0:41 ` [Cocci] 答复: " 林嘉(程二 福州) 0 siblings, 1 reply; 53+ messages in thread From: Julia Lawall @ 2014-01-02 13:20 UTC (permalink / raw) To: cocci On Thu, 2 Jan 2014, ??(?? ??) wrote: > Cocc version? I guess it's got by -v? > # spatch -version > spatch version 0.2.3 with Python support > maybe it is up to date? No, it is quite old. The current version is 1.0.0-rc19 If you like, you can get it from github: https://github.com/coccinelle/coccinelle > and old version of grammer pdf is downloaded from: http://www.emn.fr/z-info/coccinelle/docs/main_grammar.pdf > thank you tell me the new version of pdf OK, that website is quite out of date. Use coccinelle.lip6.fr. julia ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: 答复: 答复: 答复: hi all, how to match the args in function 2014-01-02 13:20 ` Julia Lawall @ 2014-01-03 0:41 ` 林嘉(程二 福州) 2014-01-03 6:09 ` Julia Lawall 0 siblings, 1 reply; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-01-03 0:41 UTC (permalink / raw) To: cocci well, I downloaded the debian install package from ' coccinelle.lip6.fr.' http://coccinelle.lip6.fr/download.php quote: Packages exist for several distributions: Debian, thanks to Eugeniy Meshcheryakov http://packages.debian.org/squeeze/coccinelle, maybe it hasn?t updated for a long time?? -----????----- ???: Julia Lawall [mailto:julia.lawall at lip6.fr] ????: 2014?1?2? 21:20 ???: ??(?? ??) ??: cocci at systeme.lip6.fr ??: Re: ??: ??: ??: ??: [Cocci] hi all, how to match the args in function On Thu, 2 Jan 2014, ??(?? ??) wrote: > Cocc version? I guess it's got by -v? > # spatch -version > spatch version 0.2.3 with Python support maybe it is up to date? No, it is quite old. The current version is 1.0.0-rc19 If you like, you can get it from github: https://github.com/coccinelle/coccinelle > and old version of grammer pdf is downloaded from: > http://www.emn.fr/z-info/coccinelle/docs/main_grammar.pdf > thank you tell me the new version of pdf OK, that website is quite out of date. Use coccinelle.lip6.fr. julia ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: 答复: 答复: 答复: hi all, how to match the args in function 2014-01-03 0:41 ` [Cocci] 答复: " 林嘉(程二 福州) @ 2014-01-03 6:09 ` Julia Lawall 2014-01-21 3:24 ` [Cocci] how to match this case? 林嘉(程二 福州) 0 siblings, 1 reply; 53+ messages in thread From: Julia Lawall @ 2014-01-03 6:09 UTC (permalink / raw) To: cocci On Fri, 3 Jan 2014, ??(?? ??) wrote: > well, I downloaded the debian install package from ' coccinelle.lip6.fr.' > > http://coccinelle.lip6.fr/download.php > quote: > Packages exist for several distributions: > Debian, thanks to Eugeniy Meshcheryakov > http://packages.debian.org/squeeze/coccinelle, maybe it hasn?t updated for a long time?? The debian package is updated regularly, I believe. But the link on the Coccinelle web page doesn't go anywhere. I will try to update it, but if you are using debian, then you could take the version in your package manager? I see that the version in Debian squeeze is indeed 0.2.3, but I think that version of Debian is out of date. The current stable version is wheezy, which has 1.0.0~rc12. The testing and unstable versions have 1.0.0-rc19. julia > > -----????----- > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > ????: 2014?1?2? 21:20 > ???: ??(?? ??) > ??: cocci at systeme.lip6.fr > ??: Re: ??: ??: ??: ??: [Cocci] hi all, how to match the args in function > > On Thu, 2 Jan 2014, ??(?? ??) wrote: > > > Cocc version? I guess it's got by -v? > > # spatch -version > > spatch version 0.2.3 with Python support maybe it is up to date? > > No, it is quite old. The current version is 1.0.0-rc19 If you like, you can get it from github: > https://github.com/coccinelle/coccinelle > > > and old version of grammer pdf is downloaded from: > > http://www.emn.fr/z-info/coccinelle/docs/main_grammar.pdf > > thank you tell me the new version of pdf > > OK, that website is quite out of date. Use coccinelle.lip6.fr. > > julia > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] how to match this case? 2014-01-03 6:09 ` Julia Lawall @ 2014-01-21 3:24 ` 林嘉(程二 福州) 2014-01-21 3:34 ` Julia Lawall 2014-01-21 16:42 ` [Cocci] " Julia Lawall 0 siblings, 2 replies; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-01-21 3:24 UTC (permalink / raw) To: cocci Following is a code with bug ----------------------------------- void set_timeout_value(int iParam) { int i; byte b[100]; i = Geti(); if (i > 100 || i < 0){ return ; } b[i] = iParam; /* range of I is 0-100?so may overrun array* / } ----------------------------------- Now I write a patch to find it, like this @@ identifier fn, vp; identifier I; type T; expression C; @@ -fn(...,int vp,...) -{ -T I[C]; -<+... -if(vp > C || ...){ -... -} -...+> -} But it doesn?t work, give me a log: rule starting on line 1: position variables or mixed modifs interfere with comm_assoc isobool (bool (int vp > int C) || ...) can anyone tell why, thanks ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] how to match this case? 2014-01-21 3:24 ` [Cocci] how to match this case? 林嘉(程二 福州) @ 2014-01-21 3:34 ` Julia Lawall 2014-01-21 3:46 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-01-21 5:52 ` 林嘉(程二 福州) 2014-01-21 16:42 ` [Cocci] " Julia Lawall 1 sibling, 2 replies; 53+ messages in thread From: Julia Lawall @ 2014-01-21 3:34 UTC (permalink / raw) To: cocci On Tue, 21 Jan 2014, ??(?? ??) wrote: > Following is a code with bug > > ----------------------------------- > void set_timeout_value(int iParam) > { > int i; > byte b[100]; > i = Geti(); > if (i > 100 || i < 0){ > return ; > } > b[i] = iParam; /* range of I is 0-100?so may overrun array* / > > } > ----------------------------------- > Now I write a patch to find it, like this > > @@ > identifier fn, vp; > identifier I; > type T; > expression C; > @@ > -fn(...,int vp,...) > -{ > -T I[C]; > -<+... > -if(vp > C || ...){ > -... > -} > -...+> > -} > > > But it doesn?t work, give me a log: > rule starting on line 1: position variables or mixed modifs interfere with comm_assoc isobool (bool (int vp > int C) || ...) I will look into it, but you could try putting disable comm_assoc in between the initial @@, if you just want to see if your rule is working a little bit. julia > > can anyone tell why, thanks > _______________________________________________ > Cocci mailing list > Cocci at systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: how to match this case? 2014-01-21 3:34 ` Julia Lawall @ 2014-01-21 3:46 ` 林嘉(程二 福州) 2014-01-21 5:52 ` 林嘉(程二 福州) 1 sibling, 0 replies; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-01-21 3:46 UTC (permalink / raw) To: cocci Like this? @disable comm_assoc@ After I added, the warning dissapper, but nothing matched output, it seems skip the statement I intended....? init_defs_builtins: /usr/share/coccinelle/standard.h HANDLING: single2.c -----????----- ???: Julia Lawall [mailto:julia.lawall at lip6.fr] ????: 2014?1?21? 11:35 ???: ??(?? ??) ??: cocci at systeme.lip6.fr ??: Re: [Cocci] how to match this case? On Tue, 21 Jan 2014, ??(?? ??) wrote: > Following is a code with bug > > ----------------------------------- > void set_timeout_value(int iParam) > { > int i; > byte b[100]; > i = Geti(); > if (i > 100 || i < 0){ > return ; > } > b[i] = iParam; /* range of I is 0-100?so may overrun array* / > > } > ----------------------------------- > Now I write a patch to find it, like this > > @@ > identifier fn, vp; > identifier I; > type T; > expression C; > @@ > -fn(...,int vp,...) > -{ > -T I[C]; > -<+... > -if(vp > C || ...){ > -... > -} > -...+> > -} > > > But it doesn?t work, give me a log: > rule starting on line 1: position variables or mixed modifs interfere > with comm_assoc isobool (bool (int vp > int C) || ...) I will look into it, but you could try putting disable comm_assoc in between the initial @@, if you just want to see if your rule is working a little bit. julia > > can anyone tell why, thanks > _______________________________________________ > Cocci mailing list > Cocci at systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: how to match this case? 2014-01-21 3:34 ` Julia Lawall 2014-01-21 3:46 ` [Cocci] 答复: " 林嘉(程二 福州) @ 2014-01-21 5:52 ` 林嘉(程二 福州) 2014-01-21 6:32 ` Julia Lawall 1 sibling, 1 reply; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-01-21 5:52 UTC (permalink / raw) To: cocci Sorry, I made a mistake , if the checkpoint is local variable, I should write as -int vp; -T I[C]; -<+... -if(vp > C || ...){ -----????----- ???: Julia Lawall [mailto:julia.lawall at lip6.fr] ????: 2014?1?21? 11:35 ???: ??(?? ??) ??: cocci at systeme.lip6.fr ??: Re: [Cocci] how to match this case? On Tue, 21 Jan 2014, ??(?? ??) wrote: > Following is a code with bug > > ----------------------------------- > void set_timeout_value(int iParam) > { > int i; > byte b[100]; > i = Geti(); > if (i > 100 || i < 0){ > return ; > } > b[i] = iParam; /* range of I is 0-100?so may overrun array* / > > } > ----------------------------------- > Now I write a patch to find it, like this > > @@ > identifier fn, vp; > identifier I; > type T; > expression C; > @@ > -fn(...,int vp,...) > -{ > -T I[C]; > -<+... > -if(vp > C || ...){ > -... > -} > -...+> > -} > > > But it doesn?t work, give me a log: > rule starting on line 1: position variables or mixed modifs interfere > with comm_assoc isobool (bool (int vp > int C) || ...) I will look into it, but you could try putting disable comm_assoc in between the initial @@, if you just want to see if your rule is working a little bit. julia > > can anyone tell why, thanks > _______________________________________________ > Cocci mailing list > Cocci at systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: how to match this case? 2014-01-21 5:52 ` 林嘉(程二 福州) @ 2014-01-21 6:32 ` Julia Lawall 2014-01-21 6:43 ` [Cocci] 答复: " 林嘉(程二 福州) 0 siblings, 1 reply; 53+ messages in thread From: Julia Lawall @ 2014-01-21 6:32 UTC (permalink / raw) To: cocci On Tue, 21 Jan 2014, ??(?? ??) wrote: > Sorry, I made a mistake , if the checkpoint is local variable, I should write as > > -int vp; ... > -T I[C]; Also, you don't know if the array is declared before or after vp. So you would need ( - int vp; ... - T I[C]; | - T I[C]; ... - int vp; ) julia > -<+... > -if(vp > C || ...){ > > -----????----- > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > ????: 2014?1?21? 11:35 > ???: ??(?? ??) > ??: cocci at systeme.lip6.fr > ??: Re: [Cocci] how to match this case? > > > > On Tue, 21 Jan 2014, ??(?? ??) wrote: > > > Following is a code with bug > > > > ----------------------------------- > > void set_timeout_value(int iParam) > > { > > int i; > > byte b[100]; > > i = Geti(); > > if (i > 100 || i < 0){ > > return ; > > } > > b[i] = iParam; /* range of I is 0-100?so may overrun array* / > > > > } > > ----------------------------------- > > Now I write a patch to find it, like this > > > > @@ > > identifier fn, vp; > > identifier I; > > type T; > > expression C; > > @@ > > -fn(...,int vp,...) > > -{ > > -T I[C]; > > -<+... > > -if(vp > C || ...){ > > -... > > -} > > -...+> > > -} > > > > > > But it doesn?t work, give me a log: > > rule starting on line 1: position variables or mixed modifs interfere > > with comm_assoc isobool (bool (int vp > int C) || ...) > > I will look into it, but you could try putting disable comm_assoc in between the initial @@, if you just want to see if your rule is working a little bit. > > julia > > > > > > can anyone tell why, thanks > > _______________________________________________ > > Cocci mailing list > > Cocci at systeme.lip6.fr > > https://systeme.lip6.fr/mailman/listinfo/cocci > > > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: how to match this case? 2014-01-21 6:32 ` Julia Lawall @ 2014-01-21 6:43 ` 林嘉(程二 福州) 2014-01-21 7:04 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-01-21 7:48 ` [Cocci] 答复: 答复: how to match this case? Julia Lawall 0 siblings, 2 replies; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-01-21 6:43 UTC (permalink / raw) To: cocci Thanks for remind. But to the "|" operator , I still don?t know how to use, for example, I wrote @disable comm_assoc@ identifier fn, p; identifier I; type T,T1; expression C; @@ -fn(...) -{ -int p; -... -T I[C]; | -T I[C]; -... -int p; -<+... -if(p > C){ -... -} -...+> -} It reports: init_defs_builtins: /usr/share/coccinelle/standard.h 126 127 Fatal error: exception Failure("minus: parse error: = File "os.cocci", line 12, column 0, charpos = 126 around = '|', whole content = | ") -----????----- ???: Julia Lawall [mailto:julia.lawall at lip6.fr] ????: 2014?1?21? 14:32 ???: ??(?? ??) ??: cocci at systeme.lip6.fr ??: Re: ??: [Cocci] how to match this case? On Tue, 21 Jan 2014, ??(?? ??) wrote: > Sorry, I made a mistake , if the checkpoint is local variable, I > should write as > > -int vp; ... > -T I[C]; Also, you don't know if the array is declared before or after vp. So you would need ( - int vp; ... - T I[C]; | - T I[C]; ... - int vp; ) julia > -<+... > -if(vp > C || ...){ > > -----????----- > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > ????: 2014?1?21? 11:35 > ???: ??(?? ??) > ??: cocci at systeme.lip6.fr > ??: Re: [Cocci] how to match this case? > > > > On Tue, 21 Jan 2014, ??(?? ??) wrote: > > > Following is a code with bug > > > > ----------------------------------- > > void set_timeout_value(int iParam) > > { > > int i; > > byte b[100]; > > i = Geti(); > > if (i > 100 || i < 0){ > > return ; > > } > > b[i] = iParam; /* range of I is 0-100?so may overrun array* / > > > > } > > ----------------------------------- > > Now I write a patch to find it, like this > > > > @@ > > identifier fn, vp; > > identifier I; > > type T; > > expression C; > > @@ > > -fn(...,int vp,...) > > -{ > > -T I[C]; > > -<+... > > -if(vp > C || ...){ > > -... > > -} > > -...+> > > -} > > > > > > But it doesn?t work, give me a log: > > rule starting on line 1: position variables or mixed modifs > > interfere with comm_assoc isobool (bool (int vp > int C) || ...) > > I will look into it, but you could try putting disable comm_assoc in between the initial @@, if you just want to see if your rule is working a little bit. > > julia > > > > > > can anyone tell why, thanks > > _______________________________________________ > > Cocci mailing list > > Cocci at systeme.lip6.fr > > https://systeme.lip6.fr/mailman/listinfo/cocci > > > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: 答复: how to match this case? 2014-01-21 6:43 ` [Cocci] 答复: " 林嘉(程二 福州) @ 2014-01-21 7:04 ` 林嘉(程二 福州) 2014-01-21 7:48 ` Julia Lawall 2014-01-21 7:48 ` [Cocci] 答复: 答复: how to match this case? Julia Lawall 1 sibling, 1 reply; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-01-21 7:04 UTC (permalink / raw) To: cocci I see, I should add '()' if I use '|' -----????----- ???: cocci-bounces at systeme.lip6.fr [mailto:cocci-bounces at systeme.lip6.fr] ?? ??(?? ??) ????: 2014?1?21? 14:44 ???: Julia Lawall ??: cocci at systeme.lip6.fr ??: [Cocci] ??: ??: how to match this case? Thanks for remind. But to the "|" operator , I still don?t know how to use, for example, I wrote @disable comm_assoc@ identifier fn, p; identifier I; type T,T1; expression C; @@ -fn(...) -{ -int p; -... -T I[C]; | -T I[C]; -... -int p; -<+... -if(p > C){ -... -} -...+> -} It reports: init_defs_builtins: /usr/share/coccinelle/standard.h 126 127 Fatal error: exception Failure("minus: parse error: = File "os.cocci", line 12, column 0, charpos = 126 around = '|', whole content = | ") -----????----- ???: Julia Lawall [mailto:julia.lawall at lip6.fr] ????: 2014?1?21? 14:32 ???: ??(?? ??) ??: cocci at systeme.lip6.fr ??: Re: ??: [Cocci] how to match this case? On Tue, 21 Jan 2014, ??(?? ??) wrote: > Sorry, I made a mistake , if the checkpoint is local variable, I > should write as > > -int vp; ... > -T I[C]; Also, you don't know if the array is declared before or after vp. So you would need ( - int vp; ... - T I[C]; | - T I[C]; ... - int vp; ) julia > -<+... > -if(vp > C || ...){ > > -----????----- > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > ????: 2014?1?21? 11:35 > ???: ??(?? ??) > ??: cocci at systeme.lip6.fr > ??: Re: [Cocci] how to match this case? > > > > On Tue, 21 Jan 2014, ??(?? ??) wrote: > > > Following is a code with bug > > > > ----------------------------------- > > void set_timeout_value(int iParam) > > { > > int i; > > byte b[100]; > > i = Geti(); > > if (i > 100 || i < 0){ > > return ; > > } > > b[i] = iParam; /* range of I is 0-100?so may overrun array* / > > > > } > > ----------------------------------- > > Now I write a patch to find it, like this > > > > @@ > > identifier fn, vp; > > identifier I; > > type T; > > expression C; > > @@ > > -fn(...,int vp,...) > > -{ > > -T I[C]; > > -<+... > > -if(vp > C || ...){ > > -... > > -} > > -...+> > > -} > > > > > > But it doesn?t work, give me a log: > > rule starting on line 1: position variables or mixed modifs > > interfere with comm_assoc isobool (bool (int vp > int C) || ...) > > I will look into it, but you could try putting disable comm_assoc in between the initial @@, if you just want to see if your rule is working a little bit. > > julia > > > > > > can anyone tell why, thanks > > _______________________________________________ > > Cocci mailing list > > Cocci at systeme.lip6.fr > > https://systeme.lip6.fr/mailman/listinfo/cocci > > > _______________________________________________ Cocci mailing list Cocci at systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: 答复: how to match this case? 2014-01-21 7:04 ` [Cocci] 答复: " 林嘉(程二 福州) @ 2014-01-21 7:48 ` Julia Lawall 2014-01-21 9:11 ` [Cocci] infinitly loop in spatch? 林嘉(程二 福州) 0 siblings, 1 reply; 53+ messages in thread From: Julia Lawall @ 2014-01-21 7:48 UTC (permalink / raw) To: cocci On Tue, 21 Jan 2014, ??(?? ??) wrote: > I see, I should add '()' if I use '|' Yes :) julia > > > -----????----- > ???: cocci-bounces at systeme.lip6.fr [mailto:cocci-bounces at systeme.lip6.fr] ?? ??(?? ??) > ????: 2014?1?21? 14:44 > ???: Julia Lawall > ??: cocci at systeme.lip6.fr > ??: [Cocci] ??: ??: how to match this case? > > Thanks for remind. > But to the "|" operator , I still don?t know how to use, for example, I wrote > > > @disable comm_assoc@ > identifier fn, p; > identifier I; > type T,T1; > expression C; > @@ > -fn(...) > -{ > -int p; > -... > -T I[C]; > | > -T I[C]; > -... > -int p; > -<+... > -if(p > C){ > -... > -} > -...+> > -} > > > > It reports: init_defs_builtins: /usr/share/coccinelle/standard.h > 126 127 > Fatal error: exception Failure("minus: parse error: > = File "os.cocci", line 12, column 0, charpos = 126 > around = '|', whole content = | > ") > > -----????----- > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > ????: 2014?1?21? 14:32 > ???: ??(?? ??) > ??: cocci at systeme.lip6.fr > ??: Re: ??: [Cocci] how to match this case? > > On Tue, 21 Jan 2014, ??(?? ??) wrote: > > > Sorry, I made a mistake , if the checkpoint is local variable, I > > should write as > > > > -int vp; > ... > > -T I[C]; > > Also, you don't know if the array is declared before or after vp. So you would need > > ( > - int vp; > ... > - T I[C]; > | > - T I[C]; > ... > - int vp; > ) > > julia > > > -<+... > > -if(vp > C || ...){ > > > > -----????----- > > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > > ????: 2014?1?21? 11:35 > > ???: ??(?? ??) > > ??: cocci at systeme.lip6.fr > > ??: Re: [Cocci] how to match this case? > > > > > > > > On Tue, 21 Jan 2014, ??(?? ??) wrote: > > > > > Following is a code with bug > > > > > > ----------------------------------- > > > void set_timeout_value(int iParam) > > > { > > > int i; > > > byte b[100]; > > > i = Geti(); > > > if (i > 100 || i < 0){ > > > return ; > > > } > > > b[i] = iParam; /* range of I is 0-100?so may overrun array* / > > > > > > } > > > ----------------------------------- > > > Now I write a patch to find it, like this > > > > > > @@ > > > identifier fn, vp; > > > identifier I; > > > type T; > > > expression C; > > > @@ > > > -fn(...,int vp,...) > > > -{ > > > -T I[C]; > > > -<+... > > > -if(vp > C || ...){ > > > -... > > > -} > > > -...+> > > > -} > > > > > > > > > But it doesn?t work, give me a log: > > > rule starting on line 1: position variables or mixed modifs > > > interfere with comm_assoc isobool (bool (int vp > int C) || ...) > > > > I will look into it, but you could try putting disable comm_assoc in between the initial @@, if you just want to see if your rule is working a little bit. > > > > julia > > > > > > > > > > can anyone tell why, thanks > > > _______________________________________________ > > > Cocci mailing list > > > Cocci at systeme.lip6.fr > > > https://systeme.lip6.fr/mailman/listinfo/cocci > > > > > > _______________________________________________ > Cocci mailing list > Cocci at systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] infinitly loop in spatch? 2014-01-21 7:48 ` Julia Lawall @ 2014-01-21 9:11 ` 林嘉(程二 福州) 2014-01-21 9:22 ` Julia Lawall 0 siblings, 1 reply; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-01-21 9:11 UTC (permalink / raw) To: cocci When I use spatch to scan some file, I found it may loop sometimes, did anyone encounter too? If using -debug, it show pause at 'bind' step ----------------------------------------------------------------------- HANDLING: /root/windows/ok_file.c ----------------------------------------------------------------------- let's go ----------------------------------------------------------------------- ----------------------------------------------------------------------- ----------------------------------------------------------------------- rule starting on line 1 = ----------------------------------------------------------------------- dependencies for rule rule starting on line 1 satisfied: binding in = [] binding relevant in = [] ----------------------------------------------------------------------- proto for rule starting on line 1 = ----------------------------------------------------------------------- dependencies for rule proto for rule starting on line 1 not satisfied: rule starting on line 1 not satisfied binding in environment = [] ----------------------------------------------------------------------- Finished ----------------------------------------------------------------------- HANDLING: /root/loop_file.c ----------------------------------------------------------------------- let's go ----------------------------------------------------------------------- ----------------------------------------------------------------------- ----------------------------------------------------------------------- rule starting on line 1 = ----------------------------------------------------------------------- dependencies for rule rule starting on line 1 satisfied: binding in = [] binding relevant in = [] <--- step here, then nothing more output..... :( ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] infinitly loop in spatch? 2014-01-21 9:11 ` [Cocci] infinitly loop in spatch? 林嘉(程二 福州) @ 2014-01-21 9:22 ` Julia Lawall 2014-01-26 7:10 ` [Cocci] how to write such matching case? 林嘉(程二 福州) 0 siblings, 1 reply; 53+ messages in thread From: Julia Lawall @ 2014-01-21 9:22 UTC (permalink / raw) To: cocci On Tue, 21 Jan 2014, ??(?? ??) wrote: > When I use spatch to scan some file, I found it may loop sometimes, did anyone encounter too? It can run for a very long time, especially when there are nested loops, and these loops contain many conditionals. Basically it is trying all of the control-flow paths. One option is to tell it to ignore loops, with the --no-loops option. This can be unsafe, because it could miss some matches from the bottom of the loop back to the top, but that might not be relevant to your pattern. Another option is to put a timeout --timeout 120, for example (120 seconds). If it exceeds that time, it will do nothing for the file. If you want me to look at the problem in more detail, please send the semantic patch and some problematic code. julia > > If using -debug, it show pause at 'bind' step > > ----------------------------------------------------------------------- > HANDLING: /root/windows/ok_file.c > ----------------------------------------------------------------------- > let's go > ----------------------------------------------------------------------- > ----------------------------------------------------------------------- > ----------------------------------------------------------------------- > rule starting on line 1 = > ----------------------------------------------------------------------- > dependencies for rule rule starting on line 1 satisfied: > binding in = [] > binding relevant in = [] > ----------------------------------------------------------------------- > proto for rule starting on line 1 = > ----------------------------------------------------------------------- > dependencies for rule proto for rule starting on line 1 not satisfied: > rule starting on line 1 not satisfied > binding in environment = [] > ----------------------------------------------------------------------- > Finished > ----------------------------------------------------------------------- > HANDLING: /root/loop_file.c > ----------------------------------------------------------------------- > let's go > ----------------------------------------------------------------------- > ----------------------------------------------------------------------- > ----------------------------------------------------------------------- > rule starting on line 1 = > ----------------------------------------------------------------------- > dependencies for rule rule starting on line 1 satisfied: > binding in = [] > binding relevant in = [] <--- step here, then nothing more output..... :( > _______________________________________________ > Cocci mailing list > Cocci at systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] how to write such matching case? 2014-01-21 9:22 ` Julia Lawall @ 2014-01-26 7:10 ` 林嘉(程二 福州) 2014-01-26 11:19 ` Julia Lawall 0 siblings, 1 reply; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-01-26 7:10 UTC (permalink / raw) To: cocci In my project, it's required that if function A is called, and function B must be called following, just like this Foo(...) { If ... { A(....); ... B(....); } } Or Foo1(...) { A(....); B(...); } How to write a patch to find the missing case? Such as Foo(...) { If ... { A(....); ... } } Or Foo1(...) { A(....); ... } ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] how to write such matching case? 2014-01-26 7:10 ` [Cocci] how to write such matching case? 林嘉(程二 福州) @ 2014-01-26 11:19 ` Julia Lawall 2014-01-27 0:40 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-01-27 1:34 ` 林嘉(程二 福州) 0 siblings, 2 replies; 53+ messages in thread From: Julia Lawall @ 2014-01-26 11:19 UTC (permalink / raw) To: cocci On Sun, 26 Jan 2014, ??(?? ??) wrote: > In my project, it's required that if function A is called, and function B must be called following, just like this > > Foo(...) > { > If ... { > A(....); > ... > B(....); > } > } > > Or > > Foo1(...) > { > A(....); > B(...); > } > > > How to write a patch to find the missing case? Such as > > Foo(...) > { > If ... { > A(....); > ... > } > } > > Or > > Foo1(...) > { > A(....); > ... > } A(...) ... When != B(...) julia ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: how to write such matching case? 2014-01-26 11:19 ` Julia Lawall @ 2014-01-27 0:40 ` 林嘉(程二 福州) 2014-01-27 12:34 ` Julia Lawall 2014-01-27 1:34 ` 林嘉(程二 福州) 1 sibling, 1 reply; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-01-27 0:40 UTC (permalink / raw) To: cocci In SMPL, 'When != something' means 'something' doesn?t exist ? -----????----- ???: Julia Lawall [mailto:julia.lawall at lip6.fr] ????: 2014?1?26? 19:19 ???: ??(?? ??) ??: cocci at systeme.lip6.fr ??: Re: [Cocci] how to write such matching case? On Sun, 26 Jan 2014, ??(?? ??) wrote: > In my project, it's required that if function A is called, and function B must be called following, just like this > > Foo(...) > { > If ... { > A(....); > ... > B(....); > } > } > > Or > > Foo1(...) > { > A(....); > B(...); > } > > > How to write a patch to find the missing case? Such as > > Foo(...) > { > If ... { > A(....); > ... > } > } > > Or > > Foo1(...) > { > A(....); > ... > } A(...) ... When != B(...) julia ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: how to write such matching case? 2014-01-27 0:40 ` [Cocci] 答复: " 林嘉(程二 福州) @ 2014-01-27 12:34 ` Julia Lawall 0 siblings, 0 replies; 53+ messages in thread From: Julia Lawall @ 2014-01-27 12:34 UTC (permalink / raw) To: cocci On Mon, 27 Jan 2014, ??(?? ??) wrote: > In SMPL, 'When != something' means 'something' doesn?t exist ? Yes, within the execution path(s) matched by ... julia > > > > -----????----- > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > ????: 2014?1?26? 19:19 > ???: ??(?? ??) > ??: cocci at systeme.lip6.fr > ??: Re: [Cocci] how to write such matching case? > > On Sun, 26 Jan 2014, ??(?? ??) wrote: > > > In my project, it's required that if function A is called, and function B must be called following, just like this > > > > Foo(...) > > { > > If ... { > > A(....); > > ... > > B(....); > > } > > } > > > > Or > > > > Foo1(...) > > { > > A(....); > > B(...); > > } > > > > > > How to write a patch to find the missing case? Such as > > > > Foo(...) > > { > > If ... { > > A(....); > > ... > > } > > } > > > > Or > > > > Foo1(...) > > { > > A(....); > > ... > > } > > A(...) > ... When != B(...) > > julia > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: how to write such matching case? 2014-01-26 11:19 ` Julia Lawall 2014-01-27 0:40 ` [Cocci] 答复: " 林嘉(程二 福州) @ 2014-01-27 1:34 ` 林嘉(程二 福州) 2014-01-27 12:33 ` Julia Lawall 1 sibling, 1 reply; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-01-27 1:34 UTC (permalink / raw) To: cocci I wrote this @@ @@ cli_printf(...) ... when != cli_client_execmd_fail(...) it reports: Fatal error: exception Failure("False should not be in the final result. Perhaps your rule doesn't contain any +/-/* code, or you have a failed dependency.") But i found there is not 'minus' in an example.cocci either.... // // Add missing pci_dev_put // // Target: Linux // Copyright: 2012 - LIP6/INRIA // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license // Author: Julia Lawall <Julia.Lawall@lip6.fr> // URL: http://coccinelle.lip6.fr/ // URL: http://coccinellery.org/ @@ local idexpression x; expression e; @@ *x = pci_get_slot(...) ... when != true x == NULL when != pci_dev_put(x) when != e = x when != if (x != NULL) {<+... pci_dev_put(x); ...+>} *return ...; -----????----- ???: Julia Lawall [mailto:julia.lawall at lip6.fr] ????: 2014?1?26? 19:19 ???: ??(?? ??) ??: cocci at systeme.lip6.fr ??: Re: [Cocci] how to write such matching case? On Sun, 26 Jan 2014, ??(?? ??) wrote: > In my project, it's required that if function A is called, and function B must be called following, just like this > > Foo(...) > { > If ... { > A(....); > ... > B(....); > } > } > > Or > > Foo1(...) > { > A(....); > B(...); > } > > > How to write a patch to find the missing case? Such as > > Foo(...) > { > If ... { > A(....); > ... > } > } > > Or > > Foo1(...) > { > A(....); > ... > } A(...) ... When != B(...) julia ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: how to write such matching case? 2014-01-27 1:34 ` 林嘉(程二 福州) @ 2014-01-27 12:33 ` Julia Lawall 2014-01-27 13:55 ` [Cocci] 答复: " 林嘉(程二 福州) 0 siblings, 1 reply; 53+ messages in thread From: Julia Lawall @ 2014-01-27 12:33 UTC (permalink / raw) To: cocci On Mon, 27 Jan 2014, ??(?? ??) wrote: > I wrote this > > @@ > @@ > cli_printf(...) > ... when != cli_client_execmd_fail(...) > > > it reports: > Fatal error: exception Failure("False should not be in the final result. Perhaps your rule doesn't contain any +/-/* code, or you have a failed dependency.") > > > But i found there is not 'minus' in an example.cocci either.... There is a * (indicating a line of interest). You can use that. If you use that, you will get an exists semantics for the ... (there exists an execution path that satisfies the property). Otherwise, you get a foral semantics (all execution paths have to satisfy the property). julia > > > // > // Add missing pci_dev_put > // > // Target: Linux > // Copyright: 2012 - LIP6/INRIA > // License: Licensed under ISC. See LICENSE or http://www.isc.org/software/license > // Author: Julia Lawall <Julia.Lawall@lip6.fr> > // URL: http://coccinelle.lip6.fr/ > // URL: http://coccinellery.org/ > > @@ > local idexpression x; > expression e; > @@ > > *x = pci_get_slot(...) > ... when != true x == NULL > when != pci_dev_put(x) > when != e = x > when != if (x != NULL) {<+... pci_dev_put(x); ...+>} > *return ...; > > > > > > -----????----- > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > ????: 2014?1?26? 19:19 > ???: ??(?? ??) > ??: cocci at systeme.lip6.fr > ??: Re: [Cocci] how to write such matching case? > > On Sun, 26 Jan 2014, ??(?? ??) wrote: > > > In my project, it's required that if function A is called, and function B must be called following, just like this > > > > Foo(...) > > { > > If ... { > > A(....); > > ... > > B(....); > > } > > } > > > > Or > > > > Foo1(...) > > { > > A(....); > > B(...); > > } > > > > > > How to write a patch to find the missing case? Such as > > > > Foo(...) > > { > > If ... { > > A(....); > > ... > > } > > } > > > > Or > > > > Foo1(...) > > { > > A(....); > > ... > > } > > A(...) > ... When != B(...) > > julia > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: how to write such matching case? 2014-01-27 12:33 ` Julia Lawall @ 2014-01-27 13:55 ` 林嘉(程二 福州) 2014-01-27 14:11 ` Peter Senna Tschudin 0 siblings, 1 reply; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-01-27 13:55 UTC (permalink / raw) To: cocci Thanks for explain, but if I want to write a simple match, that is function foo must be called in main() e.g. int main(...) { ... Foo(...); ... } I write it as @@ @@ main(...) { <... when != reg_process_exit_action(...) ...> } Reports: 53 57 Fatal error: exception Failure("minus: parse error: = File "rgos.cocci", line 6, column 2, charpos = 53 around = '...>', whole content = ...> ") What does it mean? By the way, I still don?t know when I should use '<'and'>' and when need not? -----????----- ???: Julia Lawall [mailto:julia.lawall at lip6.fr] ????: 2014?1?27? 20:34 ???: ??(?? ??) ??: cocci at systeme.lip6.fr ??: Re: ??: [Cocci] how to write such matching case? On Mon, 27 Jan 2014, ??(?? ??) wrote: > I wrote this > > @@ > @@ > cli_printf(...) > ... when != cli_client_execmd_fail(...) > > > it reports: > Fatal error: exception Failure("False should not be in the final > result. Perhaps your rule doesn't contain any +/-/* code, or you have > a failed dependency.") > > > But i found there is not 'minus' in an example.cocci either.... There is a * (indicating a line of interest). You can use that. If you use that, you will get an exists semantics for the ... (there exists an execution path that satisfies the property). Otherwise, you get a foral semantics (all execution paths have to satisfy the property). julia > > > // > // Add missing pci_dev_put > // > // Target: Linux > // Copyright: 2012 - LIP6/INRIA > // License: Licensed under ISC. See LICENSE or > http://www.isc.org/software/license > // Author: Julia Lawall <Julia.Lawall@lip6.fr> // URL: > http://coccinelle.lip6.fr/ // URL: http://coccinellery.org/ > > @@ > local idexpression x; > expression e; > @@ > > *x = pci_get_slot(...) > ... when != true x == NULL > when != pci_dev_put(x) > when != e = x > when != if (x != NULL) {<+... pci_dev_put(x); ...+>} *return ...; > > > > > > -----????----- > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > ????: 2014?1?26? 19:19 > ???: ??(?? ??) > ??: cocci at systeme.lip6.fr > ??: Re: [Cocci] how to write such matching case? > > On Sun, 26 Jan 2014, ??(?? ??) wrote: > > > In my project, it's required that if function A is called, and > > function B must be called following, just like this > > > > Foo(...) > > { > > If ... { > > A(....); > > ... > > B(....); > > } > > } > > > > Or > > > > Foo1(...) > > { > > A(....); > > B(...); > > } > > > > > > How to write a patch to find the missing case? Such as > > > > Foo(...) > > { > > If ... { > > A(....); > > ... > > } > > } > > > > Or > > > > Foo1(...) > > { > > A(....); > > ... > > } > > A(...) > ... When != B(...) > > julia > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: how to write such matching case? 2014-01-27 13:55 ` [Cocci] 答复: " 林嘉(程二 福州) @ 2014-01-27 14:11 ` Peter Senna Tschudin 2014-01-27 16:07 ` Julia Lawall 2014-01-28 2:22 ` [Cocci] 答复: " 林嘉(程二 福州) 0 siblings, 2 replies; 53+ messages in thread From: Peter Senna Tschudin @ 2014-01-27 14:11 UTC (permalink / raw) To: cocci You can try: @@ @@ * main () { ... when != Foo(...) } This semantic patch will match functions named main that do not contain call to function Foo; On Mon, Jan 27, 2014 at 2:55 PM, ??(?? ??) <linjia@ruijie.com.cn> wrote: > Thanks for explain, but if I want to write a simple match, that is function foo must be called in main() > e.g. > > int main(...) > { > ... > Foo(...); > ... > } > > I write it as > > @@ > @@ > main(...) { > <... > when != reg_process_exit_action(...) > ...> > } > > Reports: 53 57 > Fatal error: exception Failure("minus: parse error: > = File "rgos.cocci", line 6, column 2, charpos = 53 > around = '...>', whole content = ...> > ") > > What does it mean? > > By the way, I still don?t know when I should use '<'and'>' and when need not? > > -----????----- > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > ????: 2014?1?27? 20:34 > ???: ??(?? ??) > ??: cocci at systeme.lip6.fr > ??: Re: ??: [Cocci] how to write such matching case? > > On Mon, 27 Jan 2014, ??(?? ??) wrote: > >> I wrote this >> >> @@ >> @@ >> cli_printf(...) >> ... when != cli_client_execmd_fail(...) >> >> >> it reports: >> Fatal error: exception Failure("False should not be in the final >> result. Perhaps your rule doesn't contain any +/-/* code, or you have >> a failed dependency.") >> >> >> But i found there is not 'minus' in an example.cocci either.... > > There is a * (indicating a line of interest). You can use that. If you use that, you will get an exists semantics for the ... (there exists an execution path that satisfies the property). Otherwise, you get a foral semantics (all execution paths have to satisfy the property). > > julia > >> >> >> // >> // Add missing pci_dev_put >> // >> // Target: Linux >> // Copyright: 2012 - LIP6/INRIA >> // License: Licensed under ISC. See LICENSE or >> http://www.isc.org/software/license >> // Author: Julia Lawall <Julia.Lawall@lip6.fr> // URL: >> http://coccinelle.lip6.fr/ // URL: http://coccinellery.org/ >> >> @@ >> local idexpression x; >> expression e; >> @@ >> >> *x = pci_get_slot(...) >> ... when != true x == NULL >> when != pci_dev_put(x) >> when != e = x >> when != if (x != NULL) {<+... pci_dev_put(x); ...+>} *return ...; >> >> >> >> >> >> -----????----- >> ???: Julia Lawall [mailto:julia.lawall at lip6.fr] >> ????: 2014?1?26? 19:19 >> ???: ??(?? ??) >> ??: cocci at systeme.lip6.fr >> ??: Re: [Cocci] how to write such matching case? >> >> On Sun, 26 Jan 2014, ??(?? ??) wrote: >> >> > In my project, it's required that if function A is called, and >> > function B must be called following, just like this >> > >> > Foo(...) >> > { >> > If ... { >> > A(....); >> > ... >> > B(....); >> > } >> > } >> > >> > Or >> > >> > Foo1(...) >> > { >> > A(....); >> > B(...); >> > } >> > >> > >> > How to write a patch to find the missing case? Such as >> > >> > Foo(...) >> > { >> > If ... { >> > A(....); >> > ... >> > } >> > } >> > >> > Or >> > >> > Foo1(...) >> > { >> > A(....); >> > ... >> > } >> >> A(...) >> ... When != B(...) >> >> julia >> > _______________________________________________ > Cocci mailing list > Cocci at systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci -- Peter ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: how to write such matching case? 2014-01-27 14:11 ` Peter Senna Tschudin @ 2014-01-27 16:07 ` Julia Lawall 2014-01-28 2:22 ` [Cocci] 答复: " 林嘉(程二 福州) 1 sibling, 0 replies; 53+ messages in thread From: Julia Lawall @ 2014-01-27 16:07 UTC (permalink / raw) To: cocci On Mon, 27 Jan 2014, Peter Senna Tschudin wrote: > You can try: > > @@ > @@ > * main () { > ... > when != Foo(...) > } Normally the first when should be on the same line as the ... julia > This semantic patch will match functions named main that do not > contain call to function Foo; > > On Mon, Jan 27, 2014 at 2:55 PM, ??(?? ??) <linjia@ruijie.com.cn> wrote: > > Thanks for explain, but if I want to write a simple match, that is function foo must be called in main() > > e.g. > > > > int main(...) > > { > > ... > > Foo(...); > > ... > > } > > > > I write it as > > > > @@ > > @@ > > main(...) { > > <... > > when != reg_process_exit_action(...) > > ...> > > } > > > > Reports: 53 57 > > Fatal error: exception Failure("minus: parse error: > > = File "rgos.cocci", line 6, column 2, charpos = 53 > > around = '...>', whole content = ...> > > ") > > > > What does it mean? > > > > By the way, I still don?t know when I should use '<'and'>' and when need not? > > > > -----????----- > > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > > ????: 2014?1?27? 20:34 > > ???: ??(?? ??) > > ??: cocci at systeme.lip6.fr > > ??: Re: ??: [Cocci] how to write such matching case? > > > > On Mon, 27 Jan 2014, ??(?? ??) wrote: > > > >> I wrote this > >> > >> @@ > >> @@ > >> cli_printf(...) > >> ... when != cli_client_execmd_fail(...) > >> > >> > >> it reports: > >> Fatal error: exception Failure("False should not be in the final > >> result. Perhaps your rule doesn't contain any +/-/* code, or you have > >> a failed dependency.") > >> > >> > >> But i found there is not 'minus' in an example.cocci either.... > > > > There is a * (indicating a line of interest). You can use that. If you use that, you will get an exists semantics for the ... (there exists an execution path that satisfies the property). Otherwise, you get a foral semantics (all execution paths have to satisfy the property). > > > > julia > > > >> > >> > >> // > >> // Add missing pci_dev_put > >> // > >> // Target: Linux > >> // Copyright: 2012 - LIP6/INRIA > >> // License: Licensed under ISC. See LICENSE or > >> http://www.isc.org/software/license > >> // Author: Julia Lawall <Julia.Lawall@lip6.fr> // URL: > >> http://coccinelle.lip6.fr/ // URL: http://coccinellery.org/ > >> > >> @@ > >> local idexpression x; > >> expression e; > >> @@ > >> > >> *x = pci_get_slot(...) > >> ... when != true x == NULL > >> when != pci_dev_put(x) > >> when != e = x > >> when != if (x != NULL) {<+... pci_dev_put(x); ...+>} *return ...; > >> > >> > >> > >> > >> > >> -----????----- > >> ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > >> ????: 2014?1?26? 19:19 > >> ???: ??(?? ??) > >> ??: cocci at systeme.lip6.fr > >> ??: Re: [Cocci] how to write such matching case? > >> > >> On Sun, 26 Jan 2014, ??(?? ??) wrote: > >> > >> > In my project, it's required that if function A is called, and > >> > function B must be called following, just like this > >> > > >> > Foo(...) > >> > { > >> > If ... { > >> > A(....); > >> > ... > >> > B(....); > >> > } > >> > } > >> > > >> > Or > >> > > >> > Foo1(...) > >> > { > >> > A(....); > >> > B(...); > >> > } > >> > > >> > > >> > How to write a patch to find the missing case? Such as > >> > > >> > Foo(...) > >> > { > >> > If ... { > >> > A(....); > >> > ... > >> > } > >> > } > >> > > >> > Or > >> > > >> > Foo1(...) > >> > { > >> > A(....); > >> > ... > >> > } > >> > >> A(...) > >> ... When != B(...) > >> > >> julia > >> > > _______________________________________________ > > Cocci mailing list > > Cocci at systeme.lip6.fr > > https://systeme.lip6.fr/mailman/listinfo/cocci > > > > -- > Peter > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: 答复: how to write such matching case? 2014-01-27 14:11 ` Peter Senna Tschudin 2014-01-27 16:07 ` Julia Lawall @ 2014-01-28 2:22 ` 林嘉(程二 福州) 2014-01-28 7:24 ` Julia Lawall 1 sibling, 1 reply; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-01-28 2:22 UTC (permalink / raw) To: cocci Just like this? @@ @@ * main(...){ ...when != reg_process_exit_action(...) } I tried, but it seems does not work... I make the function reg...() called in main(), but it still report main() -----????----- ???: Peter Senna Tschudin [mailto:peter.senna at gmail.com] ????: 2014?1?27? 22:12 ???: ??(?? ??) ??: Julia Lawall; cocci at systeme.lip6.fr ??: Re: [Cocci] ??: ??: how to write such matching case? You can try: @@ @@ * main () { ... when != Foo(...) } This semantic patch will match functions named main that do not contain call to function Foo; On Mon, Jan 27, 2014 at 2:55 PM, ??(?? ??) <linjia@ruijie.com.cn> wrote: > Thanks for explain, but if I want to write a simple match, that is > function foo must be called in main() e.g. > > int main(...) > { > ... > Foo(...); > ... > } > > I write it as > > @@ > @@ > main(...) { > <... > when != reg_process_exit_action(...) > ...> > } > > Reports: 53 57 > Fatal error: exception Failure("minus: parse error: > = File "rgos.cocci", line 6, column 2, charpos = 53 > around = '...>', whole content = ...> > ") > > What does it mean? > > By the way, I still don?t know when I should use '<'and'>' and when need not? > > -----????----- > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > ????: 2014?1?27? 20:34 > ???: ??(?? ??) > ??: cocci at systeme.lip6.fr > ??: Re: ??: [Cocci] how to write such matching case? > > On Mon, 27 Jan 2014, ??(?? ??) wrote: > >> I wrote this >> >> @@ >> @@ >> cli_printf(...) >> ... when != cli_client_execmd_fail(...) >> >> >> it reports: >> Fatal error: exception Failure("False should not be in the final >> result. Perhaps your rule doesn't contain any +/-/* code, or you >> have a failed dependency.") >> >> >> But i found there is not 'minus' in an example.cocci either.... > > There is a * (indicating a line of interest). You can use that. If you use that, you will get an exists semantics for the ... (there exists an execution path that satisfies the property). Otherwise, you get a foral semantics (all execution paths have to satisfy the property). > > julia > >> >> >> // >> // Add missing pci_dev_put >> // >> // Target: Linux >> // Copyright: 2012 - LIP6/INRIA >> // License: Licensed under ISC. See LICENSE or >> http://www.isc.org/software/license >> // Author: Julia Lawall <Julia.Lawall@lip6.fr> // URL: >> http://coccinelle.lip6.fr/ // URL: http://coccinellery.org/ >> >> @@ >> local idexpression x; >> expression e; >> @@ >> >> *x = pci_get_slot(...) >> ... when != true x == NULL >> when != pci_dev_put(x) >> when != e = x >> when != if (x != NULL) {<+... pci_dev_put(x); ...+>} *return ...; >> >> >> >> >> >> -----????----- >> ???: Julia Lawall [mailto:julia.lawall at lip6.fr] >> ????: 2014?1?26? 19:19 >> ???: ??(?? ??) >> ??: cocci at systeme.lip6.fr >> ??: Re: [Cocci] how to write such matching case? >> >> On Sun, 26 Jan 2014, ??(?? ??) wrote: >> >> > In my project, it's required that if function A is called, and >> > function B must be called following, just like this >> > >> > Foo(...) >> > { >> > If ... { >> > A(....); >> > ... >> > B(....); >> > } >> > } >> > >> > Or >> > >> > Foo1(...) >> > { >> > A(....); >> > B(...); >> > } >> > >> > >> > How to write a patch to find the missing case? Such as >> > >> > Foo(...) >> > { >> > If ... { >> > A(....); >> > ... >> > } >> > } >> > >> > Or >> > >> > Foo1(...) >> > { >> > A(....); >> > ... >> > } >> >> A(...) >> ... When != B(...) >> >> julia >> > _______________________________________________ > Cocci mailing list > Cocci at systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci -- Peter ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: 答复: how to write such matching case? 2014-01-28 2:22 ` [Cocci] 答复: " 林嘉(程二 福州) @ 2014-01-28 7:24 ` Julia Lawall 2014-02-12 2:34 ` [Cocci] 答复: " 林嘉(程二 福州) 0 siblings, 1 reply; 53+ messages in thread From: Julia Lawall @ 2014-01-28 7:24 UTC (permalink / raw) To: cocci On Tue, 28 Jan 2014, ??(?? ??) wrote: > Just like this? > @@ > @@ > * main(...){ > ...when != reg_process_exit_action(...) > } > > > I tried, but it seems does not work... > > I make the function reg...() called in main(), but it still report main() Probably because there exists a control flow path in which it is not called. If you want the forall semantics, put forall in between the initial @@ julia > > -----????----- > ???: Peter Senna Tschudin [mailto:peter.senna at gmail.com] > ????: 2014?1?27? 22:12 > ???: ??(?? ??) > ??: Julia Lawall; cocci at systeme.lip6.fr > ??: Re: [Cocci] ??: ??: how to write such matching case? > > You can try: > > @@ > @@ > * main () { > ... > when != Foo(...) > } > > This semantic patch will match functions named main that do not contain call to function Foo; > > On Mon, Jan 27, 2014 at 2:55 PM, ??(?? ??) <linjia@ruijie.com.cn> wrote: > > Thanks for explain, but if I want to write a simple match, that is > > function foo must be called in main() e.g. > > > > int main(...) > > { > > ... > > Foo(...); > > ... > > } > > > > I write it as > > > > @@ > > @@ > > main(...) { > > <... > > when != reg_process_exit_action(...) > > ...> > > } > > > > Reports: 53 57 > > Fatal error: exception Failure("minus: parse error: > > = File "rgos.cocci", line 6, column 2, charpos = 53 > > around = '...>', whole content = ...> > > ") > > > > What does it mean? > > > > By the way, I still don?t know when I should use '<'and'>' and when need not? > > > > -----????----- > > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > > ????: 2014?1?27? 20:34 > > ???: ??(?? ??) > > ??: cocci at systeme.lip6.fr > > ??: Re: ??: [Cocci] how to write such matching case? > > > > On Mon, 27 Jan 2014, ??(?? ??) wrote: > > > >> I wrote this > >> > >> @@ > >> @@ > >> cli_printf(...) > >> ... when != cli_client_execmd_fail(...) > >> > >> > >> it reports: > >> Fatal error: exception Failure("False should not be in the final > >> result. Perhaps your rule doesn't contain any +/-/* code, or you > >> have a failed dependency.") > >> > >> > >> But i found there is not 'minus' in an example.cocci either.... > > > > There is a * (indicating a line of interest). You can use that. If you use that, you will get an exists semantics for the ... (there exists an execution path that satisfies the property). Otherwise, you get a foral semantics (all execution paths have to satisfy the property). > > > > julia > > > >> > >> > >> // > >> // Add missing pci_dev_put > >> // > >> // Target: Linux > >> // Copyright: 2012 - LIP6/INRIA > >> // License: Licensed under ISC. See LICENSE or > >> http://www.isc.org/software/license > >> // Author: Julia Lawall <Julia.Lawall@lip6.fr> // URL: > >> http://coccinelle.lip6.fr/ // URL: http://coccinellery.org/ > >> > >> @@ > >> local idexpression x; > >> expression e; > >> @@ > >> > >> *x = pci_get_slot(...) > >> ... when != true x == NULL > >> when != pci_dev_put(x) > >> when != e = x > >> when != if (x != NULL) {<+... pci_dev_put(x); ...+>} *return ...; > >> > >> > >> > >> > >> > >> -----????----- > >> ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > >> ????: 2014?1?26? 19:19 > >> ???: ??(?? ??) > >> ??: cocci at systeme.lip6.fr > >> ??: Re: [Cocci] how to write such matching case? > >> > >> On Sun, 26 Jan 2014, ??(?? ??) wrote: > >> > >> > In my project, it's required that if function A is called, and > >> > function B must be called following, just like this > >> > > >> > Foo(...) > >> > { > >> > If ... { > >> > A(....); > >> > ... > >> > B(....); > >> > } > >> > } > >> > > >> > Or > >> > > >> > Foo1(...) > >> > { > >> > A(....); > >> > B(...); > >> > } > >> > > >> > > >> > How to write a patch to find the missing case? Such as > >> > > >> > Foo(...) > >> > { > >> > If ... { > >> > A(....); > >> > ... > >> > } > >> > } > >> > > >> > Or > >> > > >> > Foo1(...) > >> > { > >> > A(....); > >> > ... > >> > } > >> > >> A(...) > >> ... When != B(...) > >> > >> julia > >> > > _______________________________________________ > > Cocci mailing list > > Cocci at systeme.lip6.fr > > https://systeme.lip6.fr/mailman/listinfo/cocci > > > > -- > Peter > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: 答复: 答复: how to write such matching case? 2014-01-28 7:24 ` Julia Lawall @ 2014-02-12 2:34 ` 林嘉(程二 福州) 2014-02-12 6:22 ` Julia Lawall 0 siblings, 1 reply; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-02-12 2:34 UTC (permalink / raw) To: cocci You mean this? @forall@ @@ * main(){ ...when != reg_process_exit_action(...) } And my 'main' function is straightforward without flow control int main(void) { struct AAAA foo; struct AAA foo2; struct BBB foo3, *p; printf("%d\n", sizeof(((struct AAAA*)0)->aa)); printf("%d %d %d\n", foo.aa.c, foo2.c, foo3.value); memset(p, 0, sizeof(*p)); reg_process_exit_action(0, RESTART); return 0; } -----????----- ???: Julia Lawall [mailto:julia.lawall at lip6.fr] ????: 2014?1?28? 15:25 ???: ??(?? ??) ??: Peter Senna Tschudin; cocci at systeme.lip6.fr ??: Re: ??: [Cocci] ??: ??: how to write such matching case? On Tue, 28 Jan 2014, ??(?? ??) wrote: > Just like this? > @@ > @@ > * main(...){ > ...when != reg_process_exit_action(...) } > > > I tried, but it seems does not work... > > I make the function reg...() called in main(), but it still report > main() Probably because there exists a control flow path in which it is not called. If you want the forall semantics, put forall in between the initial @@ julia > > -----????----- > ???: Peter Senna Tschudin [mailto:peter.senna at gmail.com] > ????: 2014?1?27? 22:12 > ???: ??(?? ??) > ??: Julia Lawall; cocci at systeme.lip6.fr > ??: Re: [Cocci] ??: ??: how to write such matching case? > > You can try: > > @@ > @@ > * main () { > ... > when != Foo(...) > } > > This semantic patch will match functions named main that do not > contain call to function Foo; > > On Mon, Jan 27, 2014 at 2:55 PM, ??(?? ??) <linjia@ruijie.com.cn> wrote: > > Thanks for explain, but if I want to write a simple match, that is > > function foo must be called in main() e.g. > > > > int main(...) > > { > > ... > > Foo(...); > > ... > > } > > > > I write it as > > > > @@ > > @@ > > main(...) { > > <... > > when != reg_process_exit_action(...) > > ...> > > } > > > > Reports: 53 57 > > Fatal error: exception Failure("minus: parse error: > > = File "rgos.cocci", line 6, column 2, charpos = 53 > > around = '...>', whole content = ...> > > ") > > > > What does it mean? > > > > By the way, I still don?t know when I should use '<'and'>' and when need not? > > > > -----????----- > > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > > ????: 2014?1?27? 20:34 > > ???: ??(?? ??) > > ??: cocci at systeme.lip6.fr > > ??: Re: ??: [Cocci] how to write such matching case? > > > > On Mon, 27 Jan 2014, ??(?? ??) wrote: > > > >> I wrote this > >> > >> @@ > >> @@ > >> cli_printf(...) > >> ... when != cli_client_execmd_fail(...) > >> > >> > >> it reports: > >> Fatal error: exception Failure("False should not be in the final > >> result. Perhaps your rule doesn't contain any +/-/* code, or you > >> have a failed dependency.") > >> > >> > >> But i found there is not 'minus' in an example.cocci either.... > > > > There is a * (indicating a line of interest). You can use that. If you use that, you will get an exists semantics for the ... (there exists an execution path that satisfies the property). Otherwise, you get a foral semantics (all execution paths have to satisfy the property). > > > > julia > > > >> > >> > >> // > >> // Add missing pci_dev_put > >> // > >> // Target: Linux > >> // Copyright: 2012 - LIP6/INRIA > >> // License: Licensed under ISC. See LICENSE or > >> http://www.isc.org/software/license > >> // Author: Julia Lawall <Julia.Lawall@lip6.fr> // URL: > >> http://coccinelle.lip6.fr/ // URL: http://coccinellery.org/ > >> > >> @@ > >> local idexpression x; > >> expression e; > >> @@ > >> > >> *x = pci_get_slot(...) > >> ... when != true x == NULL > >> when != pci_dev_put(x) > >> when != e = x > >> when != if (x != NULL) {<+... pci_dev_put(x); ...+>} *return > >> ...; > >> > >> > >> > >> > >> > >> -----????----- > >> ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > >> ????: 2014?1?26? 19:19 > >> ???: ??(?? ??) > >> ??: cocci at systeme.lip6.fr > >> ??: Re: [Cocci] how to write such matching case? > >> > >> On Sun, 26 Jan 2014, ??(?? ??) wrote: > >> > >> > In my project, it's required that if function A is called, and > >> > function B must be called following, just like this > >> > > >> > Foo(...) > >> > { > >> > If ... { > >> > A(....); > >> > ... > >> > B(....); > >> > } > >> > } > >> > > >> > Or > >> > > >> > Foo1(...) > >> > { > >> > A(....); > >> > B(...); > >> > } > >> > > >> > > >> > How to write a patch to find the missing case? Such as > >> > > >> > Foo(...) > >> > { > >> > If ... { > >> > A(....); > >> > ... > >> > } > >> > } > >> > > >> > Or > >> > > >> > Foo1(...) > >> > { > >> > A(....); > >> > ... > >> > } > >> > >> A(...) > >> ... When != B(...) > >> > >> julia > >> > > _______________________________________________ > > Cocci mailing list > > Cocci at systeme.lip6.fr > > https://systeme.lip6.fr/mailman/listinfo/cocci > > > > -- > Peter > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: 答复: 答复: how to write such matching case? 2014-02-12 2:34 ` [Cocci] 答复: " 林嘉(程二 福州) @ 2014-02-12 6:22 ` Julia Lawall 2014-02-14 7:57 ` [Cocci] Fatal error: exception Failure("no python") 林嘉(程二 福州) 0 siblings, 1 reply; 53+ messages in thread From: Julia Lawall @ 2014-02-12 6:22 UTC (permalink / raw) To: cocci On Wed, 12 Feb 2014, ??(?? ??) wrote: > You mean this? > > @forall@ > @@ > * main(){ I've lost track of the issue, but here you have () as your parameter list and in the code there is a void. If you want void, you need to put void. If you don't care about the contents of the parameter list, you should put ... julia > ...when != reg_process_exit_action(...) > } > > And my 'main' function is straightforward without flow control > > int main(void) > { > struct AAAA foo; > struct AAA foo2; > struct BBB foo3, *p; > printf("%d\n", sizeof(((struct AAAA*)0)->aa)); > printf("%d %d %d\n", foo.aa.c, foo2.c, foo3.value); > memset(p, 0, sizeof(*p)); > reg_process_exit_action(0, RESTART); > return 0; > } > > > > -----????----- > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > ????: 2014?1?28? 15:25 > ???: ??(?? ??) > ??: Peter Senna Tschudin; cocci at systeme.lip6.fr > ??: Re: ??: [Cocci] ??: ??: how to write such matching case? > > > > On Tue, 28 Jan 2014, ??(?? ??) wrote: > > > Just like this? > > @@ > > @@ > > * main(...){ > > ...when != reg_process_exit_action(...) } > > > > > > I tried, but it seems does not work... > > > > I make the function reg...() called in main(), but it still report > > main() > > Probably because there exists a control flow path in which it is not called. If you want the forall semantics, put forall in between the initial @@ > > julia > > > > > > -----????----- > > ???: Peter Senna Tschudin [mailto:peter.senna at gmail.com] > > ????: 2014?1?27? 22:12 > > ???: ??(?? ??) > > ??: Julia Lawall; cocci at systeme.lip6.fr > > ??: Re: [Cocci] ??: ??: how to write such matching case? > > > > You can try: > > > > @@ > > @@ > > * main () { > > ... > > when != Foo(...) > > } > > > > This semantic patch will match functions named main that do not > > contain call to function Foo; > > > > On Mon, Jan 27, 2014 at 2:55 PM, ??(?? ??) <linjia@ruijie.com.cn> wrote: > > > Thanks for explain, but if I want to write a simple match, that is > > > function foo must be called in main() e.g. > > > > > > int main(...) > > > { > > > ... > > > Foo(...); > > > ... > > > } > > > > > > I write it as > > > > > > @@ > > > @@ > > > main(...) { > > > <... > > > when != reg_process_exit_action(...) > > > ...> > > > } > > > > > > Reports: 53 57 > > > Fatal error: exception Failure("minus: parse error: > > > = File "rgos.cocci", line 6, column 2, charpos = 53 > > > around = '...>', whole content = ...> > > > ") > > > > > > What does it mean? > > > > > > By the way, I still don?t know when I should use '<'and'>' and when need not? > > > > > > -----????----- > > > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > > > ????: 2014?1?27? 20:34 > > > ???: ??(?? ??) > > > ??: cocci at systeme.lip6.fr > > > ??: Re: ??: [Cocci] how to write such matching case? > > > > > > On Mon, 27 Jan 2014, ??(?? ??) wrote: > > > > > >> I wrote this > > >> > > >> @@ > > >> @@ > > >> cli_printf(...) > > >> ... when != cli_client_execmd_fail(...) > > >> > > >> > > >> it reports: > > >> Fatal error: exception Failure("False should not be in the final > > >> result. Perhaps your rule doesn't contain any +/-/* code, or you > > >> have a failed dependency.") > > >> > > >> > > >> But i found there is not 'minus' in an example.cocci either.... > > > > > > There is a * (indicating a line of interest). You can use that. If you use that, you will get an exists semantics for the ... (there exists an execution path that satisfies the property). Otherwise, you get a foral semantics (all execution paths have to satisfy the property). > > > > > > julia > > > > > >> > > >> > > >> // > > >> // Add missing pci_dev_put > > >> // > > >> // Target: Linux > > >> // Copyright: 2012 - LIP6/INRIA > > >> // License: Licensed under ISC. See LICENSE or > > >> http://www.isc.org/software/license > > >> // Author: Julia Lawall <Julia.Lawall@lip6.fr> // URL: > > >> http://coccinelle.lip6.fr/ // URL: http://coccinellery.org/ > > >> > > >> @@ > > >> local idexpression x; > > >> expression e; > > >> @@ > > >> > > >> *x = pci_get_slot(...) > > >> ... when != true x == NULL > > >> when != pci_dev_put(x) > > >> when != e = x > > >> when != if (x != NULL) {<+... pci_dev_put(x); ...+>} *return > > >> ...; > > >> > > >> > > >> > > >> > > >> > > >> -----????----- > > >> ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > > >> ????: 2014?1?26? 19:19 > > >> ???: ??(?? ??) > > >> ??: cocci at systeme.lip6.fr > > >> ??: Re: [Cocci] how to write such matching case? > > >> > > >> On Sun, 26 Jan 2014, ??(?? ??) wrote: > > >> > > >> > In my project, it's required that if function A is called, and > > >> > function B must be called following, just like this > > >> > > > >> > Foo(...) > > >> > { > > >> > If ... { > > >> > A(....); > > >> > ... > > >> > B(....); > > >> > } > > >> > } > > >> > > > >> > Or > > >> > > > >> > Foo1(...) > > >> > { > > >> > A(....); > > >> > B(...); > > >> > } > > >> > > > >> > > > >> > How to write a patch to find the missing case? Such as > > >> > > > >> > Foo(...) > > >> > { > > >> > If ... { > > >> > A(....); > > >> > ... > > >> > } > > >> > } > > >> > > > >> > Or > > >> > > > >> > Foo1(...) > > >> > { > > >> > A(....); > > >> > ... > > >> > } > > >> > > >> A(...) > > >> ... When != B(...) > > >> > > >> julia > > >> > > > _______________________________________________ > > > Cocci mailing list > > > Cocci at systeme.lip6.fr > > > https://systeme.lip6.fr/mailman/listinfo/cocci > > > > > > > > -- > > Peter > > > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] Fatal error: exception Failure("no python") 2014-02-12 6:22 ` Julia Lawall @ 2014-02-14 7:57 ` 林嘉(程二 福州) 2014-02-14 8:56 ` Julia Lawall 2014-02-14 9:51 ` [Cocci] " Nicolas Palix 0 siblings, 2 replies; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-02-14 7:57 UTC (permalink / raw) To: cocci I did some 'apt-get install update' and 'apt-get install upgrade' today Then I found cocc can not work, it reports: Fatal error: exception Failure("no python") But I run python -v is ok # python -V Python 2.7.3 Why? How can I fix this? ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] Fatal error: exception Failure("no python") 2014-02-14 7:57 ` [Cocci] Fatal error: exception Failure("no python") 林嘉(程二 福州) @ 2014-02-14 8:56 ` Julia Lawall 2014-02-14 12:39 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-02-14 9:51 ` [Cocci] " Nicolas Palix 1 sibling, 1 reply; 53+ messages in thread From: Julia Lawall @ 2014-02-14 8:56 UTC (permalink / raw) To: cocci On Fri, 14 Feb 2014, ??(?? ??) wrote: > I did some 'apt-get install update' and 'apt-get install upgrade' today > > Then I found cocc can not work, it reports: Fatal error: exception Failure("no python") > > But I run python -v is ok > > # python -V > Python 2.7.3 > > Why? How can I fix this? Perhaps your python is not in a standard place? What distribution of Linux are you using? What version of Coccinelle do you have? julia ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: Fatal error: exception Failure("no python") 2014-02-14 8:56 ` Julia Lawall @ 2014-02-14 12:39 ` 林嘉(程二 福州) 0 siblings, 0 replies; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-02-14 12:39 UTC (permalink / raw) To: cocci -----????----- ???: Julia Lawall [mailto:julia.lawall at lip6.fr] ????: 2014?2?14? 16:56 ???: ??(?? ??) ??: cocci at systeme.lip6.fr ??: Re: [Cocci] Fatal error: exception Failure("no python") On Fri, 14 Feb 2014, ??(?? ??) wrote: > I did some 'apt-get install update' and 'apt-get install upgrade' > today > > Then I found cocc can not work, it reports: Fatal error: exception > Failure("no python") > > But I run python -v is ok > > # python -V > Python 2.7.3 > > Why? How can I fix this? Perhaps your python is not in a standard place? I don?t know how python is placed..but the result of whereis is # whereis python python: /usr/bin/python2.6 /usr/bin/python2.7 /usr/bin/python2.7-config /usr/bin/python /etc/python2.6 /etc/python2.7 /etc/python /usr/lib/python2.6 /usr/lib/python2.7 /usr/bin/X11/python2.6 /usr/bin/X11/python2.7 /usr/bin/X11/python2.7-config /usr/bin/X11/python /usr/local/lib/python2.6 /usr/local/lib/python2.7 /usr/include/python2.6 /usr/include/python2.7 /usr/include/python2.7_d /usr/include/python2.6_d /usr/share/python /usr/share/man/man1/python.1.gz What distribution of Linux are you using? What version of Coccinelle do you have? ~~~~~~~~~~~ uname -ar Linux debian 2.6.33.7-co-0.7.9 #1 PREEMPT Sat Apr 9 20:30:51 UTC 2011 i686 GNU/Linux I installed 0.2.3.firstly, then installed 1.0.0-rc19 julia ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] Fatal error: exception Failure("no python") 2014-02-14 7:57 ` [Cocci] Fatal error: exception Failure("no python") 林嘉(程二 福州) 2014-02-14 8:56 ` Julia Lawall @ 2014-02-14 9:51 ` Nicolas Palix 2014-02-14 12:43 ` [Cocci] 答复: " 林嘉(程二 福州) 1 sibling, 1 reply; 53+ messages in thread From: Nicolas Palix @ 2014-02-14 9:51 UTC (permalink / raw) To: cocci Hi, On Fri, Feb 14, 2014 at 8:57 AM, ??(?? ??) <linjia@ruijie.com.cn> wrote: > Then I found cocc can not work, it reports: Fatal error: exception Failure("no python") You get is error when spatch has not been compiled with Python support but you are still using cocci file with Python snippet. Does ' spatch --version' report python support ? Such as spatch version 1.0.0-rc15 with Python support and with PCRE support Regards, -- Nicolas Palix Tel: +33 4 76 51 46 27 http://lig-membres.imag.fr/palix/ ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: Fatal error: exception Failure("no python") 2014-02-14 9:51 ` [Cocci] " Nicolas Palix @ 2014-02-14 12:43 ` 林嘉(程二 福州) 2014-02-14 12:58 ` Julia Lawall 0 siblings, 1 reply; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-02-14 12:43 UTC (permalink / raw) To: cocci # spatch --version spatch version 1.0.0-rc19 without Python support and with Str regexp support but I didn't make and make install with option '--without-python ' that is I pressed ./configure --enable-release, just it and now when I run "/usr/bin/spatch -sp_file ....", all is ok, it seems version 0.2.3 runs but "spatch -sp_file " reports fail, seems version 1.0 runs? -----????----- ???: npalix.work at gmail.com [mailto:npalix.work at gmail.com] ?? Nicolas Palix ????: 2014?2?14? 17:51 ???: ??(?? ??) ??: cocci at systeme.lip6.fr ??: Re: [Cocci] Fatal error: exception Failure("no python") Hi, On Fri, Feb 14, 2014 at 8:57 AM, ??(?? ??) <linjia@ruijie.com.cn> wrote: > Then I found cocc can not work, it reports: Fatal error: exception > Failure("no python") You get is error when spatch has not been compiled with Python support but you are still using cocci file with Python snippet. Does ' spatch --version' report python support ? Such as spatch version 1.0.0-rc15 with Python support and with PCRE support Regards, -- Nicolas Palix Tel: +33 4 76 51 46 27 http://lig-membres.imag.fr/palix/ ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: Fatal error: exception Failure("no python") 2014-02-14 12:43 ` [Cocci] 答复: " 林嘉(程二 福州) @ 2014-02-14 12:58 ` Julia Lawall 2014-02-15 2:30 ` [Cocci] 答复: " 林嘉(程二 福州) 0 siblings, 1 reply; 53+ messages in thread From: Julia Lawall @ 2014-02-14 12:58 UTC (permalink / raw) To: cocci On Fri, 14 Feb 2014, ??(?? ??) wrote: > # spatch --version > spatch version 1.0.0-rc19 without Python support and with Str regexp support > > but I didn't make and make install with option '--without-python ' > that is I pressed ./configure --enable-release, just it > > > and now when I run "/usr/bin/spatch -sp_file ....", all is ok, it seems version 0.2.3 runs > but "spatch -sp_file " reports fail, seems version 1.0 runs? I'm not sure to understand what you are doing. Are you compiling coccinelle from the source code, or are you using one from a distribution. If you are compiling from source code, what does it say about python when you run ./configure? I think that you are not the first to have this problem. Maybe search for python on the gmane archives of the mailing list: http://blog.gmane.org/gmane.comp.version-control.coccinelle julia > > -----????----- > ???: npalix.work at gmail.com [mailto:npalix.work at gmail.com] ?? Nicolas Palix > ????: 2014?2?14? 17:51 > ???: ??(?? ??) > ??: cocci at systeme.lip6.fr > ??: Re: [Cocci] Fatal error: exception Failure("no python") > > Hi, > > On Fri, Feb 14, 2014 at 8:57 AM, ??(?? ??) <linjia@ruijie.com.cn> wrote: > > Then I found cocc can not work, it reports: Fatal error: exception > > Failure("no python") > > You get is error when spatch has not been compiled with Python support but you are still using cocci file with Python snippet. > > Does ' spatch --version' report python support ? > Such as > spatch version 1.0.0-rc15 with Python support and with PCRE support > > Regards, > -- > Nicolas Palix > Tel: +33 4 76 51 46 27 > http://lig-membres.imag.fr/palix/ > _______________________________________________ > Cocci mailing list > Cocci at systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: Fatal error: exception Failure("no python") 2014-02-14 12:58 ` Julia Lawall @ 2014-02-15 2:30 ` 林嘉(程二 福州) 2014-02-15 6:18 ` Julia Lawall 0 siblings, 1 reply; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-02-15 2:30 UTC (permalink / raw) To: cocci Sorry , I didn?t describe clearly. Well, The step is following: 1 I installed cocc by using deb package 'coccinelle_0.2.3.deb-1_i386.deb' at first. All is ok. 2 Then I think its version may be too low. So I downloaded the source of version 1.0 and make install. All is ok. 3 I made some 'apt-get install upgrade and update' for another reason, I didn?t think it has something to do with cocc. 4 the problem occur when I use cocc. 5 I found I can run cocc by "/usr/bin/spatch " , but not by "spatch ", I think there is some chaos in the cocc config now, see following... root at debian:~/windows/ctest/cocc# /usr/bin/spatch -version spatch version 0.2.3 with Python support root at debian:~/windows/ctest/cocc# spatch -version spatch version 1.0.0-rc19 without Python support and with Str regexp support root at debian:~/windows/ctest/cocc# -----????----- ???: Julia Lawall [mailto:julia.lawall at lip6.fr] ????: 2014?2?14? 20:58 ???: ??(?? ??) ??: Nicolas Palix; cocci at systeme.lip6.fr ??: Re: [Cocci] ??: Fatal error: exception Failure("no python") On Fri, 14 Feb 2014, ??(?? ??) wrote: > # spatch --version > spatch version 1.0.0-rc19 without Python support and with Str regexp > support > > but I didn't make and make install with option '--without-python ' > that is I pressed ./configure --enable-release, just it > > > and now when I run "/usr/bin/spatch -sp_file ....", all is ok, it > seems version 0.2.3 runs but "spatch -sp_file " reports fail, seems version 1.0 runs? I'm not sure to understand what you are doing. Are you compiling coccinelle from the source code, or are you using one from a distribution. If you are compiling from source code, what does it say about python when you run ./configure? I think that you are not the first to have this problem. Maybe search for python on the gmane archives of the mailing list: http://blog.gmane.org/gmane.comp.version-control.coccinelle julia > > -----????----- > ???: npalix.work at gmail.com [mailto:npalix.work at gmail.com] ?? Nicolas > Palix > ????: 2014?2?14? 17:51 > ???: ??(?? ??) > ??: cocci at systeme.lip6.fr > ??: Re: [Cocci] Fatal error: exception Failure("no python") > > Hi, > > On Fri, Feb 14, 2014 at 8:57 AM, ??(?? ??) <linjia@ruijie.com.cn> wrote: > > Then I found cocc can not work, it reports: Fatal error: exception > > Failure("no python") > > You get is error when spatch has not been compiled with Python support but you are still using cocci file with Python snippet. > > Does ' spatch --version' report python support ? > Such as > spatch version 1.0.0-rc15 with Python support and with PCRE > support > > Regards, > -- > Nicolas Palix > Tel: +33 4 76 51 46 27 > http://lig-membres.imag.fr/palix/ > _______________________________________________ > Cocci mailing list > Cocci at systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: Fatal error: exception Failure("no python") 2014-02-15 2:30 ` [Cocci] 答复: " 林嘉(程二 福州) @ 2014-02-15 6:18 ` Julia Lawall 2014-02-17 1:27 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-02-17 5:45 ` [Cocci] what is the function of 'position' in SMPL 林嘉(程二 福州) 0 siblings, 2 replies; 53+ messages in thread From: Julia Lawall @ 2014-02-15 6:18 UTC (permalink / raw) To: cocci On Sat, 15 Feb 2014, ??(?? ??) wrote: > Sorry , I didn?t describe clearly. Well, The step is following: > > 1 I installed cocc by using deb package 'coccinelle_0.2.3.deb-1_i386.deb' at first. All is ok. This is not good at all. But I am not sure why you are using that version. That is from the old stable version of Debian. The current stable version is 1.0.0-rc12. > 2 Then I think its version may be too low. So I downloaded the source of > version 1.0 and make install. All is ok. Did you run ./configure? I'm surprised that it owuld let you run make without doing that. ./configure will normally succeed, but I believe it says at the end what features it managed to find. > 3 I made some 'apt-get install upgrade and update' for another reason, I > didn?t think it has something to do with cocc. > > 4 the problem occur when I use cocc. > > 5 I found I can run cocc by "/usr/bin/spatch " , but not by "spatch ", I > think there is some chaos in the cocc config now, see following... Coccinelle goes in /usr/local/bin > root at debian:~/windows/ctest/cocc# /usr/bin/spatch -version > spatch version 0.2.3 with Python support > root at debian:~/windows/ctest/cocc# spatch -version > spatch version 1.0.0-rc19 without Python support and with Str regexp support > root at debian:~/windows/ctest/cocc# Clearly it has not found python during the configure operation. Maybe if you rerun configure and save the output in a file, you will find the problem. julia > > > -----????----- > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > ????: 2014?2?14? 20:58 > ???: ??(?? ??) > ??: Nicolas Palix; cocci at systeme.lip6.fr > ??: Re: [Cocci] ??: Fatal error: exception Failure("no python") > > On Fri, 14 Feb 2014, ??(?? ??) wrote: > > > # spatch --version > > spatch version 1.0.0-rc19 without Python support and with Str regexp > > support > > > > but I didn't make and make install with option '--without-python ' > > that is I pressed ./configure --enable-release, just it > > > > > > and now when I run "/usr/bin/spatch -sp_file ....", all is ok, it > > seems version 0.2.3 runs but "spatch -sp_file " reports fail, seems version 1.0 runs? > > I'm not sure to understand what you are doing. Are you compiling coccinelle from the source code, or are you using one from a distribution. > If you are compiling from source code, what does it say about python when you run ./configure? > > I think that you are not the first to have this problem. Maybe search for python on the gmane archives of the mailing list: > > http://blog.gmane.org/gmane.comp.version-control.coccinelle > > julia > > > > > > -----????----- > > ???: npalix.work at gmail.com [mailto:npalix.work at gmail.com] ?? Nicolas > > Palix > > ????: 2014?2?14? 17:51 > > ???: ??(?? ??) > > ??: cocci at systeme.lip6.fr > > ??: Re: [Cocci] Fatal error: exception Failure("no python") > > > > Hi, > > > > On Fri, Feb 14, 2014 at 8:57 AM, ??(?? ??) <linjia@ruijie.com.cn> wrote: > > > Then I found cocc can not work, it reports: Fatal error: exception > > > Failure("no python") > > > > You get is error when spatch has not been compiled with Python support but you are still using cocci file with Python snippet. > > > > Does ' spatch --version' report python support ? > > Such as > > spatch version 1.0.0-rc15 with Python support and with PCRE > > support > > > > Regards, > > -- > > Nicolas Palix > > Tel: +33 4 76 51 46 27 > > http://lig-membres.imag.fr/palix/ > > _______________________________________________ > > Cocci mailing list > > Cocci at systeme.lip6.fr > > https://systeme.lip6.fr/mailman/listinfo/cocci > > > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: 答复: Fatal error: exception Failure("no python") 2014-02-15 6:18 ` Julia Lawall @ 2014-02-17 1:27 ` 林嘉(程二 福州) 2014-02-17 9:38 ` Julia Lawall 2014-02-17 12:49 ` Arie Middelkoop 2014-02-17 5:45 ` [Cocci] what is the function of 'position' in SMPL 林嘉(程二 福州) 1 sibling, 2 replies; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-02-17 1:27 UTC (permalink / raw) To: cocci Yes, I rerun the configure with enable python, and found lack of the pkg-config python lib ./configure --enable-release --enable-ocaml --enable-python --enable-pcre-syntax reports? ./configure: line 15220: /root/windows/install/coccinelle-master/coccinelle-master/setup/fake-subst.sh: Permission denied configure: error: the python scripts feature is enabled but the pkg-config python library is not found finally, I directly download the 1.0 version Debian package from https://packages.debian.org/wheezy/i386/coccinelle/download -----????----- ???: Julia Lawall [mailto:julia.lawall at lip6.fr] ????: 2014?2?15? 14:18 ???: ??(?? ??) ??: Nicolas Palix; cocci at systeme.lip6.fr ??: Re: ??: [Cocci] ??: Fatal error: exception Failure("no python") On Sat, 15 Feb 2014, ??(?? ??) wrote: > Sorry , I didn?t describe clearly. Well, The step is following: > > 1 I installed cocc by using deb package 'coccinelle_0.2.3.deb-1_i386.deb' at first. All is ok. This is not good at all. But I am not sure why you are using that version. That is from the old stable version of Debian. The current stable version is 1.0.0-rc12. > 2 Then I think its version may be too low. So I downloaded the source > of version 1.0 and make install. All is ok. Did you run ./configure? I'm surprised that it owuld let you run make without doing that. ./configure will normally succeed, but I believe it says at the end what features it managed to find. > 3 I made some 'apt-get install upgrade and update' for another reason, > I didn?t think it has something to do with cocc. > > 4 the problem occur when I use cocc. > > 5 I found I can run cocc by "/usr/bin/spatch " , but not by "spatch ", > I think there is some chaos in the cocc config now, see following... Coccinelle goes in /usr/local/bin > root at debian:~/windows/ctest/cocc# /usr/bin/spatch -version spatch > version 0.2.3 with Python support root at debian:~/windows/ctest/cocc# > spatch -version spatch version 1.0.0-rc19 without Python support and > with Str regexp support root at debian:~/windows/ctest/cocc# Clearly it has not found python during the configure operation. Maybe if you rerun configure and save the output in a file, you will find the problem. julia > > > -----????----- > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > ????: 2014?2?14? 20:58 > ???: ??(?? ??) > ??: Nicolas Palix; cocci at systeme.lip6.fr > ??: Re: [Cocci] ??: Fatal error: exception Failure("no python") > > On Fri, 14 Feb 2014, ??(?? ??) wrote: > > > # spatch --version > > spatch version 1.0.0-rc19 without Python support and with Str regexp > > support > > > > but I didn't make and make install with option '--without-python ' > > that is I pressed ./configure --enable-release, just it > > > > > > and now when I run "/usr/bin/spatch -sp_file ....", all is ok, it > > seems version 0.2.3 runs but "spatch -sp_file " reports fail, seems version 1.0 runs? > > I'm not sure to understand what you are doing. Are you compiling coccinelle from the source code, or are you using one from a distribution. > If you are compiling from source code, what does it say about python when you run ./configure? > > I think that you are not the first to have this problem. Maybe search for python on the gmane archives of the mailing list: > > http://blog.gmane.org/gmane.comp.version-control.coccinelle > > julia > > > > > > -----????----- > > ???: npalix.work at gmail.com [mailto:npalix.work at gmail.com] ?? Nicolas > > Palix > > ????: 2014?2?14? 17:51 > > ???: ??(?? ??) > > ??: cocci at systeme.lip6.fr > > ??: Re: [Cocci] Fatal error: exception Failure("no python") > > > > Hi, > > > > On Fri, Feb 14, 2014 at 8:57 AM, ??(?? ??) <linjia@ruijie.com.cn> wrote: > > > Then I found cocc can not work, it reports: Fatal error: exception > > > Failure("no python") > > > > You get is error when spatch has not been compiled with Python support but you are still using cocci file with Python snippet. > > > > Does ' spatch --version' report python support ? > > Such as > > spatch version 1.0.0-rc15 with Python support and with PCRE > > support > > > > Regards, > > -- > > Nicolas Palix > > Tel: +33 4 76 51 46 27 > > http://lig-membres.imag.fr/palix/ > > _______________________________________________ > > Cocci mailing list > > Cocci at systeme.lip6.fr > > https://systeme.lip6.fr/mailman/listinfo/cocci > > > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: 答复: Fatal error: exception Failure("no python") 2014-02-17 1:27 ` [Cocci] 答复: " 林嘉(程二 福州) @ 2014-02-17 9:38 ` Julia Lawall 2014-02-17 12:49 ` Arie Middelkoop 1 sibling, 0 replies; 53+ messages in thread From: Julia Lawall @ 2014-02-17 9:38 UTC (permalink / raw) To: cocci In the mailing list archives there is some discussion of Python: http://blog.gmane.org/gmane.comp.version-control.coccinelle/day=20130823 http://blog.gmane.org/gmane.comp.version-control.coccinelle/day=20130824 julia On Mon, 17 Feb 2014, ??(?? ??) wrote: > Yes, I rerun the configure with enable python, and found lack of the pkg-config python lib > > > ./configure --enable-release --enable-ocaml --enable-python --enable-pcre-syntax > reports? > ./configure: line 15220: /root/windows/install/coccinelle-master/coccinelle-master/setup/fake-subst.sh: Permission denied > configure: error: the python scripts feature is enabled but the pkg-config python library is not found > > > > finally, I directly download the 1.0 version Debian package from https://packages.debian.org/wheezy/i386/coccinelle/download > > > -----????----- > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > ????: 2014?2?15? 14:18 > ???: ??(?? ??) > ??: Nicolas Palix; cocci at systeme.lip6.fr > ??: Re: ??: [Cocci] ??: Fatal error: exception Failure("no python") > > On Sat, 15 Feb 2014, ??(?? ??) wrote: > > > Sorry , I didn?t describe clearly. Well, The step is following: > > > > 1 I installed cocc by using deb package 'coccinelle_0.2.3.deb-1_i386.deb' at first. All is ok. > > This is not good at all. But I am not sure why you are using that version. That is from the old stable version of Debian. The current stable version is 1.0.0-rc12. > > > 2 Then I think its version may be too low. So I downloaded the source > > of version 1.0 and make install. All is ok. > > Did you run ./configure? I'm surprised that it owuld let you run make without doing that. ./configure will normally succeed, but I believe it says at the end what features it managed to find. > > > 3 I made some 'apt-get install upgrade and update' for another reason, > > I didn?t think it has something to do with cocc. > > > > 4 the problem occur when I use cocc. > > > > 5 I found I can run cocc by "/usr/bin/spatch " , but not by "spatch ", > > I think there is some chaos in the cocc config now, see following... > > Coccinelle goes in /usr/local/bin > > > root at debian:~/windows/ctest/cocc# /usr/bin/spatch -version spatch > > version 0.2.3 with Python support root at debian:~/windows/ctest/cocc# > > spatch -version spatch version 1.0.0-rc19 without Python support and > > with Str regexp support root at debian:~/windows/ctest/cocc# > > Clearly it has not found python during the configure operation. Maybe if you rerun configure and save the output in a file, you will find the problem. > > julia > > > > > > > -----????----- > > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > > ????: 2014?2?14? 20:58 > > ???: ??(?? ??) > > ??: Nicolas Palix; cocci at systeme.lip6.fr > > ??: Re: [Cocci] ??: Fatal error: exception Failure("no python") > > > > On Fri, 14 Feb 2014, ??(?? ??) wrote: > > > > > # spatch --version > > > spatch version 1.0.0-rc19 without Python support and with Str regexp > > > support > > > > > > but I didn't make and make install with option '--without-python ' > > > that is I pressed ./configure --enable-release, just it > > > > > > > > > and now when I run "/usr/bin/spatch -sp_file ....", all is ok, it > > > seems version 0.2.3 runs but "spatch -sp_file " reports fail, seems version 1.0 runs? > > > > I'm not sure to understand what you are doing. Are you compiling coccinelle from the source code, or are you using one from a distribution. > > If you are compiling from source code, what does it say about python when you run ./configure? > > > > I think that you are not the first to have this problem. Maybe search for python on the gmane archives of the mailing list: > > > > http://blog.gmane.org/gmane.comp.version-control.coccinelle > > > > julia > > > > > > > > > > -----????----- > > > ???: npalix.work at gmail.com [mailto:npalix.work at gmail.com] ?? Nicolas > > > Palix > > > ????: 2014?2?14? 17:51 > > > ???: ??(?? ??) > > > ??: cocci at systeme.lip6.fr > > > ??: Re: [Cocci] Fatal error: exception Failure("no python") > > > > > > Hi, > > > > > > On Fri, Feb 14, 2014 at 8:57 AM, ??(?? ??) <linjia@ruijie.com.cn> wrote: > > > > Then I found cocc can not work, it reports: Fatal error: exception > > > > Failure("no python") > > > > > > You get is error when spatch has not been compiled with Python support but you are still using cocci file with Python snippet. > > > > > > Does ' spatch --version' report python support ? > > > Such as > > > spatch version 1.0.0-rc15 with Python support and with PCRE > > > support > > > > > > Regards, > > > -- > > > Nicolas Palix > > > Tel: +33 4 76 51 46 27 > > > http://lig-membres.imag.fr/palix/ > > > _______________________________________________ > > > Cocci mailing list > > > Cocci at systeme.lip6.fr > > > https://systeme.lip6.fr/mailman/listinfo/cocci > > > > > > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: 答复: Fatal error: exception Failure("no python") 2014-02-17 1:27 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-02-17 9:38 ` Julia Lawall @ 2014-02-17 12:49 ` Arie Middelkoop 2014-02-17 12:51 ` Julia Lawall 1 sibling, 1 reply; 53+ messages in thread From: Arie Middelkoop @ 2014-02-17 12:49 UTC (permalink / raw) To: cocci Check this line: ./configure: line 15220: /root/windows/install/ coccinelle-master/coccinelle-master/setup/fake-subst.sh: Permission denied That script is executed to find python when pkg-config was not found. Check whether the executable bit is set. Arie 2014-02-17 2:27 GMT+01:00 ??(?? ??) <linjia@ruijie.com.cn>: > Yes, I rerun the configure with enable python, and found lack of the pkg-config python lib > > > ./configure --enable-release --enable-ocaml --enable-python --enable-pcre-syntax > reports? > ./configure: line 15220: /root/windows/install/coccinelle-master/coccinelle-master/setup/fake-subst.sh: Permission denied > configure: error: the python scripts feature is enabled but the pkg-config python library is not found > > > > finally, I directly download the 1.0 version Debian package from https://packages.debian.org/wheezy/i386/coccinelle/download > > > -----????----- > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > ????: 2014?2?15? 14:18 > ???: ??(?? ??) > ??: Nicolas Palix; cocci at systeme.lip6.fr > ??: Re: ??: [Cocci] ??: Fatal error: exception Failure("no python") > > On Sat, 15 Feb 2014, ??(?? ??) wrote: > >> Sorry , I didn?t describe clearly. Well, The step is following: >> >> 1 I installed cocc by using deb package 'coccinelle_0.2.3.deb-1_i386.deb' at first. All is ok. > > This is not good at all. But I am not sure why you are using that version. That is from the old stable version of Debian. The current stable version is 1.0.0-rc12. > >> 2 Then I think its version may be too low. So I downloaded the source >> of version 1.0 and make install. All is ok. > > Did you run ./configure? I'm surprised that it owuld let you run make without doing that. ./configure will normally succeed, but I believe it says at the end what features it managed to find. > >> 3 I made some 'apt-get install upgrade and update' for another reason, >> I didn?t think it has something to do with cocc. >> >> 4 the problem occur when I use cocc. >> >> 5 I found I can run cocc by "/usr/bin/spatch " , but not by "spatch ", >> I think there is some chaos in the cocc config now, see following... > > Coccinelle goes in /usr/local/bin > >> root at debian:~/windows/ctest/cocc# /usr/bin/spatch -version spatch >> version 0.2.3 with Python support root at debian:~/windows/ctest/cocc# >> spatch -version spatch version 1.0.0-rc19 without Python support and >> with Str regexp support root at debian:~/windows/ctest/cocc# > > Clearly it has not found python during the configure operation. Maybe if you rerun configure and save the output in a file, you will find the problem. > > julia > >> >> >> -----????----- >> ???: Julia Lawall [mailto:julia.lawall at lip6.fr] >> ????: 2014?2?14? 20:58 >> ???: ??(?? ??) >> ??: Nicolas Palix; cocci at systeme.lip6.fr >> ??: Re: [Cocci] ??: Fatal error: exception Failure("no python") >> >> On Fri, 14 Feb 2014, ??(?? ??) wrote: >> >> > # spatch --version >> > spatch version 1.0.0-rc19 without Python support and with Str regexp >> > support >> > >> > but I didn't make and make install with option '--without-python ' >> > that is I pressed ./configure --enable-release, just it >> > >> > >> > and now when I run "/usr/bin/spatch -sp_file ....", all is ok, it >> > seems version 0.2.3 runs but "spatch -sp_file " reports fail, seems version 1.0 runs? >> >> I'm not sure to understand what you are doing. Are you compiling coccinelle from the source code, or are you using one from a distribution. >> If you are compiling from source code, what does it say about python when you run ./configure? >> >> I think that you are not the first to have this problem. Maybe search for python on the gmane archives of the mailing list: >> >> http://blog.gmane.org/gmane.comp.version-control.coccinelle >> >> julia >> >> >> > >> > -----????----- >> > ???: npalix.work at gmail.com [mailto:npalix.work at gmail.com] ?? Nicolas >> > Palix >> > ????: 2014?2?14? 17:51 >> > ???: ??(?? ??) >> > ??: cocci at systeme.lip6.fr >> > ??: Re: [Cocci] Fatal error: exception Failure("no python") >> > >> > Hi, >> > >> > On Fri, Feb 14, 2014 at 8:57 AM, ??(?? ??) <linjia@ruijie.com.cn> wrote: >> > > Then I found cocc can not work, it reports: Fatal error: exception >> > > Failure("no python") >> > >> > You get is error when spatch has not been compiled with Python support but you are still using cocci file with Python snippet. >> > >> > Does ' spatch --version' report python support ? >> > Such as >> > spatch version 1.0.0-rc15 with Python support and with PCRE >> > support >> > >> > Regards, >> > -- >> > Nicolas Palix >> > Tel: +33 4 76 51 46 27 >> > http://lig-membres.imag.fr/palix/ >> > _______________________________________________ >> > Cocci mailing list >> > Cocci at systeme.lip6.fr >> > https://systeme.lip6.fr/mailman/listinfo/cocci >> > >> > _______________________________________________ > Cocci mailing list > Cocci at systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: 答复: Fatal error: exception Failure("no python") 2014-02-17 12:49 ` Arie Middelkoop @ 2014-02-17 12:51 ` Julia Lawall 0 siblings, 0 replies; 53+ messages in thread From: Julia Lawall @ 2014-02-17 12:51 UTC (permalink / raw) To: cocci On Mon, 17 Feb 2014, Arie Middelkoop wrote: > Check this line: > > ./configure: line 15220: /root/windows/install/ > coccinelle-master/coccinelle-master/setup/fake-subst.sh: Permission denied > > That script is executed to find python when pkg-config was not found. > Check whether the executable bit is set. Thanks for the suggestion. For me it is, but perhaps it changes when someone downloads the code? julia > > Arie > > 2014-02-17 2:27 GMT+01:00 ??(?? ??) <linjia@ruijie.com.cn>: > > Yes, I rerun the configure with enable python, and found lack of the pkg-config python lib > > > > > > ./configure --enable-release --enable-ocaml --enable-python --enable-pcre-syntax > > reports? > > ./configure: line 15220: /root/windows/install/coccinelle-master/coccinelle-master/setup/fake-subst.sh: Permission denied > > configure: error: the python scripts feature is enabled but the pkg-config python library is not found > > > > > > > > finally, I directly download the 1.0 version Debian package from https://packages.debian.org/wheezy/i386/coccinelle/download > > > > > > -----????----- > > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > > ????: 2014?2?15? 14:18 > > ???: ??(?? ??) > > ??: Nicolas Palix; cocci at systeme.lip6.fr > > ??: Re: ??: [Cocci] ??: Fatal error: exception Failure("no python") > > > > On Sat, 15 Feb 2014, ??(?? ??) wrote: > > > >> Sorry , I didn?t describe clearly. Well, The step is following: > >> > >> 1 I installed cocc by using deb package 'coccinelle_0.2.3.deb-1_i386.deb' at first. All is ok. > > > > This is not good at all. But I am not sure why you are using that version. That is from the old stable version of Debian. The current stable version is 1.0.0-rc12. > > > >> 2 Then I think its version may be too low. So I downloaded the source > >> of version 1.0 and make install. All is ok. > > > > Did you run ./configure? I'm surprised that it owuld let you run make without doing that. ./configure will normally succeed, but I believe it says at the end what features it managed to find. > > > >> 3 I made some 'apt-get install upgrade and update' for another reason, > >> I didn?t think it has something to do with cocc. > >> > >> 4 the problem occur when I use cocc. > >> > >> 5 I found I can run cocc by "/usr/bin/spatch " , but not by "spatch ", > >> I think there is some chaos in the cocc config now, see following... > > > > Coccinelle goes in /usr/local/bin > > > >> root at debian:~/windows/ctest/cocc# /usr/bin/spatch -version spatch > >> version 0.2.3 with Python support root at debian:~/windows/ctest/cocc# > >> spatch -version spatch version 1.0.0-rc19 without Python support and > >> with Str regexp support root at debian:~/windows/ctest/cocc# > > > > Clearly it has not found python during the configure operation. Maybe if you rerun configure and save the output in a file, you will find the problem. > > > > julia > > > >> > >> > >> -----????----- > >> ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > >> ????: 2014?2?14? 20:58 > >> ???: ??(?? ??) > >> ??: Nicolas Palix; cocci at systeme.lip6.fr > >> ??: Re: [Cocci] ??: Fatal error: exception Failure("no python") > >> > >> On Fri, 14 Feb 2014, ??(?? ??) wrote: > >> > >> > # spatch --version > >> > spatch version 1.0.0-rc19 without Python support and with Str regexp > >> > support > >> > > >> > but I didn't make and make install with option '--without-python ' > >> > that is I pressed ./configure --enable-release, just it > >> > > >> > > >> > and now when I run "/usr/bin/spatch -sp_file ....", all is ok, it > >> > seems version 0.2.3 runs but "spatch -sp_file " reports fail, seems version 1.0 runs? > >> > >> I'm not sure to understand what you are doing. Are you compiling coccinelle from the source code, or are you using one from a distribution. > >> If you are compiling from source code, what does it say about python when you run ./configure? > >> > >> I think that you are not the first to have this problem. Maybe search for python on the gmane archives of the mailing list: > >> > >> http://blog.gmane.org/gmane.comp.version-control.coccinelle > >> > >> julia > >> > >> > >> > > >> > -----????----- > >> > ???: npalix.work at gmail.com [mailto:npalix.work at gmail.com] ?? Nicolas > >> > Palix > >> > ????: 2014?2?14? 17:51 > >> > ???: ??(?? ??) > >> > ??: cocci at systeme.lip6.fr > >> > ??: Re: [Cocci] Fatal error: exception Failure("no python") > >> > > >> > Hi, > >> > > >> > On Fri, Feb 14, 2014 at 8:57 AM, ??(?? ??) <linjia@ruijie.com.cn> wrote: > >> > > Then I found cocc can not work, it reports: Fatal error: exception > >> > > Failure("no python") > >> > > >> > You get is error when spatch has not been compiled with Python support but you are still using cocci file with Python snippet. > >> > > >> > Does ' spatch --version' report python support ? > >> > Such as > >> > spatch version 1.0.0-rc15 with Python support and with PCRE > >> > support > >> > > >> > Regards, > >> > -- > >> > Nicolas Palix > >> > Tel: +33 4 76 51 46 27 > >> > http://lig-membres.imag.fr/palix/ > >> > _______________________________________________ > >> > Cocci mailing list > >> > Cocci at systeme.lip6.fr > >> > https://systeme.lip6.fr/mailman/listinfo/cocci > >> > > >> > > _______________________________________________ > > Cocci mailing list > > Cocci at systeme.lip6.fr > > https://systeme.lip6.fr/mailman/listinfo/cocci > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] what is the function of 'position' in SMPL 2014-02-15 6:18 ` Julia Lawall 2014-02-17 1:27 ` [Cocci] 答复: " 林嘉(程二 福州) @ 2014-02-17 5:45 ` 林嘉(程二 福州) 2014-02-17 13:34 ` Peter Senna Tschudin 1 sibling, 1 reply; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-02-17 5:45 UTC (permalink / raw) To: cocci e.g. in find_unsigned.cocci @u@ type T; unsigned T i; position p; @@ i at p < 0 what is the difference with @u@ type T; unsigned T i; @@ i < 0 and what is the meaning of operator '@' ahead 'p'? ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] what is the function of 'position' in SMPL 2014-02-17 5:45 ` [Cocci] what is the function of 'position' in SMPL 林嘉(程二 福州) @ 2014-02-17 13:34 ` Peter Senna Tschudin 2014-02-18 7:26 ` [Cocci] 答复: " 林嘉(程二 福州) 0 siblings, 1 reply; 53+ messages in thread From: Peter Senna Tschudin @ 2014-02-17 13:34 UTC (permalink / raw) To: cocci p is a position metavariable. It is useful when you want to print line and column numbers of interesting parts. The @p means that the position of what matches to 'i' will be saved into p. There is some information available at: http://coccinelle.lip6.fr/docs/main_grammar.pdf On Mon, Feb 17, 2014 at 6:45 AM, ??(?? ??) <linjia@ruijie.com.cn> wrote: > e.g. in find_unsigned.cocci > > @u@ type T; unsigned T i; position p; @@ > i at p < 0 > > > what is the difference with > > @u@ type T; unsigned T i; @@ > i < 0 > > > and what is the meaning of operator '@' ahead 'p'? > > _______________________________________________ > Cocci mailing list > Cocci at systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci -- Peter ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: what is the function of 'position' in SMPL 2014-02-17 13:34 ` Peter Senna Tschudin @ 2014-02-18 7:26 ` 林嘉(程二 福州) 2014-02-18 7:33 ` Julia Lawall 2014-02-18 7:34 ` Julia Lawall 0 siblings, 2 replies; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-02-18 7:26 UTC (permalink / raw) To: cocci Thank to all What the differentce among 'Identifier declaration statement' in metavariable portion? I just guess they all can be used to express a name of variable or function For example: @@ Identifier a; or declaration a;? @@ ........... -----????----- ???: Peter Senna Tschudin [mailto:peter.senna at gmail.com] ????: 2014?2?17? 21:35 ???: ??(?? ??) ??: cocci at systeme.lip6.fr ??: Re: [Cocci] what is the function of 'position' in SMPL p is a position metavariable. It is useful when you want to print line and column numbers of interesting parts. The @p means that the position of what matches to 'i' will be saved into p. There is some information available at: http://coccinelle.lip6.fr/docs/main_grammar.pdf On Mon, Feb 17, 2014 at 6:45 AM, ??(?? ??) <linjia@ruijie.com.cn> wrote: > e.g. in find_unsigned.cocci > > @u@ type T; unsigned T i; position p; @@ i at p < 0 > > > what is the difference with > > @u@ type T; unsigned T i; @@ > i < 0 > > > and what is the meaning of operator '@' ahead 'p'? > > _______________________________________________ > Cocci mailing list > Cocci at systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci -- Peter ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: what is the function of 'position' in SMPL 2014-02-18 7:26 ` [Cocci] 答复: " 林嘉(程二 福州) @ 2014-02-18 7:33 ` Julia Lawall 2014-02-18 7:34 ` Julia Lawall 1 sibling, 0 replies; 53+ messages in thread From: Julia Lawall @ 2014-02-18 7:33 UTC (permalink / raw) To: cocci On Tue, 18 Feb 2014, ??(?? ??) wrote: > Thank to all > > What the differentce among 'Identifier declaration statement' in metavariable portion? > I just guess they all can be used to express a name of variable or function Identifier is just the name a. A declaration has a type and a semicolon. For example: int x; is a declaration, while x is an identifier. julia > For example: > > @@ > Identifier a; or declaration a;? > @@ > ........... > > > > -----????----- > ???: Peter Senna Tschudin [mailto:peter.senna at gmail.com] > ????: 2014?2?17? 21:35 > ???: ??(?? ??) > ??: cocci at systeme.lip6.fr > ??: Re: [Cocci] what is the function of 'position' in SMPL > > p is a position metavariable. It is useful when you want to print line and column numbers of interesting parts. > > The @p means that the position of what matches to 'i' will be saved into p. > > There is some information available at: > http://coccinelle.lip6.fr/docs/main_grammar.pdf > > On Mon, Feb 17, 2014 at 6:45 AM, ??(?? ??) <linjia@ruijie.com.cn> wrote: > > e.g. in find_unsigned.cocci > > > > @u@ type T; unsigned T i; position p; @@ i at p < 0 > > > > > > what is the difference with > > > > @u@ type T; unsigned T i; @@ > > i < 0 > > > > > > and what is the meaning of operator '@' ahead 'p'? > > > > _______________________________________________ > > Cocci mailing list > > Cocci at systeme.lip6.fr > > https://systeme.lip6.fr/mailman/listinfo/cocci > > > > -- > Peter > _______________________________________________ > Cocci mailing list > Cocci at systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: what is the function of 'position' in SMPL 2014-02-18 7:26 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-02-18 7:33 ` Julia Lawall @ 2014-02-18 7:34 ` Julia Lawall 2014-02-18 7:56 ` [Cocci] 答复: " 林嘉(程二 福州) 1 sibling, 1 reply; 53+ messages in thread From: Julia Lawall @ 2014-02-18 7:34 UTC (permalink / raw) To: cocci On Tue, 18 Feb 2014, ??(?? ??) wrote: > Thank to all > > What the differentce among 'Identifier declaration statement' in metavariable portion? > I just guess they all can be used to express a name of variable or function An identifier can be used to express the name of a variable, a function, a field, the name of a structure, the name of an enum, the name of a #define, etc. julia > > For example: > > @@ > Identifier a; or declaration a;? > @@ > ........... > > > > -----????----- > ???: Peter Senna Tschudin [mailto:peter.senna at gmail.com] > ????: 2014?2?17? 21:35 > ???: ??(?? ??) > ??: cocci at systeme.lip6.fr > ??: Re: [Cocci] what is the function of 'position' in SMPL > > p is a position metavariable. It is useful when you want to print line and column numbers of interesting parts. > > The @p means that the position of what matches to 'i' will be saved into p. > > There is some information available at: > http://coccinelle.lip6.fr/docs/main_grammar.pdf > > On Mon, Feb 17, 2014 at 6:45 AM, ??(?? ??) <linjia@ruijie.com.cn> wrote: > > e.g. in find_unsigned.cocci > > > > @u@ type T; unsigned T i; position p; @@ i at p < 0 > > > > > > what is the difference with > > > > @u@ type T; unsigned T i; @@ > > i < 0 > > > > > > and what is the meaning of operator '@' ahead 'p'? > > > > _______________________________________________ > > Cocci mailing list > > Cocci at systeme.lip6.fr > > https://systeme.lip6.fr/mailman/listinfo/cocci > > > > -- > Peter > _______________________________________________ > Cocci mailing list > Cocci at systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: what is the function of 'position' in SMPL 2014-02-18 7:34 ` Julia Lawall @ 2014-02-18 7:56 ` 林嘉(程二 福州) 2014-02-18 9:00 ` Julia Lawall 0 siblings, 1 reply; 53+ messages in thread From: 林嘉(程二 福州) @ 2014-02-18 7:56 UTC (permalink / raw) To: cocci Thanks, So, what's the difference between 'statement' and 'expression'? I guess statement means a complete line in c code, such as 's = socket(...);' while expression means an incomplete part, e.g. right hand of operator, 'socket(inet, 0, 0, 0)' ? -----????----- ???: Julia Lawall [mailto:julia.lawall at lip6.fr] ????: 2014?2?18? 15:35 ???: ??(?? ??) ??: cocci at systeme.lip6.fr ??: Re: [Cocci] ??: what is the function of 'position' in SMPL On Tue, 18 Feb 2014, ??(?? ??) wrote: > Thank to all > > What the differentce among 'Identifier declaration statement' in > metavariable portion? > I just guess they all can be used to express a name of variable or > function An identifier can be used to express the name of a variable, a function, a field, the name of a structure, the name of an enum, the name of a #define, etc. julia > > For example: > > @@ > Identifier a; or declaration a;? > @@ > ........... > > > > -----????----- > ???: Peter Senna Tschudin [mailto:peter.senna at gmail.com] > ????: 2014?2?17? 21:35 > ???: ??(?? ??) > ??: cocci at systeme.lip6.fr > ??: Re: [Cocci] what is the function of 'position' in SMPL > > p is a position metavariable. It is useful when you want to print line and column numbers of interesting parts. > > The @p means that the position of what matches to 'i' will be saved into p. > > There is some information available at: > http://coccinelle.lip6.fr/docs/main_grammar.pdf > > On Mon, Feb 17, 2014 at 6:45 AM, ??(?? ??) <linjia@ruijie.com.cn> wrote: > > e.g. in find_unsigned.cocci > > > > @u@ type T; unsigned T i; position p; @@ i at p < 0 > > > > > > what is the difference with > > > > @u@ type T; unsigned T i; @@ > > i < 0 > > > > > > and what is the meaning of operator '@' ahead 'p'? > > > > _______________________________________________ > > Cocci mailing list > > Cocci at systeme.lip6.fr > > https://systeme.lip6.fr/mailman/listinfo/cocci > > > > -- > Peter > _______________________________________________ > Cocci mailing list > Cocci at systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: what is the function of 'position' in SMPL 2014-02-18 7:56 ` [Cocci] 答复: " 林嘉(程二 福州) @ 2014-02-18 9:00 ` Julia Lawall 0 siblings, 0 replies; 53+ messages in thread From: Julia Lawall @ 2014-02-18 9:00 UTC (permalink / raw) To: cocci On Tue, 18 Feb 2014, ??(?? ??) wrote: > Thanks, So, what's the difference between 'statement' and 'expression'? > I guess statement means a complete line in c code, such as 's = socket(...);' while expression means an incomplete part, e.g. right hand of operator, 'socket(inet, 0, 0, 0)' ? A statement has no value. So like s = socket(...); but also if (...) return;, etc. An expression has a value. So like 3 + 4, f(), etc. x = y without a trailing semicolon is also an expression. There is a simple grammar for a C-like language here: http://marvin.cs.uidaho.edu/Teaching/CS445/c-Grammar.pdf This is not the grammar that we follow, but it can give the idea. julia ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] 答复: 答复: how to match this case? 2014-01-21 6:43 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-01-21 7:04 ` [Cocci] 答复: " 林嘉(程二 福州) @ 2014-01-21 7:48 ` Julia Lawall 1 sibling, 0 replies; 53+ messages in thread From: Julia Lawall @ 2014-01-21 7:48 UTC (permalink / raw) To: cocci On Tue, 21 Jan 2014, ??(?? ??) wrote: > Thanks for remind. > But to the "|" operator , I still don?t know how to use, for example, I wrote You need the () at the beginning and end, like I wrote. julia > > > @disable comm_assoc@ > identifier fn, p; > identifier I; > type T,T1; > expression C; > @@ > -fn(...) > -{ > -int p; > -... > -T I[C]; > | > -T I[C]; > -... > -int p; > -<+... > -if(p > C){ > -... > -} > -...+> > -} > > > > It reports: init_defs_builtins: /usr/share/coccinelle/standard.h > 126 127 > Fatal error: exception Failure("minus: parse error: > = File "os.cocci", line 12, column 0, charpos = 126 > around = '|', whole content = | > ") > > -----????----- > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > ????: 2014?1?21? 14:32 > ???: ??(?? ??) > ??: cocci at systeme.lip6.fr > ??: Re: ??: [Cocci] how to match this case? > > On Tue, 21 Jan 2014, ??(?? ??) wrote: > > > Sorry, I made a mistake , if the checkpoint is local variable, I > > should write as > > > > -int vp; > ... > > -T I[C]; > > Also, you don't know if the array is declared before or after vp. So you would need > > ( > - int vp; > ... > - T I[C]; > | > - T I[C]; > ... > - int vp; > ) > > julia > > > -<+... > > -if(vp > C || ...){ > > > > -----????----- > > ???: Julia Lawall [mailto:julia.lawall at lip6.fr] > > ????: 2014?1?21? 11:35 > > ???: ??(?? ??) > > ??: cocci at systeme.lip6.fr > > ??: Re: [Cocci] how to match this case? > > > > > > > > On Tue, 21 Jan 2014, ??(?? ??) wrote: > > > > > Following is a code with bug > > > > > > ----------------------------------- > > > void set_timeout_value(int iParam) > > > { > > > int i; > > > byte b[100]; > > > i = Geti(); > > > if (i > 100 || i < 0){ > > > return ; > > > } > > > b[i] = iParam; /* range of I is 0-100?so may overrun array* / > > > > > > } > > > ----------------------------------- > > > Now I write a patch to find it, like this > > > > > > @@ > > > identifier fn, vp; > > > identifier I; > > > type T; > > > expression C; > > > @@ > > > -fn(...,int vp,...) > > > -{ > > > -T I[C]; > > > -<+... > > > -if(vp > C || ...){ > > > -... > > > -} > > > -...+> > > > -} > > > > > > > > > But it doesn?t work, give me a log: > > > rule starting on line 1: position variables or mixed modifs > > > interfere with comm_assoc isobool (bool (int vp > int C) || ...) > > > > I will look into it, but you could try putting disable comm_assoc in between the initial @@, if you just want to see if your rule is working a little bit. > > > > julia > > > > > > > > > > can anyone tell why, thanks > > > _______________________________________________ > > > Cocci mailing list > > > Cocci at systeme.lip6.fr > > > https://systeme.lip6.fr/mailman/listinfo/cocci > > > > > > ^ permalink raw reply [flat|nested] 53+ messages in thread
* [Cocci] how to match this case? 2014-01-21 3:24 ` [Cocci] how to match this case? 林嘉(程二 福州) 2014-01-21 3:34 ` Julia Lawall @ 2014-01-21 16:42 ` Julia Lawall 1 sibling, 0 replies; 53+ messages in thread From: Julia Lawall @ 2014-01-21 16:42 UTC (permalink / raw) To: cocci On Tue, 21 Jan 2014, ??(?? ??) wrote: > Following is a code with bug > > ----------------------------------- > void set_timeout_value(int iParam) > { > int i; > byte b[100]; > i = Geti(); > if (i > 100 || i < 0){ > return ; > } > b[i] = iParam; /* range of I is 0-100?so may overrun array* / > > } > ----------------------------------- > Now I write a patch to find it, like this > > @@ > identifier fn, vp; > identifier I; > type T; > expression C; > @@ > -fn(...,int vp,...) > -{ > -T I[C]; > -<+... > -if(vp > C || ...){ > -... > -} > -...+> > -} > > > But it doesn?t work, give me a log: > rule starting on line 1: position variables or mixed modifs interfere with comm_assoc isobool (bool (int vp > int C) || ...) > > can anyone tell why, thanks I tried the above code exactly, and I didn't get the problem. I also tried removing int i; and changing i > 100 to iParam > 100, and then it was able to remove the function definition. julia ^ permalink raw reply [flat|nested] 53+ messages in thread
end of thread, other threads:[~2014-02-18 9:00 UTC | newest] Thread overview: 53+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-01-02 8:27 [Cocci] hi all, how to match the args in function 林嘉(程二 福州) [not found] ` <alpine.DEB.2.02.1401020939060.2182@localhost6.localdomain6> [not found] ` <041CF35939B5534D851F16C30DD0B8CF727F485B@fzex.ruijie.com.cn> 2014-01-02 9:16 ` [Cocci] 答复: " Julia Lawall [not found] ` <041CF35939B5534D851F16C30DD0B8CF727F488A@fzex.ruijie.com.cn> 2014-01-02 9:33 ` [Cocci] 答复: " Julia Lawall 2014-01-02 10:04 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-01-02 10:18 ` Julia Lawall 2014-01-02 12:57 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-01-02 13:20 ` Julia Lawall 2014-01-03 0:41 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-01-03 6:09 ` Julia Lawall 2014-01-21 3:24 ` [Cocci] how to match this case? 林嘉(程二 福州) 2014-01-21 3:34 ` Julia Lawall 2014-01-21 3:46 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-01-21 5:52 ` 林嘉(程二 福州) 2014-01-21 6:32 ` Julia Lawall 2014-01-21 6:43 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-01-21 7:04 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-01-21 7:48 ` Julia Lawall 2014-01-21 9:11 ` [Cocci] infinitly loop in spatch? 林嘉(程二 福州) 2014-01-21 9:22 ` Julia Lawall 2014-01-26 7:10 ` [Cocci] how to write such matching case? 林嘉(程二 福州) 2014-01-26 11:19 ` Julia Lawall 2014-01-27 0:40 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-01-27 12:34 ` Julia Lawall 2014-01-27 1:34 ` 林嘉(程二 福州) 2014-01-27 12:33 ` Julia Lawall 2014-01-27 13:55 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-01-27 14:11 ` Peter Senna Tschudin 2014-01-27 16:07 ` Julia Lawall 2014-01-28 2:22 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-01-28 7:24 ` Julia Lawall 2014-02-12 2:34 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-02-12 6:22 ` Julia Lawall 2014-02-14 7:57 ` [Cocci] Fatal error: exception Failure("no python") 林嘉(程二 福州) 2014-02-14 8:56 ` Julia Lawall 2014-02-14 12:39 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-02-14 9:51 ` [Cocci] " Nicolas Palix 2014-02-14 12:43 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-02-14 12:58 ` Julia Lawall 2014-02-15 2:30 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-02-15 6:18 ` Julia Lawall 2014-02-17 1:27 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-02-17 9:38 ` Julia Lawall 2014-02-17 12:49 ` Arie Middelkoop 2014-02-17 12:51 ` Julia Lawall 2014-02-17 5:45 ` [Cocci] what is the function of 'position' in SMPL 林嘉(程二 福州) 2014-02-17 13:34 ` Peter Senna Tschudin 2014-02-18 7:26 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-02-18 7:33 ` Julia Lawall 2014-02-18 7:34 ` Julia Lawall 2014-02-18 7:56 ` [Cocci] 答复: " 林嘉(程二 福州) 2014-02-18 9:00 ` Julia Lawall 2014-01-21 7:48 ` [Cocci] 答复: 答复: how to match this case? Julia Lawall 2014-01-21 16:42 ` [Cocci] " 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.