Coccinelle archive on lore.kernel.org
 help / color / Atom feed
* [Cocci] spatch inserting the following rule into the patch
@ 2019-07-19  7:01 Christoph Böhmwalder
  2019-07-20 16:39 ` Julia Lawall
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Böhmwalder @ 2019-07-19  7:01 UTC (permalink / raw)
  To: cocci

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 =
--- repro.c
+++ /tmp/cocci-output-4924-2aa580-repro.c
@@ -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
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Cocci] spatch inserting the following rule into the patch
  2019-07-19  7:01 [Cocci] spatch inserting the following rule into the patch Christoph Böhmwalder
@ 2019-07-20 16:39 ` Julia Lawall
  2019-07-22  8:04   ` Christoph Böhmwalder
  0 siblings, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2019-07-20 16:39 UTC (permalink / raw)
  To: Christoph Böhmwalder; +Cc: cocci

[-- Attachment #1: Type: text/plain, Size: 1455 bytes --]



On Fri, 19 Jul 2019, Christoph Böhmwalder wrote:

> 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 =
> --- repro.c
> +++ /tmp/cocci-output-4924-2aa580-repro.c
> @@ -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.

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

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

julia

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

[-- Attachment #2: Type: text/plain, Size: 136 bytes --]

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Cocci] spatch inserting the following rule into the patch
  2019-07-20 16:39 ` Julia Lawall
@ 2019-07-22  8:04   ` Christoph Böhmwalder
  2019-07-22 14:54     ` Himanshu Jha
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Böhmwalder @ 2019-07-22  8:04 UTC (permalink / raw)
  To: Julia Lawall; +Cc: cocci

On 20.07.19 18:39, Julia Lawall wrote:
> What version of Coccinelle of do you have?  I get the correct output on
> this example:
> 
> diff =
> --- attr.c
> +++ /tmp/cocci-output-153931-8de7ba-attr.c
> @@ -1,4 +1,4 @@
>  int main()
>  {
> -        COCCI_REPLACE_THIS();
> +        int x__attribute__((some_attr));
>  }
> 
> 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
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Cocci] spatch inserting the following rule into the patch
  2019-07-22  8:04   ` Christoph Böhmwalder
@ 2019-07-22 14:54     ` Himanshu Jha
  0 siblings, 0 replies; 4+ messages in thread
From: Himanshu Jha @ 2019-07-22 14:54 UTC (permalink / raw)
  To: Christoph Böhmwalder; +Cc: cocci

On Mon, Jul 22, 2019 at 10:04:58AM +0200, Christoph Böhmwalder wrote:
> On 20.07.19 18:39, Julia Lawall wrote:
> > What version of Coccinelle of do you have?  I get the correct output on
> > this example:
> > 
> > diff =
> > --- attr.c
> > +++ /tmp/cocci-output-153931-8de7ba-attr.c
> > @@ -1,4 +1,4 @@
> >  int main()
> >  {
> > -        COCCI_REPLACE_THIS();
> > +        int x__attribute__((some_attr));
> >  }
> > 
> > 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.

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

-- 
Himanshu Jha
Undergraduate Student
Department of Electronics & Communication
Guru Tegh Bahadur Institute of Technology
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-19  7:01 [Cocci] spatch inserting the following rule into the patch Christoph Böhmwalder
2019-07-20 16:39 ` Julia Lawall
2019-07-22  8:04   ` Christoph Böhmwalder
2019-07-22 14:54     ` Himanshu Jha

Coccinelle archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/cocci/0 cocci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 cocci cocci/ https://lore.kernel.org/cocci \
		cocci@systeme.lip6.fr cocci@archiver.kernel.org
	public-inbox-index cocci


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/fr.lip6.systeme.cocci


AGPL code for this site: git clone https://public-inbox.org/ public-inbox