Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1428091 > unrolled thread

[PATCH v3 5/8] scripts: add Linux .cocciconfig for coccinelle

Started by"Luis R. Rodriguez" <mcgrof@kernel.org>
First post2016-06-21 21:30 +0200
Last post2016-06-22 08:00 +0200
Articles 8 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v3 5/8] scripts: add Linux .cocciconfig for coccinelle "Luis R. Rodriguez" <mcgrof@kernel.org> - 2016-06-21 21:30 +0200
    Re: [PATCH v3 5/8] scripts: add Linux .cocciconfig for coccinelle Julia Lawall <julia.lawall@lip6.fr> - 2016-06-21 22:40 +0200
      Re: [PATCH v3 5/8] scripts: add Linux .cocciconfig for coccinelle "Luis R. Rodriguez" <mcgrof@kernel.org> - 2016-06-22 01:50 +0200
        Re: [PATCH v3 5/8] scripts: add Linux .cocciconfig for coccinelle Julia Lawall <julia.lawall@lip6.fr> - 2016-06-22 08:10 +0200
    Re: [PATCH v3 5/8] scripts: add Linux .cocciconfig for coccinelle "Nicolas Palix (LIG)" <Nicolas.Palix@imag.fr> - 2016-06-21 23:10 +0200
      Re: [PATCH v3 5/8] scripts: add Linux .cocciconfig for coccinelle Julia Lawall <julia.lawall@lip6.fr> - 2016-06-21 23:30 +0200
        Re: [PATCH v3 5/8] scripts: add Linux .cocciconfig for coccinelle "Luis R. Rodriguez" <mcgrof@kernel.org> - 2016-06-22 02:20 +0200
          Re: [PATCH v3 5/8] scripts: add Linux .cocciconfig for coccinelle Julia Lawall <julia.lawall@lip6.fr> - 2016-06-22 08:00 +0200

#1428091 — [PATCH v3 5/8] scripts: add Linux .cocciconfig for coccinelle

From"Luis R. Rodriguez" <mcgrof@kernel.org>
Date2016-06-21 21:30 +0200
Subject[PATCH v3 5/8] scripts: add Linux .cocciconfig for coccinelle
Message-ID<rMzx0-1xY-15@gated-at.bofh.it>
Help Coccinelle when used against Linux with a set of sensible defaults
options for Linux. This hints to coccinelle git can be used for 'git grep'
queries over coccigrep. A timeout of 200 seconds should suffice for now.

If you use idutils you can override for 'make coccicheck' by using the
SPFLAGS option as follows:

First build the index, for example:
mkid -s

Pick the cocci file you wnat to work with:
export COCCI=scripts/coccinelle/misc/irqf_oneshot.cocci

Then run coccicheck:
$ make coccicheck V=1 MODE=report SPFLAGS="--use-idutils ID"

Coccinelle supports reading .cocciconfig from different directories,
the later one overriding the previous reads in the following order:

 o Your current user's home directory is processed first
 o Your directory from which spatch is called is processed next
 o The directory provided with the --dir option is processed last, if used

Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
---
 .cocciconfig | 3 +++
 .gitignore   | 1 +
 2 files changed, 4 insertions(+)
 create mode 100644 .cocciconfig

diff --git a/.cocciconfig b/.cocciconfig
new file mode 100644
index 000000000000..43967c6b2015
--- /dev/null
+++ b/.cocciconfig
@@ -0,0 +1,3 @@
+[spatch]
+	options = --timeout 200
+	options = --use-gitgrep
diff --git a/.gitignore b/.gitignore
index 2be25f771bd8..c2ed4ecb0acd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -67,6 +67,7 @@ Module.symvers
 #
 !.gitignore
 !.mailmap
+!.cocciconfig
 
 #
 # Generated include files
-- 
2.8.2

[toc] | [next] | [standalone]


#1428138

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-06-21 22:40 +0200
Message-ID<rMACJ-2cL-15@gated-at.bofh.it>
In reply to#1428091
On Tue, 21 Jun 2016, Luis R. Rodriguez wrote:

> Help Coccinelle when used against Linux with a set of sensible defaults
> options for Linux. This hints to coccinelle git can be used for 'git grep'
> queries over coccigrep. A timeout of 200 seconds should suffice for now.
> 
> If you use idutils you can override for 'make coccicheck' by using the
> SPFLAGS option as follows:
> 
> First build the index, for example:
> mkid -s

Coccinelle provides a script for this: scripts/idutils_index.sh.  This 
script contains:

mkid -i C --output .id-utils.index

Then the Coccinelle flag --use-idutils will find the index, without having 
to specify the name.  Coccinelle searches for the index in the directory 
on which it is working, so it is not necessary to specify an absolute 
path.

julia

> Pick the cocci file you wnat to work with:
> export COCCI=scripts/coccinelle/misc/irqf_oneshot.cocci
> 
> Then run coccicheck:
> $ make coccicheck V=1 MODE=report SPFLAGS="--use-idutils ID"
> 
> Coccinelle supports reading .cocciconfig from different directories,
> the later one overriding the previous reads in the following order:
> 
>  o Your current user's home directory is processed first
>  o Your directory from which spatch is called is processed next
>  o The directory provided with the --dir option is processed last, if used
> 
> Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
> ---
>  .cocciconfig | 3 +++
>  .gitignore   | 1 +
>  2 files changed, 4 insertions(+)
>  create mode 100644 .cocciconfig
> 
> diff --git a/.cocciconfig b/.cocciconfig
> new file mode 100644
> index 000000000000..43967c6b2015
> --- /dev/null
> +++ b/.cocciconfig
> @@ -0,0 +1,3 @@
> +[spatch]
> +	options = --timeout 200
> +	options = --use-gitgrep
> diff --git a/.gitignore b/.gitignore
> index 2be25f771bd8..c2ed4ecb0acd 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -67,6 +67,7 @@ Module.symvers
>  #
>  !.gitignore
>  !.mailmap
> +!.cocciconfig
>  
>  #
>  # Generated include files
> -- 
> 2.8.2
> 
> 

[toc] | [prev] | [next] | [standalone]


#1428264

From"Luis R. Rodriguez" <mcgrof@kernel.org>
Date2016-06-22 01:50 +0200
Message-ID<rMDAB-42Y-1@gated-at.bofh.it>
In reply to#1428138
On Tue, Jun 21, 2016 at 10:29:53PM +0200, Julia Lawall wrote:
[...]

> mkid -i C --output .id-utils.index
> 
> [...] Coccinelle searches for the index in the directory 
> on which it is working

Can you clarify if this is $PWD from which we spawn spatch or
the --dir, or the current directory that spatch is working on
at the moment.

  Luis

[toc] | [prev] | [next] | [standalone]


#1428438

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-06-22 08:10 +0200
Message-ID<rMJwl-88Y-3@gated-at.bofh.it>
In reply to#1428264
On Wed, 22 Jun 2016, Luis R. Rodriguez wrote:

> On Tue, Jun 21, 2016 at 10:29:53PM +0200, Julia Lawall wrote:
> [...]
> 
> > mkid -i C --output .id-utils.index
> > 
> > [...] Coccinelle searches for the index in the directory 
> > on which it is working
> 
> Can you clarify if this is $PWD from which we spawn spatch or
> the --dir, or the current directory that spatch is working on
> at the moment.

Sorry for not being clear.  If you say spatch -dir /one/two/three 
--use-idutils, it will use /one/two/three/.id-utils.index

julia

[toc] | [prev] | [next] | [standalone]


#1428166

From"Nicolas Palix (LIG)" <Nicolas.Palix@imag.fr>
Date2016-06-21 23:10 +0200
Message-ID<rMB5L-2DJ-17@gated-at.bofh.it>
In reply to#1428091

[Multipart message — attachments visible in raw view] — view raw

Le 21/06/16 à 21:21, Luis R. Rodriguez a écrit :
> Help Coccinelle when used against Linux with a set of sensible defaults
> options for Linux. This hints to coccinelle git can be used for 'git grep'
> queries over coccigrep. A timeout of 200 seconds should suffice for now.
>
> If you use idutils you can override for 'make coccicheck' by using the
> SPFLAGS option as follows:
>
> First build the index, for example:
> mkid -s
>
> Pick the cocci file you wnat to work with:
> export COCCI=scripts/coccinelle/misc/irqf_oneshot.cocci
>
> Then run coccicheck:
> $ make coccicheck V=1 MODE=report SPFLAGS="--use-idutils ID"
>
> Coccinelle supports reading .cocciconfig from different directories,
> the later one overriding the previous reads in the following order:
>
>  o Your current user's home directory is processed first
>  o Your directory from which spatch is called is processed next
>  o The directory provided with the --dir option is processed last, if used
>
> Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
Acked-by: Nicolas Palix <nicolas.palix@imag.fr>

> ---
>  .cocciconfig | 3 +++
>  .gitignore   | 1 +
>  2 files changed, 4 insertions(+)
>  create mode 100644 .cocciconfig
>
> diff --git a/.cocciconfig b/.cocciconfig
> new file mode 100644
> index 000000000000..43967c6b2015
> --- /dev/null
> +++ b/.cocciconfig
> @@ -0,0 +1,3 @@
> +[spatch]
> +	options = --timeout 200
> +	options = --use-gitgrep
> diff --git a/.gitignore b/.gitignore
> index 2be25f771bd8..c2ed4ecb0acd 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -67,6 +67,7 @@ Module.symvers
>  #
>  !.gitignore
>  !.mailmap
> +!.cocciconfig
>
>  #
>  # Generated include files
>


-- 
Nicolas Palix
http://lig-membres.imag.fr/palix/

[toc] | [prev] | [next] | [standalone]


#1428192

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-06-21 23:30 +0200
Message-ID<rMBp8-2Kp-37@gated-at.bofh.it>
In reply to#1428166

[Multipart message — attachments visible in raw view] — view raw

On Tue, 21 Jun 2016, Nicolas Palix (LIG) wrote:

> Le 21/06/16 à 21:21, Luis R. Rodriguez a écrit :
> > Help Coccinelle when used against Linux with a set of sensible defaults
> > options for Linux. This hints to coccinelle git can be used for 'git grep'
> > queries over coccigrep. A timeout of 200 seconds should suffice for now.
> > 
> > If you use idutils you can override for 'make coccicheck' by using the
> > SPFLAGS option as follows:
> > 
> > First build the index, for example:
> > mkid -s
> > 
> > Pick the cocci file you wnat to work with:
> > export COCCI=scripts/coccinelle/misc/irqf_oneshot.cocci
> > 
> > Then run coccicheck:
> > $ make coccicheck V=1 MODE=report SPFLAGS="--use-idutils ID"
> > 
> > Coccinelle supports reading .cocciconfig from different directories,
> > the later one overriding the previous reads in the following order:
> > 
> >  o Your current user's home directory is processed first
> >  o Your directory from which spatch is called is processed next
> >  o The directory provided with the --dir option is processed last, if used
> > 
> > Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
> Acked-by: Nicolas Palix <nicolas.palix@imag.fr>

Hmm, I can see at least some advantages to encouraging people to do it the 
Coccinelle way, with the Coccinelle script rather than mkid directly.  
Then, if we need some other features specific to Coccinelle, we can just 
add them.

julia

> 
> > ---
> >  .cocciconfig | 3 +++
> >  .gitignore   | 1 +
> >  2 files changed, 4 insertions(+)
> >  create mode 100644 .cocciconfig
> > 
> > diff --git a/.cocciconfig b/.cocciconfig
> > new file mode 100644
> > index 000000000000..43967c6b2015
> > --- /dev/null
> > +++ b/.cocciconfig
> > @@ -0,0 +1,3 @@
> > +[spatch]
> > +	options = --timeout 200
> > +	options = --use-gitgrep
> > diff --git a/.gitignore b/.gitignore
> > index 2be25f771bd8..c2ed4ecb0acd 100644
> > --- a/.gitignore
> > +++ b/.gitignore
> > @@ -67,6 +67,7 @@ Module.symvers
> >  #
> >  !.gitignore
> >  !.mailmap
> > +!.cocciconfig
> > 
> >  #
> >  # Generated include files
> > 
> 
> 
> -- 
> Nicolas Palix
> http://lig-membres.imag.fr/palix/
> 
> 

[toc] | [prev] | [next] | [standalone]


#1428274

From"Luis R. Rodriguez" <mcgrof@kernel.org>
Date2016-06-22 02:20 +0200
Message-ID<rME3D-4tX-3@gated-at.bofh.it>
In reply to#1428192
On Tue, Jun 21, 2016 at 11:12:54PM +0200, Julia Lawall wrote:
> On Tue, 21 Jun 2016, Nicolas Palix (LIG) wrote:
> 
> > Le 21/06/16 à 21:21, Luis R. Rodriguez a écrit :
> > > Help Coccinelle when used against Linux with a set of sensible defaults
> > > options for Linux. This hints to coccinelle git can be used for 'git grep'
> > > queries over coccigrep. A timeout of 200 seconds should suffice for now.
> > > 
> > > If you use idutils you can override for 'make coccicheck' by using the
> > > SPFLAGS option as follows:
> > > 
> > > First build the index, for example:
> > > mkid -s
> > > 
> > > Pick the cocci file you wnat to work with:
> > > export COCCI=scripts/coccinelle/misc/irqf_oneshot.cocci
> > > 
> > > Then run coccicheck:
> > > $ make coccicheck V=1 MODE=report SPFLAGS="--use-idutils ID"
> > > 
> > > Coccinelle supports reading .cocciconfig from different directories,
> > > the later one overriding the previous reads in the following order:
> > > 
> > >  o Your current user's home directory is processed first
> > >  o Your directory from which spatch is called is processed next
> > >  o The directory provided with the --dir option is processed last, if used
> > > 
> > > Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
> > Acked-by: Nicolas Palix <nicolas.palix@imag.fr>
> 
> Hmm, I can see at least some advantages to encouraging people to do it the 
> Coccinelle way, with the Coccinelle script rather than mkid directly.  
> Then, if we need some other features specific to Coccinelle, we can just 
> add them.

I can simply document that if users are used to using their own
target output file, and if they wanted it to be used by coccinelle
simply symlinking .id-utils.index to it would enable coccinelle
to pick it up by default.

If that is done, would the new .cocciconfig not override though?

  Luis

[toc] | [prev] | [next] | [standalone]


#1428436

FromJulia Lawall <julia.lawall@lip6.fr>
Date2016-06-22 08:00 +0200
Message-ID<rMJmF-7Qy-7@gated-at.bofh.it>
In reply to#1428274

[Multipart message — attachments visible in raw view] — view raw

On Wed, 22 Jun 2016, Luis R. Rodriguez wrote:

> On Tue, Jun 21, 2016 at 11:12:54PM +0200, Julia Lawall wrote:
> > On Tue, 21 Jun 2016, Nicolas Palix (LIG) wrote:
> > 
> > > Le 21/06/16 à 21:21, Luis R. Rodriguez a écrit :
> > > > Help Coccinelle when used against Linux with a set of sensible defaults
> > > > options for Linux. This hints to coccinelle git can be used for 'git grep'
> > > > queries over coccigrep. A timeout of 200 seconds should suffice for now.
> > > > 
> > > > If you use idutils you can override for 'make coccicheck' by using the
> > > > SPFLAGS option as follows:
> > > > 
> > > > First build the index, for example:
> > > > mkid -s
> > > > 
> > > > Pick the cocci file you wnat to work with:
> > > > export COCCI=scripts/coccinelle/misc/irqf_oneshot.cocci
> > > > 
> > > > Then run coccicheck:
> > > > $ make coccicheck V=1 MODE=report SPFLAGS="--use-idutils ID"
> > > > 
> > > > Coccinelle supports reading .cocciconfig from different directories,
> > > > the later one overriding the previous reads in the following order:
> > > > 
> > > >  o Your current user's home directory is processed first
> > > >  o Your directory from which spatch is called is processed next
> > > >  o The directory provided with the --dir option is processed last, if used
> > > > 
> > > > Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
> > > Acked-by: Nicolas Palix <nicolas.palix@imag.fr>
> > 
> > Hmm, I can see at least some advantages to encouraging people to do it the 
> > Coccinelle way, with the Coccinelle script rather than mkid directly.  
> > Then, if we need some other features specific to Coccinelle, we can just 
> > add them.
> 
> I can simply document that if users are used to using their own
> target output file, and if they wanted it to be used by coccinelle
> simply symlinking .id-utils.index to it would enable coccinelle
> to pick it up by default.
> 
> If that is done, would the new .cocciconfig not override though?

I don't understand.

julia

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web