Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing Coccinelle dependencies for OCaml script rules #346

Open
elfring opened this issue Jan 9, 2024 · 0 comments
Open

Fixing Coccinelle dependencies for OCaml script rules #346

elfring opened this issue Jan 9, 2024 · 0 comments

Comments

@elfring
Copy link
Contributor

elfring commented Jan 9, 2024

The following tiny script variant for the semantic patch language can be tried out also together with the software combination “Coccinelle 1.1.1-00628-gd7ca09d1” on an openSUSE Tumbleweed system.

@initialize:ocaml@
@@
Printf.printf "Hello for this test!\n"

@display@
identifier x;
@@
*x(...)
 {...}

Irrelevant source file example:

void setup(void)
{
char x = 'X';
}

Test result:

Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> spatch test-OCaml_script_generation.cocci test-setup1.c
…
  • The status message “Using native version of ocamlc/ocamlopt/ocamldep” (which is provided by the function “check_runtime”) is displayed.
  • The unexpected error message “ocamlfind: Package 'iteration' not found” is presented.
    • The test command can be adapted to the variant “strace -ff spatch test-OCaml_script_generation.cocci test-setup1.c > trace-OCaml_script_generation-20240109.txt 2>&1”.
    • 👀 The generated text file contains information like “[pid 22136] execve("/bin/sh", ["/bin/sh", "-c", "ocamlfind query iteration"], 0x7fff6d6dc988 /* 109 vars */ <unfinished ...>”.
    • The following source code looks promising somehow. 🤔
      let get_dir p =
        let inclcmd = !Flag.ocamlfind ^" query "^p in
    • 💭 It might be expected that an OCaml module should be found from a known place.
  • What should be done with the subsequent hint “hd”?
    🔮 How much would the OCaml debugger help to clarify such information?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant