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 <[email protected]>
---
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
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 <[email protected]>
> ---
> 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
> 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
> 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