cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Timur Tabi <timur@kernel.org>
Cc: cocci <cocci@systeme.lip6.fr>
Subject: Re: [Cocci] Positional parameter p1[0].file contains temporarily munged filename, not original
Date: Wed, 23 Jan 2019 07:29:18 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.21.1901230727240.2762@hadrien> (raw)
In-Reply-To: <CAOZdJXVwUs26YSmHXa75QeZ1ARkfBXaf=0HaapoaKGvP9Ux1vQ@mail.gmail.com>



On Tue, 22 Jan 2019, Timur Tabi wrote:

> On Tue, Jan 22, 2019 at 12:44 PM Julia Lawall <julia.lawall@lip6.fr> wrote:
> >
> > You can use List.hd (Coccilib.files()) in OCaml.  I guess some similar
> > function exists for python.
>
> Can you expand on that?  I took at look at
> https://github.com/coccinelle/coccinelle/tree/master/python/coccilib,
> which I presume is the coccilib that you're talking about.  I don't
> see a files() anywhere in there.  I tried to instantiate the Location
> object:
>
> import coccilib
> cocci = coccilib.Location()
> print >>sys.stderr, cocci
>
> But that just gave me:
>
> Traceback (most recent call last):
>   File "<string>", line 44, in <module>
> AttributeError: 'module' object has no attribute 'Location'
> Error in Python script, line 130, file "/home/ttabi/nv_printf.cocci":
> Python failure
>
> The "import" statement didn't fail, so I presume that coccilib is a
> real library, but I think I'm calling it wrong.  My Python isn't good
> enough to read a library implementation and know how to use it.

It could be cocci.XXX and there is no need to import it.  But files
doesn't seem to exist.  I have asked for it to be added.  In the meantime,
perhas you can just record the file names earlier in the semantic patch,
before there is any transformation.

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

      reply	other threads:[~2019-01-23  6:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-18 21:36 [Cocci] Positional parameter p1[0].file contains temporarily munged filename, not original Timur Tabi
2018-12-18 22:07 ` Julia Lawall
2018-12-19  0:39   ` Timur Tabi
2018-12-19  6:21     ` Julia Lawall
2018-12-19 13:32       ` Timur Tabi
2019-01-22 18:36       ` Timur Tabi
2019-01-22 18:43         ` Julia Lawall
2019-01-23  0:05           ` Timur Tabi
2019-01-23  6:29             ` Julia Lawall [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.21.1901230727240.2762@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=cocci@systeme.lip6.fr \
    --cc=timur@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).