Re: [Cocci] coccinelle issues

2020-06-14 Thread Mike Galbraith
P.S.

> > warning: Can't find macro file: 
> > /usr/local/coccinelle/bin/../lib/coccinelle/standard.h
> > warning: Can't find default iso file: 
> > /usr/local/coccinelle/bin/../lib/coccinelle/standard.iso

The hard coded "lib" causing this issue lives in globals/config.ml.in.

diff --git a/globals/config.ml.in b/globals/config.ml.in
index 2a4135f3b06e..5969be5aa1e2 100644
--- a/globals/config.ml.in
+++ b/globals/config.ml.in
@@ -37,7 +37,7 @@ let path =
   exec_dir
 else
   List.fold_left Filename.concat exec_dir
-   [Filename.parent_dir_name; "lib"; "coccinelle"]
+   [Filename.parent_dir_name; "lib64"; "coccinelle"]
 
 
 let std_iso = ref (Filename.concat path "standard.iso")
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


[Cocci] [PATCH v3] coccinelle: api: add kzfree script

2020-06-14 Thread Denis Efremov
Check for memset()/memzero_explicit() followed by kfree()/vfree()/kvfree().

Signed-off-by: Denis Efremov 
---
Changes in v2:
 - memset_explicit() added
 - kvfree_sensitive() added
 - forall added to r1
 - ... between memset and kfree added
Changes in v3:
 - Explicit filter for definitions instead of !(file in "...") conditions
 - type T added to match casts
 - memzero_explicit() patterns fixed
 - additional rule "cond" added to filter false-positives

 scripts/coccinelle/api/kzfree.cocci | 90 +
 1 file changed, 90 insertions(+)
 create mode 100644 scripts/coccinelle/api/kzfree.cocci

diff --git a/scripts/coccinelle/api/kzfree.cocci 
b/scripts/coccinelle/api/kzfree.cocci
new file mode 100644
index ..4758ca5a781e
--- /dev/null
+++ b/scripts/coccinelle/api/kzfree.cocci
@@ -0,0 +1,90 @@
+// SPDX-License-Identifier: GPL-2.0-only
+///
+/// Use kzfree, kvfree_sensitive rather than memset or
+/// memzero_explicit followed by kfree
+///
+// Confidence: High
+// Copyright: (C) 2020 Denis Efremov ISPRAS
+// Options: --no-includes --include-headers
+//
+// Keywords: kzfree, kvfree_sensitive
+//
+
+virtual context
+virtual patch
+virtual org
+virtual report
+
+@initialize:python@
+@@
+# kmalloc_oob_in_memset uses memset to explicitly trigger out-of-bounds access
+filter = frozenset(['kmalloc_oob_in_memset', 'kzfree', 'kvfree_sensitive'])
+
+def relevant(p):
+return not (filter & {el.current_element for el in p})
+
+@cond@
+position ok;
+@@
+
+if (...)
+  \(memset@ok\|memzero_explicit@ok\)(...);
+
+@r depends on !patch forall@
+expression E;
+position p : script:python() { relevant(p) };
+position m != cond.ok;
+type T;
+@@
+
+(
+* memset@m((T)E, 0, ...);
+|
+* memzero_explicit@m((T)E, ...);
+)
+  ... when != E
+  when strict
+* \(kfree\|vfree\|kvfree\)(E)@p;
+
+@rp_memzero depends on patch@
+expression E, size;
+position p : script:python() { relevant(p) };
+type T;
+@@
+
+- memzero_explicit((T)E, size)@p;
+  ... when != E
+  when strict
+- \(kfree\|vfree\|kvfree\)(E);
++ kvfree_sensitive(E, size);
+
+@rp_memset depends on patch@
+expression E, size;
+position p : script:python() { relevant(p) };
+type T;
+@@
+
+- memset((T)E, size)@p;
+  ... when != E
+  when strict
+(
+- kfree(E);
++ kzfree(E);
+|
+- \(vfree\|kvfree\)(E);
++ kvfree_sensitive(E, size);
+)
+
+@script:python depends on report@
+p << r.p;
+@@
+
+coccilib.report.print_report(p[0],
+  "WARNING: opportunity for kzfree/kvfree_sensitive")
+
+@script:python depends on org@
+p << r.p;
+@@
+
+coccilib.org.print_todo(p[0],
+  "WARNING: opportunity for kzfree/kvfree_sensitive")
-- 
2.26.2

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


Re: [Cocci] [PATCH] coccinelle: api: add kzfree script

2020-06-14 Thread Joe Perches
On Sun, 2020-06-14 at 22:42 +0300, Denis Efremov wrote:
> On 6/4/20 7:27 PM, Joe Perches wrote:
> > On Thu, 2020-06-04 at 17:08 +0300, Denis Efremov wrote:
> > > Check for memset() with 0 followed by kfree().
> > 
> > Perhaps those uses should be memzero_explicit or kvfree_sensitive.
> > 
> Is it safe to suggest to use kzfree instead of memzero_explicit && kfree?
> Or it would be better to use kvfree_sensitive in this case.
> kzfree uses memset(0) with no barrier_data.
> 
> For example:
> diff -u -p a/drivers/crypto/inside-secure/safexcel_hash.c 
> b/drivers/crypto/inside-secure/safexcel_hash.c
[]
> @@ -1081,8 +1081,7 @@ static int safexcel_hmac_init_pad(struct
> }
>  
> /* Avoid leaking */
> -   memzero_explicit(keydup, keylen);
> -   kfree(keydup);
> +   kzfree(keydup);

It would be better to use kvfree_sensitive()


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


Re: [Cocci] [PATCH] coccinelle: api: add kzfree script

2020-06-14 Thread Denis Efremov
On 6/4/20 7:27 PM, Joe Perches wrote:
> On Thu, 2020-06-04 at 17:08 +0300, Denis Efremov wrote:
>> Check for memset() with 0 followed by kfree().
> 
> Perhaps those uses should be memzero_explicit or kvfree_sensitive.
> 

Is it safe to suggest to use kzfree instead of memzero_explicit && kfree?
Or it would be better to use kvfree_sensitive in this case.

kzfree uses memset(0) with no barrier_data.

For example:
diff -u -p a/drivers/crypto/inside-secure/safexcel_hash.c 
b/drivers/crypto/inside-secure/safexcel_hash.c
--- a/drivers/crypto/inside-secure/safexcel_hash.c
+++ b/drivers/crypto/inside-secure/safexcel_hash.c
@@ -1081,8 +1081,7 @@ static int safexcel_hmac_init_pad(struct
}
 
/* Avoid leaking */
-   memzero_explicit(keydup, keylen);
-   kfree(keydup);
+   kzfree(keydup);
 
if (ret)
return ret;

Thanks,
Denis
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] coccinelle issues

2020-06-14 Thread Julia Lawall



On Sun, 14 Jun 2020, Mike Galbraith wrote:

> On Sun, 2020-06-14 at 14:59 +0200, Julia Lawall wrote:
> >
> > On Sun, 14 Jun 2020, Mike Galbraith wrote:
> >
> > > On Sun, 2020-06-14 at 10:43 +0200, Julia Lawall wrote:
> > > >
> > > > What is your Linux distribution?
> > >
> > > openSUSE Leap-15.1
> >
> > Our CI already has an entry for openSUSE Leap.  We will look into it, but
> > if you have any further information about the problem, please let us know.
>
> Executive Summary:

Thanks for all the information!

julia

>
> warning: Can't find macro file: 
> /usr/local/coccinelle/bin/../lib/coccinelle/standard.h
> warning: Can't find default iso file: 
> /usr/local/coccinelle/bin/../lib/coccinelle/standard.iso
>
> I find those under lib64, apply symlink bandaid, proggy acks.
>
> WRT the HEAD make install booboo..
>
> git@homer:~/coccinelle> sudo make install
> mkdir -p /usr/local/coccinelle/bin /usr/local/coccinelle/lib64/coccinelle
> mkdir -p /usr/local/coccinelle/lib64/coccinelle/ocaml
> if test -f bundles/pyml/dllpyml_stubs.so; then \
> /usr/bin/install -c -m 755 bundles/pyml/dllpyml_stubs.so \
> /usr/local/coccinelle/lib64/coccinelle; \
> fi
> if test -f bundles/pcre/dllpcre_stubs.so; then \
> /usr/bin/install -c -m 755 bundles/pcre/dllpcre_stubs.so \
> /usr/local/coccinelle/lib64/coccinelle; \
> fi
> /usr/bin/install -c -m 755 spatch.opt /usr/local/coccinelle/bin/spatch
> /usr/bin/install -c -m 644 standard.h /usr/local/coccinelle/lib64/coccinelle
> /usr/bin/install -c -m 644 standard.iso /usr/local/coccinelle/lib64/coccinelle
> /usr/bin/install -c -m 644 ocaml/*.cmi 
> /usr/local/coccinelle/lib64/coccinelle/ocaml/
> if test -f ocaml/coccilib.cmx; then \
> /usr/bin/install -c -m 644 ocaml/*.cmx 
> /usr/local/coccinelle/lib64/coccinelle/ocaml/; \
> fi
> /usr/bin/install -c -m 755 tools/spgen/source/spgen.opt \
>  /usr/local/coccinelle/bin/spgen
> /usr/bin/install -c -m 644 python/coccilib/*.py \
> /usr/local/coccinelle/lib64/coccinelle/python/coccilib
> /usr/bin/install: target 
> '/usr/local/coccinelle/lib64/coccinelle/python/coccilib' is not a directory
> make: *** [Makefile:332: install-python] Error 1
>
> mkdir -p bandaid worked.
>
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


[Cocci] [PATCH v2] coccinelle: api: add kvfree script

2020-06-14 Thread Denis Efremov
Check that alloc and free types of functions match each other.

Signed-off-by: Denis Efremov 
---
Changes in v2:
 - Lines are limited to 80 characters where possible
 - Confidence changed from High to Medium because of 
   fs/btrfs/send.c:1119 false-positive
 - __vmalloc_area_node() explicitly excluded from analysis
   instead of !(file in "mm/vmalloc.c") condition

 scripts/coccinelle/api/kvfree.cocci | 227 
 1 file changed, 227 insertions(+)
 create mode 100644 scripts/coccinelle/api/kvfree.cocci

diff --git a/scripts/coccinelle/api/kvfree.cocci 
b/scripts/coccinelle/api/kvfree.cocci
new file mode 100644
index ..9455f9866ad8
--- /dev/null
+++ b/scripts/coccinelle/api/kvfree.cocci
@@ -0,0 +1,227 @@
+// SPDX-License-Identifier: GPL-2.0-only
+///
+/// Check that kvmalloc'ed memory is freed by kfree functions,
+/// vmalloc'ed by vfree functions and kvmalloc'ed by kvfree
+/// functions.
+///
+// Confidence: Medium
+// Copyright: (C) 2020 Denis Efremov ISPRAS
+// Options: --no-includes --include-headers
+//
+
+virtual patch
+virtual report
+virtual org
+virtual context
+
+@initialize:python@
+@@
+# low-level memory api
+filter = frozenset(['__vmalloc_area_node'])
+
+def relevant(p):
+return not (filter & {el.current_element for el in p})
+
+@choice@
+expression E, E1;
+position kok, vok;
+@@
+
+(
+  if (...) {
+...
+E = \(kmalloc@kok\|kzalloc@kok\|krealloc@kok\|kcalloc@kok\|
+  kmalloc_node@kok\|kzalloc_node@kok\|kmalloc_array@kok\|
+  kmalloc_array_node@kok\|kcalloc_node@kok\)(...)
+...
+  } else {
+...
+E = \(vmalloc@vok\|vzalloc@vok\|vmalloc_user@vok\|vmalloc_node@vok\|
+  vzalloc_node@vok\|vmalloc_exec@vok\|vmalloc_32@vok\|
+  vmalloc_32_user@vok\|__vmalloc@vok\|__vmalloc_node_range@vok\|
+  __vmalloc_node@vok\)(...)
+...
+  }
+|
+  E = \(kmalloc\|kzalloc\|krealloc\|kcalloc\|kmalloc_node\|kzalloc_node\|
+kmalloc_array\|kmalloc_array_node\|kcalloc_node\)(...)
+  ... when != E = E1
+  when any
+  if (\(!E\|E == NULL\)) {
+...
+E = \(vmalloc@vok\|vzalloc@vok\|vmalloc_user@vok\|vmalloc_node@vok\|
+  vzalloc_node@vok\|vmalloc_exec@vok\|vmalloc_32@vok\|
+  vmalloc_32_user@vok\|__vmalloc@vok\|__vmalloc_node_range@vok\|
+  __vmalloc_node@vok\)(...)
+...
+  }
+)
+
+@opportunity depends on !patch@
+expression E, E1, size;
+position p : script:python() { relevant(p) };
+@@
+
+(
+* if (\(size <= E1\|size < E1\|size = E1\|size > E1\) || ...)@p {
+...
+E = \(kmalloc\|kzalloc\|krealloc\|kcalloc\|kmalloc_node\|kzalloc_node\|
+  kmalloc_array\|kmalloc_array_node\|kcalloc_node\)(..., size, ...)
+...
+  } else {
+...
+E = \(vmalloc\|vzalloc\|vmalloc_user\|vmalloc_node\|vzalloc_node\|
+  vmalloc_exec\|vmalloc_32\|vmalloc_32_user\|__vmalloc\|
+  __vmalloc_node_range\|__vmalloc_node\)(..., size, ...)
+...
+  }
+|
+  E = \(kmalloc\|kzalloc\|krealloc\|kcalloc\|kmalloc_node\|kzalloc_node\|
+kmalloc_array\|kmalloc_array_node\|kcalloc_node\)(..., size, ...)
+  ... when != E = E1
+  when != size = E1
+  when any
+* if (\(!E\|E == NULL\))@p {
+...
+E = \(vmalloc\|vzalloc\|vmalloc_user\|vmalloc_node\|vzalloc_node\|
+  vmalloc_exec\|vmalloc_32\|vmalloc_32_user\|__vmalloc\|
+  __vmalloc_node_range\|__vmalloc_node\)(..., size, ...)
+...
+  }
+)
+
+@vfree depends on !patch@
+expression E;
+position k != choice.kok;
+position p;
+@@
+
+* E = \(kmalloc@k\|kzalloc@k\|krealloc@k\|kcalloc@k\|kmalloc_node@k\|
+kzalloc_node@k\|kmalloc_array@k\|kmalloc_array_node@k\|
+kcalloc_node@k\)(...)
+  ... when != if (...) { ... E = 
\(vmalloc\|vzalloc\|vmalloc_user\|vmalloc_node\|vzalloc_node\|vmalloc_exec\|vmalloc_32\|vmalloc_32_user\|__vmalloc\|__vmalloc_node_range\|__vmalloc_node\)(...);
 ... }
+  when != is_vmalloc_addr(E)
+  when any
+* \(vfree\|vfree_atomic\|kvfree\)(E)@p
+
+@pvfree depends on patch exists@
+expression E;
+position k != choice.kok;
+@@
+
+  E = \(kmalloc@k\|kzalloc@k\|krealloc@k\|kcalloc@k\|kmalloc_node@k\|
+kzalloc_node@k\|kmalloc_array@k\|kmalloc_array_node@k\|
+kcalloc_node@k\)(...)
+  ... when != if (...) { ... E = 
\(vmalloc\|vzalloc\|vmalloc_user\|vmalloc_node\|vzalloc_node\|vmalloc_exec\|vmalloc_32\|vmalloc_32_user\|__vmalloc\|__vmalloc_node_range\|__vmalloc_node\)(...);
 ... }
+  when != is_vmalloc_addr(E)
+  when any
+- \(vfree\|vfree_atomic\|kvfree\)(E)
++ kfree(E)
+
+@kfree depends on !patch@
+expression E;
+position v != choice.vok;
+position p;
+@@
+
+* E = \(vmalloc@v\|vzalloc@v\|vmalloc_user@v\|vmalloc_node@v\|vzalloc_node@v\|
+vmalloc_exec@v\|vmalloc_32@v\|vmalloc_32_user@v\|__vmalloc@v\|
+__vmalloc_node_range@v\|__vmalloc_node@v\)(...)
+  ... when != !is_vmalloc_addr(E)
+  when any
+* \(kfree\|kzfree\|kvfree\)(E)
+
+@pkfree depends on patch exists@
+expression E;
+position v != choice.vok;
+@@
+
+  E = 

Re: [Cocci] coccinelle issues

2020-06-14 Thread Mike Galbraith
On Sun, 2020-06-14 at 14:59 +0200, Julia Lawall wrote:
> 
> On Sun, 14 Jun 2020, Mike Galbraith wrote:
> 
> > On Sun, 2020-06-14 at 10:43 +0200, Julia Lawall wrote:
> > >
> > > What is your Linux distribution?
> >
> > openSUSE Leap-15.1
> 
> Our CI already has an entry for openSUSE Leap.  We will look into it, but
> if you have any further information about the problem, please let us know.

Executive Summary:

warning: Can't find macro file: 
/usr/local/coccinelle/bin/../lib/coccinelle/standard.h
warning: Can't find default iso file: 
/usr/local/coccinelle/bin/../lib/coccinelle/standard.iso

I find those under lib64, apply symlink bandaid, proggy acks.

WRT the HEAD make install booboo..

git@homer:~/coccinelle> sudo make install
mkdir -p /usr/local/coccinelle/bin /usr/local/coccinelle/lib64/coccinelle
mkdir -p /usr/local/coccinelle/lib64/coccinelle/ocaml
if test -f bundles/pyml/dllpyml_stubs.so; then \
/usr/bin/install -c -m 755 bundles/pyml/dllpyml_stubs.so \
/usr/local/coccinelle/lib64/coccinelle; \
fi
if test -f bundles/pcre/dllpcre_stubs.so; then \
/usr/bin/install -c -m 755 bundles/pcre/dllpcre_stubs.so \
/usr/local/coccinelle/lib64/coccinelle; \
fi
/usr/bin/install -c -m 755 spatch.opt /usr/local/coccinelle/bin/spatch
/usr/bin/install -c -m 644 standard.h /usr/local/coccinelle/lib64/coccinelle
/usr/bin/install -c -m 644 standard.iso /usr/local/coccinelle/lib64/coccinelle
/usr/bin/install -c -m 644 ocaml/*.cmi 
/usr/local/coccinelle/lib64/coccinelle/ocaml/
if test -f ocaml/coccilib.cmx; then \
/usr/bin/install -c -m 644 ocaml/*.cmx 
/usr/local/coccinelle/lib64/coccinelle/ocaml/; \
fi
/usr/bin/install -c -m 755 tools/spgen/source/spgen.opt \
 /usr/local/coccinelle/bin/spgen
/usr/bin/install -c -m 644 python/coccilib/*.py \
/usr/local/coccinelle/lib64/coccinelle/python/coccilib
/usr/bin/install: target 
'/usr/local/coccinelle/lib64/coccinelle/python/coccilib' is not a directory
make: *** [Makefile:332: install-python] Error 1

mkdir -p bandaid worked.
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] coccinelle issues

2020-06-14 Thread Markus Elfring
> > Note2: https://github.com/coccinelle/coccinelle/blob/master/install.txt
> > says that 'spatch' is a script, but it seems to be a binary executable file.
>
> Actually, it is a script, and the fact that you say it is a binary may be
> the reason for your python problem.  Normally there is a script
> (scripts/spatch) that make install puts in place that refers back to where
> your Coccinelle is installed.

I suggest to take another look at the corresponding software development 
history.
The build infrastructures were occasionally updated in the meantime.

elfring@Sonne:~> SP=$(which spatch) && file $SP && du -h $SP
/usr/local/bin/spatch: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), 
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 
3.2.0, with debug_info, not stripped
16M /usr/local/bin/spatch

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


Re: [Cocci] coccinelle issues

2020-06-14 Thread Julia Lawall



On Sun, 14 Jun 2020, Randy Dunlap wrote:

> On 6/14/20 12:39 AM, Julia Lawall wrote:
> >
> >
> > On Sat, 13 Jun 2020, Randy Dunlap wrote:
> >
> >> Hi,
> >>
> >> OK, I've not used Coccinelle and now I am trying to use it.
> >> It seems that I am having a few issues.
> >> The primary one is when I run spatch (via 'make coccicheck' in
> >> the kernel source tree), it tells me:
> >>
> >> Python error: No module named coccilib.elems
> >>
> >> I do see "elems.py" in /usr/local/lib64/coccinelle/python/coccilib.
> >>
> >> I am using coccinelle-master downloaded from github on
> >> Friday June 12, 2020.
> >>
> >>
> >> I have also made the following notes while building/installing it.
> >>
> >>
> >> Note1: The latest coccinelle tarball is not actually available
> >> at the coccinelle home page although the kernel documentation says it is.
> >
> > Yes, I'm aware of this problem.  We're not able to update the home page at
> > the moment.  This problem is being worked on.
> >
> >>
> >> Note2: https://github.com/coccinelle/coccinelle/blob/master/install.txt
> >> says that 'spatch' is a script, but it seems to be a binary executable
> >> file.
> >
> > Actually, it is a script, and the fact that you say it is a binary may be
> > the reason for your python problem.  Normally there is a script
> > (scripts/spatch) that make install puts in place that refers back to where
> > your Coccinelle is installed.
>
> Yes, I saw scripts/spatch, but that script is not what is installed in
> /usr/local/bin.
> (see more below)

OK.  I don't install Coccinelle in the normal way.  I will check on what
is intended.

>
> >> Note3: https://github.com/coccinelle/coccinelle/blob/master/install.txt
> >> probably should say to use 'sudo make install' instead of just
> >> 'make install', just like 'coccinelle.rst' file in the kernel tree says.
> >
> > OK.  A lot of documentation for a lot of projects seems to omit the sudo,
> > but I have indeed never understood why.
> >
> > Maybe try again with make distclean, ./autogen, ./configure, sudo make
> > install?
>
> OK, I did all of those.
>
> Is this expected?
>
> $ ./autogen
> cat: VERSION: No such file or directory
> cat: VERSION: No such file or directory
> cat: VERSION: No such file or directory
> cat: VERSION: No such file or directory
> cat: VERSION: No such file or directory
> cat: VERSION: No such file or directory
> cat: VERSION: No such file or directory
> cat: VERSION: No such file or directory
> cat: VERSION: No such file or directory
> cat: VERSION: No such file or directory
> cat: VERSION: No such file or directory

Sorry.  This problem has no impact, but I just pushed a commit to github
to solve it.

julia

>
>
> spatch is installed in /usr/local/bin/spatch:
>
> $ ll /usr/local/bin/spatch
> -rwxr-xr-x 1 root root 15547736 Jun 14 07:32 /usr/local/bin/spatch*
>
> $ file /usr/local/bin/spatch
> /usr/local/bin/spatch: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), 
> dynamically linked, interpreter /lib64/l, 
> BuildID[sha1]=2b658c12a1a49deae24010b71d22d262988ce041, for GNU/Linux 3.2.0, 
> with debug_info, not stripped
>
>
> I still get this runtime error:
>
> Python error: No module named coccilib.elems
>
> --
> ~Randy
>
>
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] coccinelle: api: add kvfree script

2020-06-14 Thread Markus Elfring
> … Looks like it's impossible to break "when" lines.

Thus I became also curious on clarification for further software
development possibilities around the safer application of code exclusion
specifications by the means of the semantic patch language.

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


Re: [Cocci] coccinelle issues

2020-06-14 Thread Randy Dunlap
On 6/14/20 12:39 AM, Julia Lawall wrote:
> 
> 
> On Sat, 13 Jun 2020, Randy Dunlap wrote:
> 
>> Hi,
>>
>> OK, I've not used Coccinelle and now I am trying to use it.
>> It seems that I am having a few issues.
>> The primary one is when I run spatch (via 'make coccicheck' in
>> the kernel source tree), it tells me:
>>
>> Python error: No module named coccilib.elems
>>
>> I do see "elems.py" in /usr/local/lib64/coccinelle/python/coccilib.
>>
>> I am using coccinelle-master downloaded from github on
>> Friday June 12, 2020.
>>
>>
>> I have also made the following notes while building/installing it.
>>
>>
>> Note1: The latest coccinelle tarball is not actually available
>> at the coccinelle home page although the kernel documentation says it is.
> 
> Yes, I'm aware of this problem.  We're not able to update the home page at
> the moment.  This problem is being worked on.
> 
>>
>> Note2: https://github.com/coccinelle/coccinelle/blob/master/install.txt
>> says that 'spatch' is a script, but it seems to be a binary executable
>> file.
> 
> Actually, it is a script, and the fact that you say it is a binary may be
> the reason for your python problem.  Normally there is a script
> (scripts/spatch) that make install puts in place that refers back to where
> your Coccinelle is installed.

Yes, I saw scripts/spatch, but that script is not what is installed in
/usr/local/bin.
(see more below)

>> Note3: https://github.com/coccinelle/coccinelle/blob/master/install.txt
>> probably should say to use 'sudo make install' instead of just
>> 'make install', just like 'coccinelle.rst' file in the kernel tree says.
> 
> OK.  A lot of documentation for a lot of projects seems to omit the sudo,
> but I have indeed never understood why.
> 
> Maybe try again with make distclean, ./autogen, ./configure, sudo make
> install?

OK, I did all of those.

Is this expected?

$ ./autogen
cat: VERSION: No such file or directory
cat: VERSION: No such file or directory
cat: VERSION: No such file or directory
cat: VERSION: No such file or directory
cat: VERSION: No such file or directory
cat: VERSION: No such file or directory
cat: VERSION: No such file or directory
cat: VERSION: No such file or directory
cat: VERSION: No such file or directory
cat: VERSION: No such file or directory
cat: VERSION: No such file or directory


spatch is installed in /usr/local/bin/spatch:

$ ll /usr/local/bin/spatch
-rwxr-xr-x 1 root root 15547736 Jun 14 07:32 /usr/local/bin/spatch*

$ file /usr/local/bin/spatch
/usr/local/bin/spatch: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), 
dynamically linked, interpreter /lib64/l, 
BuildID[sha1]=2b658c12a1a49deae24010b71d22d262988ce041, for GNU/Linux 3.2.0, 
with debug_info, not stripped


I still get this runtime error:

Python error: No module named coccilib.elems

-- 
~Randy

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


Re: [Cocci] coccinelle issues

2020-06-14 Thread Julia Lawall



On Sun, 14 Jun 2020, Mike Galbraith wrote:

> On Sun, 2020-06-14 at 10:43 +0200, Julia Lawall wrote:
> >
> > What is your Linux distribution?
>
> openSUSE Leap-15.1

Our CI already has an entry for openSUSE Leap.  We will look into it, but
if you have any further information about the problem, please let us know.

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


Re: [Cocci] [PATCH] coccinelle: api: add kvfree script

2020-06-14 Thread Denis Efremov



On 6/14/20 12:17 PM, Julia Lawall wrote:
> 
> 
> On Sun, 14 Jun 2020, Denis Efremov wrote:
> 
>>
>>
>> On 6/5/20 11:51 PM, Julia Lawall wrote:
>>> Also, there is no need to exceed 80 characters here.  You can put a
>>> newline in the middle of a \( ... \)
>>
>> It's required. Looks like it's impossible to break "when" lines.
> 
> That's true. Sorry for the noise.
> 

Anyway, I will send v2 with other lines fixed.

Thanks,
Denis
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] [PATCH] coccinelle: api: add kvfree script

2020-06-14 Thread Julia Lawall



On Sun, 14 Jun 2020, Denis Efremov wrote:

>
>
> On 6/5/20 11:51 PM, Julia Lawall wrote:
> > Also, there is no need to exceed 80 characters here.  You can put a
> > newline in the middle of a \( ... \)
>
> It's required. Looks like it's impossible to break "when" lines.

That's true. Sorry for the noise.

julia

>
> ... when != if (...) { ... E = 
> \(vmalloc\|vzalloc\|vmalloc_user\|vmalloc_node\|vzalloc_node\|vmalloc_exec\|vmalloc_32\|vmalloc_32_user\|__vmalloc\|__vmalloc_node_range\|__vmalloc_node\|kvmalloc\|kvzalloc\|kvcalloc\|kvzalloc_node\|kvmalloc_node\|kvmalloc_array\)(...);
>  ... }
>
> Thanks,
> Denis
>
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] [PATCH] coccinelle: api: add kvfree script

2020-06-14 Thread Denis Efremov



On 6/5/20 11:51 PM, Julia Lawall wrote:
> Also, there is no need to exceed 80 characters here.  You can put a
> newline in the middle of a \( ... \)

It's required. Looks like it's impossible to break "when" lines.

... when != if (...) { ... E = 
\(vmalloc\|vzalloc\|vmalloc_user\|vmalloc_node\|vzalloc_node\|vmalloc_exec\|vmalloc_32\|vmalloc_32_user\|__vmalloc\|__vmalloc_node_range\|__vmalloc_node\|kvmalloc\|kvzalloc\|kvcalloc\|kvzalloc_node\|kvmalloc_node\|kvmalloc_array\)(...);
 ... }

Thanks,
Denis
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] coccinelle issues

2020-06-14 Thread Julia Lawall



On Sun, 14 Jun 2020, Mike Galbraith wrote:

> On Sun, 2020-06-14 at 10:43 +0200, Julia Lawall wrote:
> >
> > What is your Linux distribution?
>
> openSUSE Leap-15.1

OK, this problem has occurred before.  I think we should add openSUSE to
our CI.

Thanks for the report.

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


Re: [Cocci] coccinelle issues

2020-06-14 Thread Julia Lawall



On Sun, 14 Jun 2020, Mike Galbraith wrote:

> On Sun, 2020-06-14 at 10:00 +0200, Mike Galbraith wrote:
> > On Sun, 2020-06-14 at 09:57 +0200, Mike Galbraith wrote:
> > > On Sun, 2020-06-14 at 09:42 +0200, Julia Lawall wrote:
> > > >
> > > > On Sun, 14 Jun 2020, Mike Galbraith wrote:
> > > >
> > > >
> > > > > I didn't download, rather pulled/built.  I didn't have the same issue
> > > > > you did, but make coccicheck was a bust here until I backed down to
> > > > > version 1.0.6.  Neither HEAD, 1.0.8 or 1.0.7 ran, and following its
> > > > > MODE=blah suggestion helped not at all.
> > > >
> > > > Did you get a segmentation fault?
> > >
> > > Nope.  Turned out to be a dinky install gotcha.  Creating a symlink..
> > >
> > > lrwxrwxrwx 1 root root 27 Jun 14 09:40 /usr/local/coccinelle/lib -> 
> > > /usr/local/coccinelle/lib64
> > >
> > > ..seems to have fixed 1.0.8 all up.  The very first time I installed, I
> > > had to create one directory (forget which) by hand as well.
> >
> > Oh well, not all fixed up, but it does run.
> >
> > ./fs/xfs/xfs_rmap_item.c:56:5-24: atomic_dec_and_test variation before 
> > object free at line 57.
> > ./kernel/nsproxy.c:253:11-30: atomic_dec_and_test variation before object 
> > free at line 254.
> > ./net/unix/scm.c:80:6-30: atomic_dec_and_test variation before object free 
> > at line 81.
> > coccicheck failed
> > make: *** [Makefile:1822: coccicheck] Error 2
>
> And doing the DEBUG_FILE="all.err" thing says...
>
> /usr/local/bin/spatch -D report --no-show-diff --very-quiet --cocci-file 
> ./scripts/coccinelle/api/alloc/alloc_cast.cocci --no-includes 
> --include-headers --dir . -I ./arch/x86/include -I 
> ./arch/x86/include/generated -I ./include -I ./arc>
> 12712 files match
> /usr/local/bin/spatch -D report --no-show-diff --very-quiet --cocci-file 
> ./scripts/coccinelle/api/alloc/pool_zalloc-simple.cocci --no-includes 
> --include-headers --dir . -I ./arch/x86/include -I 
> ./arch/x86/include/generated -I ./include >
> 42 files match
> /usr/local/bin/spatch -D report --no-show-diff --very-quiet --cocci-file 
> ./scripts/coccinelle/api/alloc/zalloc-simple.cocci --no-includes 
> --include-headers --dir . -I ./arch/x86/include -I 
> ./arch/x86/include/generated -I ./include -I ./>
> 2003 files match
> /usr/local/bin/spatch -D report --no-show-diff --very-quiet --cocci-file 
> ./scripts/coccinelle/api/atomic_as_refcounter.cocci --include-headers 
> --very-quiet --dir . -I ./arch/x86/include -I ./arch/x86/include/generated -I 
> ./include -I ./>
> 502 files match
> /usr/local/bin/spatch -D report --no-show-diff --very-quiet --cocci-file 
> ./scripts/coccinelle/api/check_bq27xxx_data.cocci --dir . -I 
> ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I 
> ./arch/x86/include/uapi -I ./arch/x>
> File "/tmp/ocaml_cocci_c0ec37.ml", line 1:
> Error: The files 
> /usr/local/coccinelle/bin/../lib/coccinelle/ocaml/coccilib.cmi
>and /usr/local/coccinelle/bin/../lib/coccinelle/ocaml/ast_c.cmi
>make inconsistent assumptions over interface Ast_c
> Fatal error: exception 
> Coccinelle_modules.Yes_prepare_ocamlcocci.CompileFailure("/tmp/ocaml_cocci_c0ec37.ml")
> ~

Ah, that's not what I expected.  It looks like your lib problem coming
back again.

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


Re: [Cocci] coccinelle issues

2020-06-14 Thread Julia Lawall



On Sun, 14 Jun 2020, Mike Galbraith wrote:

> On Sun, 2020-06-14 at 09:57 +0200, Mike Galbraith wrote:
> > On Sun, 2020-06-14 at 09:42 +0200, Julia Lawall wrote:
> > >
> > > On Sun, 14 Jun 2020, Mike Galbraith wrote:
> > >
> > >
> > > > I didn't download, rather pulled/built.  I didn't have the same issue
> > > > you did, but make coccicheck was a bust here until I backed down to
> > > > version 1.0.6.  Neither HEAD, 1.0.8 or 1.0.7 ran, and following its
> > > > MODE=blah suggestion helped not at all.
> > >
> > > Did you get a segmentation fault?
> >
> > Nope.  Turned out to be a dinky install gotcha.  Creating a symlink..
> >
> > lrwxrwxrwx 1 root root 27 Jun 14 09:40 /usr/local/coccinelle/lib -> 
> > /usr/local/coccinelle/lib64
> >
> > ..seems to have fixed 1.0.8 all up.  The very first time I installed, I
> > had to create one directory (forget which) by hand as well.
>
> Oh well, not all fixed up, but it does run.
>
> ./fs/xfs/xfs_rmap_item.c:56:5-24: atomic_dec_and_test variation before object 
> free at line 57.
> ./kernel/nsproxy.c:253:11-30: atomic_dec_and_test variation before object 
> free at line 254.
> ./net/unix/scm.c:80:6-30: atomic_dec_and_test variation before object free at 
> line 81.
> coccicheck failed
> make: *** [Makefile:1822: coccicheck] Error 2

Yeah, that's the segfault  There is one rule that doesn't work well
with make coccicheck.  A patch has been proposed, but I don't know whether
it is upstream.

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


Re: [Cocci] coccinelle issues

2020-06-14 Thread Mike Galbraith
On Sun, 2020-06-14 at 10:43 +0200, Julia Lawall wrote:
> 
> What is your Linux distribution?

openSUSE Leap-15.1
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] coccinelle issues

2020-06-14 Thread Julia Lawall



On Sun, 14 Jun 2020, Mike Galbraith wrote:

> On Sun, 2020-06-14 at 09:42 +0200, Julia Lawall wrote:
> >
> > On Sun, 14 Jun 2020, Mike Galbraith wrote:
> >
> >
> > > I didn't download, rather pulled/built.  I didn't have the same issue
> > > you did, but make coccicheck was a bust here until I backed down to
> > > version 1.0.6.  Neither HEAD, 1.0.8 or 1.0.7 ran, and following its
> > > MODE=blah suggestion helped not at all.
> >
> > Did you get a segmentation fault?
>
> Nope.  Turned out to be a dinky install gotcha.  Creating a symlink..
>
> lrwxrwxrwx 1 root root 27 Jun 14 09:40 /usr/local/coccinelle/lib -> 
> /usr/local/coccinelle/lib64
>
> ..seems to have fixed 1.0.8 all up.  The very first time I installed, I
> had to create one directory (forget which) by hand as well.

What is your Linux distribution?

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


Re: [Cocci] coccinelle issues

2020-06-14 Thread Mike Galbraith
On Sun, 2020-06-14 at 10:00 +0200, Mike Galbraith wrote:
> On Sun, 2020-06-14 at 09:57 +0200, Mike Galbraith wrote:
> > On Sun, 2020-06-14 at 09:42 +0200, Julia Lawall wrote:
> > > 
> > > On Sun, 14 Jun 2020, Mike Galbraith wrote:
> > > 
> > > 
> > > > I didn't download, rather pulled/built.  I didn't have the same issue
> > > > you did, but make coccicheck was a bust here until I backed down to
> > > > version 1.0.6.  Neither HEAD, 1.0.8 or 1.0.7 ran, and following its
> > > > MODE=blah suggestion helped not at all.
> > > 
> > > Did you get a segmentation fault?
> > 
> > Nope.  Turned out to be a dinky install gotcha.  Creating a symlink..
> > 
> > lrwxrwxrwx 1 root root 27 Jun 14 09:40 /usr/local/coccinelle/lib -> 
> > /usr/local/coccinelle/lib64
> > 
> > ..seems to have fixed 1.0.8 all up.  The very first time I installed, I
> > had to create one directory (forget which) by hand as well.
> 
> Oh well, not all fixed up, but it does run.
> 
> ./fs/xfs/xfs_rmap_item.c:56:5-24: atomic_dec_and_test variation before object 
> free at line 57.
> ./kernel/nsproxy.c:253:11-30: atomic_dec_and_test variation before object 
> free at line 254.
> ./net/unix/scm.c:80:6-30: atomic_dec_and_test variation before object free at 
> line 81.
> coccicheck failed
> make: *** [Makefile:1822: coccicheck] Error 2

And doing the DEBUG_FILE="all.err" thing says...

/usr/local/bin/spatch -D report --no-show-diff --very-quiet --cocci-file 
./scripts/coccinelle/api/alloc/alloc_cast.cocci --no-includes --include-headers 
--dir . -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I 
./arc>
12712 files match
/usr/local/bin/spatch -D report --no-show-diff --very-quiet --cocci-file 
./scripts/coccinelle/api/alloc/pool_zalloc-simple.cocci --no-includes 
--include-headers --dir . -I ./arch/x86/include -I ./arch/x86/include/generated 
-I ./include >
42 files match
/usr/local/bin/spatch -D report --no-show-diff --very-quiet --cocci-file 
./scripts/coccinelle/api/alloc/zalloc-simple.cocci --no-includes 
--include-headers --dir . -I ./arch/x86/include -I ./arch/x86/include/generated 
-I ./include -I ./>
2003 files match
/usr/local/bin/spatch -D report --no-show-diff --very-quiet --cocci-file 
./scripts/coccinelle/api/atomic_as_refcounter.cocci --include-headers 
--very-quiet --dir . -I ./arch/x86/include -I ./arch/x86/include/generated -I 
./include -I ./>
502 files match
/usr/local/bin/spatch -D report --no-show-diff --very-quiet --cocci-file 
./scripts/coccinelle/api/check_bq27xxx_data.cocci --dir . -I ./arch/x86/include 
-I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi -I 
./arch/x>
File "/tmp/ocaml_cocci_c0ec37.ml", line 1:
Error: The files /usr/local/coccinelle/bin/../lib/coccinelle/ocaml/coccilib.cmi
   and /usr/local/coccinelle/bin/../lib/coccinelle/ocaml/ast_c.cmi
   make inconsistent assumptions over interface Ast_c
Fatal error: exception 
Coccinelle_modules.Yes_prepare_ocamlcocci.CompileFailure("/tmp/ocaml_cocci_c0ec37.ml")
~   

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


Re: [Cocci] coccinelle issues

2020-06-14 Thread Mike Galbraith


Aha, trying a fresh build/install of 1.0.7 reproduced Randy's problem..

/usr/local/bin/spatch -D report --no-show-diff --very-quiet --cocci-file 
./scripts/coccinelle/api/alloc/alloc_cast.cocci --no-includes --include-headers 
--dir . -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I 
./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi -I ./include/uapi 
-I ./include/generated/uapi --include ./include/linux/kconfig.h --jobs 8 
--chunksize 1
Python error: No module named coccilib.elems

..and creating /usr/local/coccinelle/lib -> /usr/local/coccinelle/lib64
fixed it up for me.

Note: I configured --prefix=/usr/local/coccinelle to keep things
contained, and added a couple symlinks in /usr/local/bin for the
binaries.

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


Re: [Cocci] coccinelle issues

2020-06-14 Thread Mike Galbraith
On Sun, 2020-06-14 at 09:57 +0200, Mike Galbraith wrote:
> On Sun, 2020-06-14 at 09:42 +0200, Julia Lawall wrote:
> > 
> > On Sun, 14 Jun 2020, Mike Galbraith wrote:
> > 
> > 
> > > I didn't download, rather pulled/built.  I didn't have the same issue
> > > you did, but make coccicheck was a bust here until I backed down to
> > > version 1.0.6.  Neither HEAD, 1.0.8 or 1.0.7 ran, and following its
> > > MODE=blah suggestion helped not at all.
> > 
> > Did you get a segmentation fault?
> 
> Nope.  Turned out to be a dinky install gotcha.  Creating a symlink..
> 
> lrwxrwxrwx 1 root root 27 Jun 14 09:40 /usr/local/coccinelle/lib -> 
> /usr/local/coccinelle/lib64
> 
> ..seems to have fixed 1.0.8 all up.  The very first time I installed, I
> had to create one directory (forget which) by hand as well.

Oh well, not all fixed up, but it does run.

./fs/xfs/xfs_rmap_item.c:56:5-24: atomic_dec_and_test variation before object 
free at line 57.
./kernel/nsproxy.c:253:11-30: atomic_dec_and_test variation before object free 
at line 254.
./net/unix/scm.c:80:6-30: atomic_dec_and_test variation before object free at 
line 81.
coccicheck failed
make: *** [Makefile:1822: coccicheck] Error 2
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] coccinelle issues

2020-06-14 Thread Mike Galbraith
On Sun, 2020-06-14 at 09:42 +0200, Julia Lawall wrote:
> 
> On Sun, 14 Jun 2020, Mike Galbraith wrote:
> 
> 
> > I didn't download, rather pulled/built.  I didn't have the same issue
> > you did, but make coccicheck was a bust here until I backed down to
> > version 1.0.6.  Neither HEAD, 1.0.8 or 1.0.7 ran, and following its
> > MODE=blah suggestion helped not at all.
> 
> Did you get a segmentation fault?

Nope.  Turned out to be a dinky install gotcha.  Creating a symlink..

lrwxrwxrwx 1 root root 27 Jun 14 09:40 /usr/local/coccinelle/lib -> 
/usr/local/coccinelle/lib64

..seems to have fixed 1.0.8 all up.  The very first time I installed, I
had to create one directory (forget which) by hand as well.

-Mike
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] coccinelle issues

2020-06-14 Thread Julia Lawall



On Sun, 14 Jun 2020, Mike Galbraith wrote:

> On Sat, 2020-06-13 at 21:07 -0700, Randy Dunlap wrote:
> > Hi,
> >
> > OK, I've not used Coccinelle and now I am trying to use it.
>
> I've never used it either, or intend to really, but seeing that it
> lives on github and more importantly, it's raining outside
>
> > It seems that I am having a few issues.
> > The primary one is when I run spatch (via 'make coccicheck' in
> > the kernel source tree), it tells me:
> >
> > Python error: No module named coccilib.elems
> >
> > I do see "elems.py" in /usr/local/lib64/coccinelle/python/coccilib.
> >
> > I am using coccinelle-master downloaded from github on
> > Friday June 12, 2020.
>
> I didn't download, rather pulled/built.  I didn't have the same issue
> you did, but make coccicheck was a bust here until I backed down to
> version 1.0.6.  Neither HEAD, 1.0.8 or 1.0.7 ran, and following its
> MODE=blah suggestion helped not at all.

Did you get a segmentation fault?  The MODE=blah seems to be more often
than not leading to a seg fault now.  It seems that the library that
manages parallelism seg faults whenever the thread that it is running
incurs an error at the ocaml level.

julia


>
> No idea if 1.0.6 will work for you, but it did for me, and doesn't take
> long at all to build once you get the ocaml goop it wants installed.
>
> Hohum, now to whack all that, and find something else to do ;-)
>
>   -Mike
> ___
> Cocci mailing list
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] coccinelle issues

2020-06-14 Thread Julia Lawall



On Sat, 13 Jun 2020, Randy Dunlap wrote:

> Hi,
>
> OK, I've not used Coccinelle and now I am trying to use it.
> It seems that I am having a few issues.
> The primary one is when I run spatch (via 'make coccicheck' in
> the kernel source tree), it tells me:
>
> Python error: No module named coccilib.elems
>
> I do see "elems.py" in /usr/local/lib64/coccinelle/python/coccilib.
>
> I am using coccinelle-master downloaded from github on
> Friday June 12, 2020.
>
>
> I have also made the following notes while building/installing it.
>
>
> Note1: The latest coccinelle tarball is not actually available
> at the coccinelle home page although the kernel documentation says it is.

Yes, I'm aware of this problem.  We're not able to update the home page at
the moment.  This problem is being worked on.

>
> Note2: https://github.com/coccinelle/coccinelle/blob/master/install.txt
> says that 'spatch' is a script, but it seems to be a binary executable
> file.

Actually, it is a script, and the fact that you say it is a binary may be
the reason for your python problem.  Normally there is a script
(scripts/spatch) that make install puts in place that refers back to where
your Coccinelle is installed.

> Note3: https://github.com/coccinelle/coccinelle/blob/master/install.txt
> probably should say to use 'sudo make install' instead of just
> 'make install', just like 'coccinelle.rst' file in the kernel tree says.

OK.  A lot of documentation for a lot of projects seems to omit the sudo,
but I have indeed never understood why.

Maybe try again with make distclean, ./autogen, ./configure, sudo make
install?

julia

>
> thanks for any help that you can provide.
>
> --
> ~Randy
>
> ___
> Cocci mailing list
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


[Cocci] coccinelle issues

2020-06-14 Thread Randy Dunlap
Hi,

OK, I've not used Coccinelle and now I am trying to use it.
It seems that I am having a few issues.
The primary one is when I run spatch (via 'make coccicheck' in
the kernel source tree), it tells me:

Python error: No module named coccilib.elems

I do see "elems.py" in /usr/local/lib64/coccinelle/python/coccilib.

I am using coccinelle-master downloaded from github on
Friday June 12, 2020.


I have also made the following notes while building/installing it.


Note1: The latest coccinelle tarball is not actually available
at the coccinelle home page although the kernel documentation says it is.

Note2: https://github.com/coccinelle/coccinelle/blob/master/install.txt
says that 'spatch' is a script, but it seems to be a binary executable
file.

Note3: https://github.com/coccinelle/coccinelle/blob/master/install.txt
probably should say to use 'sudo make install' instead of just
'make install', just like 'coccinelle.rst' file in the kernel tree says.


thanks for any help that you can provide.

-- 
~Randy

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


Re: [Cocci] coccinelle issues

2020-06-14 Thread Mike Galbraith
On Sat, 2020-06-13 at 21:07 -0700, Randy Dunlap wrote:
> Hi,
> 
> OK, I've not used Coccinelle and now I am trying to use it.

I've never used it either, or intend to really, but seeing that it
lives on github and more importantly, it's raining outside

> It seems that I am having a few issues.
> The primary one is when I run spatch (via 'make coccicheck' in
> the kernel source tree), it tells me:
> 
> Python error: No module named coccilib.elems
> 
> I do see "elems.py" in /usr/local/lib64/coccinelle/python/coccilib.
> 
> I am using coccinelle-master downloaded from github on
> Friday June 12, 2020.

I didn't download, rather pulled/built.  I didn't have the same issue
you did, but make coccicheck was a bust here until I backed down to
version 1.0.6.  Neither HEAD, 1.0.8 or 1.0.7 ran, and following its
MODE=blah suggestion helped not at all.

No idea if 1.0.6 will work for you, but it did for me, and doesn't take
long at all to build once you get the ocaml goop it wants installed.

Hohum, now to whack all that, and find something else to do ;-)

-Mike
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci