Bug 1376943

Summary: Ocaml scripting not supported in spatch on F24
Product: [Fedora] Fedora Reporter: Mat Martineau <martineau>
Component: coccinelleAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 24CC: rjones
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: coccinelle-1.0.5-2.fc25 coccinelle-1.0.5-2.fc24 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-27 00:37:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mat Martineau 2016-09-16 22:01:56 UTC
Description of problem:

Semantic patches using "@script:ocaml@" result in an execution error.

Version-Release number of selected component (if applicable):

coccinelle-1.0.4-4.fc24

How reproducible:

Always reproducible

Steps to Reproduce:
1. Get the 'badzero.cocci' semantic patch file (https://github.com/torvalds/linux/blob/master/scripts/coccinelle/null/badzero.cocci), or any other valid .cocci file that uses ocaml scripting (contains "@script:ocaml@").
2. Create a 0-length file called 'empty.c' in the same directory
3. Run '/usr/bin/spatch -D report --no-show-diff --very-quiet --cocci-file badzero.cocci empty.c'

Actual results:

Exit code '2', prints "Fatal error: exception Failure("OCaml scripting is unsupported. Compile spatch with OCaml version >= 3.11")"

Expected results:

Exit code '0', no output

Additional info:

It looks like ocamlfind was missing on the build system, despite ocaml-findlib-devel being listed as a build requirement in the .spec file. https://kojipkgs.fedoraproject.org//packages/coccinelle/1.0.4/4.fc24/data/logs/x86_64/build.log says "configure: ocaml scripting is disabled because it depends on ocamlfind". The build log also shows ocaml 4.02.3 was used to build, which is >= 3.11. Looks like the i686 and ARM build had a similar problem.

The coccinelle 1.0.1 fc23 and 1.0.5 fc25 builds do enable ocaml scripting.

Comment 1 Richard W.M. Jones 2016-09-19 09:36:19 UTC
ocaml-findlib was installed in the buildroot of the latest build:

https://kojipkgs.fedoraproject.org//packages/coccinelle/1.0.5/1.fc25/data/logs/x86_64/root.log

and scripting was enabled in that build too:

https://kojipkgs.fedoraproject.org//packages/coccinelle/1.0.5/1.fc25/data/logs/x86_64/build.log

For the latest F24 build, ocamlfind was also installed:

https://kojipkgs.fedoraproject.org//packages/coccinelle/1.0.4/4.fc24/data/logs/x86_64/root.log

but the build (wrongly) complained that scripting was disabled
because ocamlfind isn't installed:

https://kojipkgs.fedoraproject.org//packages/coccinelle/1.0.4/4.fc24/data/logs/x86_64/build.log

Comment 2 Richard W.M. Jones 2016-09-19 09:44:37 UTC
Anyway I have updated the F24 branch to the latest Coccinelle, and
that seems to fix things:

http://koji.fedoraproject.org/koji/taskinfo?taskID=15704775

Comment 3 Fedora Update System 2016-09-19 09:59:17 UTC
coccinelle-1.0.5-1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-feadc0e655

Comment 4 Mat Martineau 2016-09-19 18:09:04 UTC
I tried the 1.0.5 rpm, and while it did resolve the scripting error message, now I get a different error:

$ /usr/bin/spatch -D report --no-show-diff --very-quiet --cocci-file badzero.cocci empty.c
Fatal error: exception Yes_prepare_ocamlcocci.CompileFailure("No coccilib.cmi in /usr/lib64/coccinelle/ocaml/coccilib.cmi or /usr/lib64/coccinelle/ocaml/coccilib/coccilib.cmi")

If I do a local coccinelle 1.0.5 build and 'cp ocaml/*.cmi /usr/lib64/coccinelle/ocaml/', then I can successfully run spatch with badzero.cocci

Comment 5 Mat Martineau 2016-09-19 18:15:33 UTC
Regarding the .cmi files, 'make install-common' does install them to /usr/lib64/coccinelle/ocaml/:

https://github.com/coccinelle/coccinelle/blob/1.0.5/Makefile#L341

Comment 6 Richard W.M. Jones 2016-09-19 18:45:33 UTC
Please try this one if it finishes building:

http://koji.fedoraproject.org/koji/taskinfo?taskID=15709195

Comment 7 Fedora Update System 2016-09-19 19:09:59 UTC
coccinelle-1.0.5-2.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-298075b830

Comment 8 Mat Martineau 2016-09-19 19:29:52 UTC
The 1.0.5-2.fc24 x86_64 build works for my test case.

Comment 9 Fedora Update System 2016-09-19 20:43:36 UTC
coccinelle-1.0.5-2.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-f0a035e115

Comment 10 Fedora Update System 2016-09-20 19:57:33 UTC
coccinelle-1.0.5-2.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-298075b830

Comment 11 Fedora Update System 2016-09-22 01:26:01 UTC
coccinelle-1.0.5-2.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-f0a035e115

Comment 12 Fedora Update System 2016-09-27 00:37:21 UTC
coccinelle-1.0.5-2.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2016-09-30 15:52:29 UTC
coccinelle-1.0.5-2.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.