Skip to contentSkip to conversation

Checking name space conflicts for SmPL script rules

cocci Markus Elfring 2 participants 3 messages Jan 25, 2024

lore
Share & tools
lore
#0 lore raw

Hello,

I am trying the following tiny script variant for the semantic patch language out also together with the software combination “Coccinelle 1.1.1-00630-gdeb429df”.

@search@
identifier name;
@@
name(...);

@script:python selection@
id << search.name;
@@
if id == "Test":
cocci.include_match(False)

Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> spatch --parse-cocci test-name_space_conflict-20240125.cocci …
scriptmeta: parse error:
File "test-name_space_conflict-20240125.cocci", line 7, column 13, charpos = 81
around = 'name',
whole content = id << search.name;

Now I wonder how this software behaviour would fit to the documentation.
https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/5fdb1a247d3374ac30a3e565b2cc5167aeefc4e5/docs/manual/cocci_syntax.tex#L87

Will the shown restriction be reconsidered?

Regards,
Markus

#1 lore raw
Quoted 26 lines · Markus Elfring

Hello,

I am trying the following tiny script variant for the semantic patch language out also together with the software combination “Coccinelle 1.1.1-00630-gdeb429df”.

@search@
identifier name;
@@
name(...);

@script:python selection@
id << search.name;
@@
if id == "Test":
cocci.include_match(False)

Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> spatch --parse-cocci test-name_space_conflict-20240125.cocci …
scriptmeta: parse error:
File "test-name_space_conflict-20240125.cocci", line 7, column 13, charpos = 81
around = 'name',
whole content = id << search.name;

Quoted 4 lines

Now I wonder how this software behaviour would fit to the documentation.
https://gitlab.inria.fr/coccinelle/coccinelle/-/blob/5fdb1a247d3374ac30a3e565b2cc5167aeefc4e5/docs/manual/cocci_syntax.tex#L87

Will the shown restriction be reconsidered?

name is also a reserved word of Coccinelle, as in iterator name xxx;

Just pick some other name for your metavariable.

julia

#2 lore raw
Quoted 3 lines
Quoted 1 line

Will the shown restriction be reconsidered?

name is also a reserved word of Coccinelle, as in iterator name xxx;

I suggest to take another look at corresponding case distinctions.

I got the impression that the metavariable with the identifier “name” gets accepted by this software for the first SmPL rule.

Quoted 1 line

Just pick some other name for your metavariable.

Can the avoidance of questionable name space conflicts become safer and more convenient also for such a test case?

Regards,
Markus