cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] [PATCH] Configuring COCCI parameter as a directory is supportted
@ 2019-10-23  8:32 zhongshiqi
  2019-10-23  8:55 ` Julia Lawall
  2019-10-23 13:20 ` Markus Elfring
  0 siblings, 2 replies; 5+ messages in thread
From: zhongshiqi @ 2019-10-23  8:32 UTC (permalink / raw)
  To: Julia.Lawall
  Cc: wang.yi59, michal.lkml, nicolas.palix, linux-kernel, xue.zhihong,
	cheng.shengyu, zhongshiqi, cocci

This patch puts a modification in scripts/coccicheck which supports users
in configuring COCCI parameter as a directory to traverse files in
directory. 

Signed-off-by: zhongshiqi <zhong.shiqi@zte.com.cn>
---
 scripts/coccicheck | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/coccicheck b/scripts/coccicheck
index e04d328..a1c4197 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -257,6 +257,10 @@ if [ "$COCCI" = "" ] ; then
     for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' -type f | sort`; do
 	coccinelle $f
     done
+elif [ -d "$COCCI" ] ; then
+    for f in `find $COCCI/ -name '*.cocci' -type f | sort`; do
+	coccinelle $f
+    done
 else
     coccinelle $COCCI
 fi
-- 
2.9.5

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Cocci] [PATCH] Configuring COCCI parameter as a directory is supportted
  2019-10-23  8:32 [Cocci] [PATCH] Configuring COCCI parameter as a directory is supportted zhongshiqi
@ 2019-10-23  8:55 ` Julia Lawall
  2019-10-23  9:40   ` [Cocci] [PATCH] Configuring COCCI parameter as a directory issupportted zhong.shiqi
  2019-10-23 14:08   ` [Cocci] [PATCH] coccicheck: Configuring COCCI parameter for supporting a directory search Markus Elfring
  2019-10-23 13:20 ` Markus Elfring
  1 sibling, 2 replies; 5+ messages in thread
From: Julia Lawall @ 2019-10-23  8:55 UTC (permalink / raw)
  To: zhongshiqi
  Cc: wang.yi59, michal.lkml, nicolas.palix, linux-kernel, xue.zhihong,
	cheng.shengyu, cocci



On Wed, 23 Oct 2019, zhongshiqi wrote:

> This patch puts a modification in scripts/coccicheck which supports users
> in configuring COCCI parameter as a directory to traverse files in
> directory.
>
> Signed-off-by: zhongshiqi <zhong.shiqi@zte.com.cn>
> ---
>  scripts/coccicheck | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/scripts/coccicheck b/scripts/coccicheck
> index e04d328..a1c4197 100755
> --- a/scripts/coccicheck
> +++ b/scripts/coccicheck
> @@ -257,6 +257,10 @@ if [ "$COCCI" = "" ] ; then
>      for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' -type f | sort`; do
>  	coccinelle $f
>      done
> +elif [ -d "$COCCI" ] ; then
> +    for f in `find $COCCI/ -name '*.cocci' -type f | sort`; do
> +	coccinelle $f
> +    done
>  else
>      coccinelle $COCCI
>  fi

Thanks for the contribution.  I'm not that knowledgeable about these
scripts.  What is the relation between the last two if branches?  If the
first one fails, does that mean that $COCCI has no definition?  In that
case, is the final else useful?

thanks,
julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Cocci] [PATCH] Configuring COCCI parameter as a directory issupportted
  2019-10-23  8:55 ` Julia Lawall
@ 2019-10-23  9:40   ` zhong.shiqi
  2019-10-23 14:08   ` [Cocci] [PATCH] coccicheck: Configuring COCCI parameter for supporting a directory search Markus Elfring
  1 sibling, 0 replies; 5+ messages in thread
From: zhong.shiqi @ 2019-10-23  9:40 UTC (permalink / raw)
  To: julia.lawall
  Cc: wang.yi59, michal.lkml, nicolas.palix, linux-kernel, xue.zhihong,
	cheng.shengyu, cocci


[-- Attachment #1.1: Type: text/plain, Size: 2295 bytes --]

Julia,
        Add a script to determine if $COCCI is a directory. 
        If $COCCI is undefined, means first if branch success, then first if branch is executed. 
        If $COCCI is defined, means that fails, then elif branch is executed. And then, The elif branch judges whether $COCCI is a directory(based on "-d" option). 
        If it is a directory, the next statement is executed. If it is not a directory or if it is just a file with a a suffix of cocci, the statement after the final else branch is executed.
Thanks for you reply,
zhong.shiqi





E: zhong.shiqi@zte.com.cn
www.zte.com.cn
------------------Original Mail------------------
Sender: JuliaLawall <julia.lawall@lip6.fr>
To: zhongshiqi10265867;
CC: Julia.Lawall@lip6.fr <Julia.Lawall@lip6.fr>Gilles Muller <Gilles.Muller@lip6.fr>nicolas.palix@imag.fr <nicolas.palix@imag.fr>michal.lkml@markovi.net <michal.lkml@markovi.net>cocci@systeme.lip6.fr <cocci@systeme.lip6.fr>linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>xue zhihong10017789;wang yi10129963;cheng shengyu10013557;yamada.masahiro@socionext.com <yamada.masahiro@socionext.com>
Date: 2019/10/23 16:55
Subject: Re: [PATCH] Configuring COCCI parameter as a directory issupportted


On Wed, 23 Oct 2019, zhongshiqi wrote:

> This patch puts a modification in scripts/coccicheck which supports users
> in configuring COCCI parameter as a directory to traverse files in
> directory.
>
> Signed-off-by: zhongshiqi <zhong.shiqi@zte.com.cn>
> ---
>  scripts/coccicheck | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/scripts/coccicheck b/scripts/coccicheck
> index e04d328..a1c4197 100755
> --- a/scripts/coccicheck
> +++ b/scripts/coccicheck
> @@ -257,6 +257,10 @@ if [ "$COCCI" = "" ] ; then
>      for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' -type f | sort`; do
>      coccinelle $f
>      done
> +elif [ -d "$COCCI" ] ; then
> +    for f in `find $COCCI/ -name '*.cocci' -type f | sort`; do
> +    coccinelle $f
> +    done
>  else
>      coccinelle $COCCI
>  fi

Thanks for the contribution.  I'm not that knowledgeable about these
scripts.  What is the relation between the last two if branches?  If the
first one fails, does that mean that $COCCI has no definition?  In that
case, is the final else useful?

thanks,
julia

[-- Attachment #2: Type: text/plain, Size: 136 bytes --]

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Cocci] [PATCH] coccicheck: Configuring COCCI parameter for supporting a directory search
  2019-10-23  8:32 [Cocci] [PATCH] Configuring COCCI parameter as a directory is supportted zhongshiqi
  2019-10-23  8:55 ` Julia Lawall
@ 2019-10-23 13:20 ` Markus Elfring
  1 sibling, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2019-10-23 13:20 UTC (permalink / raw)
  To: zhongshiqi, cocci
  Cc: Yi Wang, Michal Marek, Nicolas Palix, kernel-janitors,
	linux-kernel, Xue Zhihong, Cheng Shengyu

> This patch puts a modification in scripts/coccicheck which supports users
> in configuring COCCI parameter as a directory to traverse files in directory.

* I suggest to improve this change description according to a recommended
  “imperative mood”.
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=13b86bc4cd648eae69fdcf3d04b2750c76350053#n151

* Please fix your patch subject.

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Cocci] [PATCH] coccicheck: Configuring COCCI parameter for supporting a directory search
  2019-10-23  8:55 ` Julia Lawall
  2019-10-23  9:40   ` [Cocci] [PATCH] Configuring COCCI parameter as a directory issupportted zhong.shiqi
@ 2019-10-23 14:08   ` Markus Elfring
  1 sibling, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2019-10-23 14:08 UTC (permalink / raw)
  To: Julia Lawall, cocci
  Cc: Yi Wang, Michal Marek, Nicolas Palix, kernel-janitors,
	linux-kernel, Xue Zhihong, Cheng Shengyu, zhongshiqi

> What is the relation between the last two if branches?

A small addition is proposed for this bash script.


> If the first one fails, does that mean that $COCCI has no definition?

No. - It was checked if an empty sting was passed.
A file system check is tried then to determine if a valid directory was specified.
This parameter could be used then for the specification of a specific start
directory for calling the tool “find”, couldn't it?


> In that case, is the final else useful?

Hopefully, yes.

Which software behaviour do you expect for a string which would not
be recognised as an usable directory in a specific moment
during script execution?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-10-23 14:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-23  8:32 [Cocci] [PATCH] Configuring COCCI parameter as a directory is supportted zhongshiqi
2019-10-23  8:55 ` Julia Lawall
2019-10-23  9:40   ` [Cocci] [PATCH] Configuring COCCI parameter as a directory issupportted zhong.shiqi
2019-10-23 14:08   ` [Cocci] [PATCH] coccicheck: Configuring COCCI parameter for supporting a directory search Markus Elfring
2019-10-23 13:20 ` Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).