Skip to contentSkip to conversation

spatch inserting the following rule into the patch

Cocci Christoph Böhmwalder 3 participants 4 messages Jul 19, 2019 – Jul 22, 2019

lore
Share & tools
lore
#0 lore raw

Hi,

I believe I've stumbled upon a bug here:

repro.cocci
-------------------
@@
@@
- COCCI_REPLACE_THIS();
+ int x __attribute__((some_attr));

@@
@@
- foo();
+ f(g());

repro.c
-------------------
int main()

{
	COCCI_REPLACE_THIS();
}

spatch --sp-file repro.cocci repro.c
-------------------
init_defs_builtins: /usr/lib/coccinelle/standard.h
HANDLING: repro.c

tmp/cocci-output-4924-2aa580-repro.c renamed from repro.c +6 -1
diff =
@@ -1,4 +1,9 @@
 int main()
 {
-       COCCI_REPLACE_THIS();
+       int x__attribute__((some_attr));
+
+@@
+@@
+- foo();
++ f(g());
 }

Apparently this requires the __attribute__ in the first rule *and* the function call as an argument in the second rule, if I remove either of those the patch works as intended.

Regards,
Christoph

--
Christoph Böhmwalder
LINBIT | Keeping the Digital World Running DRBD HA — Disaster Recovery — Software defined Storage
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

#1 lore raw
Quoted 45 lines · Christoph Böhmwalder

Hi,

I believe I've stumbled upon a bug here:

repro.cocci
-------------------
@@
@@
- COCCI_REPLACE_THIS();
+ int x __attribute__((some_attr));

@@
@@
- foo();
+ f(g());

repro.c
-------------------
int main()

{
	COCCI_REPLACE_THIS();
}

spatch --sp-file repro.cocci repro.c
-------------------
init_defs_builtins: /usr/lib/coccinelle/standard.h
HANDLING: repro.c
diff =

tmp/cocci-output-4924-2aa580-repro.c renamed from repro.c +6 -1
@@ -1,4 +1,9 @@
 int main()
 {
-       COCCI_REPLACE_THIS();
+       int x__attribute__((some_attr));
+
+@@
+@@
+- foo();
++ f(g());
 }
Quoted 3 lines

Apparently this requires the __attribute__ in the first rule *and* the function call as an argument in the second rule, if I remove either of those the patch works as intended.

What version of Coccinelle of do you have? I get the correct output on this example:

tmp/cocci-output-153931-8de7ba-attr.c renamed from attr.c +1 -1
diff =
@@ -1,4 +1,4 @@
 int main()
 {
-        COCCI_REPLACE_THIS();
+        int x__attribute__((some_attr));
 }

julia

Quoted 4 lines

Regards,
Christoph

Quoted 9 lines

--
Christoph Böhmwalder
LINBIT | Keeping the Digital World Running DRBD HA — Disaster Recovery — Software defined Storage
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

#2 lore raw
Quoted 13 lines · Julia Lawall

What version of Coccinelle of do you have? I get the correct output on this example:

diff =

tmp/cocci-output-153931-8de7ba-attr.c renamed from attr.c +1 -1
@@ -1,4 +1,4 @@
 int main()
 {
-        COCCI_REPLACE_THIS();
+        int x__attribute__((some_attr));
 }
Quoted 2 lines

julia

I was running 1.0.4.deb-3build4, which is just what you get when you run apt install coccinelle on Ubuntu bionic.
I just built the latest HEAD from GitHub and the bug indeed seems fixed. Maybe a version bump of the Ubuntu repos would be appropriate?

Thanks,
Christoph

--
Christoph Böhmwalder
LINBIT | Keeping the Digital World Running DRBD HA — Disaster Recovery — Software defined Storage
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

#3 lore raw
Quoted 14 lines · Christoph Böhmwalder
Quoted 13 lines · Julia Lawall

What version of Coccinelle of do you have? I get the correct output on this example:

diff =

tmp/cocci-output-153931-8de7ba-attr.c renamed from attr.c +1 -1
@@ -1,4 +1,4 @@
 int main()
 {
-        COCCI_REPLACE_THIS();
+        int x__attribute__((some_attr));
 }
Quoted 7 lines
Quoted 2 lines

julia

I was running 1.0.4.deb-3build4, which is just what you get when you run apt install coccinelle on Ubuntu bionic.
I just built the latest HEAD from GitHub and the bug indeed seems fixed. Maybe a version bump of the Ubuntu repos would be appropriate?

Try this:
https://launchpad.net/~npalix/+archive/ubuntu/coccinelle

But it is always advised to use the latest source.

Quoted 11 lines

Thanks,
Christoph

--
Christoph Böhmwalder
LINBIT | Keeping the Digital World Running DRBD HA — Disaster Recovery — Software defined Storage
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Signature · 8 lines
Himanshu Jha
Undergraduate Student
Department of Electronics & Communication
Guru Tegh Bahadur Institute of Technology
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci