From: Markus Elfring <Markus.Elfring@web.de>
To: Coccinelle <cocci@systeme.lip6.fr>
Subject: [Cocci] Checking execution environment for Python code in SmPL scripts
Date: Sat, 20 Apr 2019 09:30:11 +0200 [thread overview]
Message-ID: <8c9c537c-60b7-a9da-9787-bf28a83b72e8@web.de> (raw)
In-Reply-To: <11a0c402-265c-4bc1-9cdd-244735dbc3e1@web.de>
Hello,
I constructed a SmPL script which can work as desired.
elfring@Sonne:~/Projekte/Linux/next-patched> spatch drivers/media/dvb-frontends/tda1004x.c ~/Projekte/Coccinelle/janitor/list_duplicate_statement_pairs_from_if_branches3.cocci
…
Using SQLAlchemy version:
1.3.2
…
statement1|statement2|"function name"|"source file"|incidence
kfree ( state ) ;|return NULL ;|tda10045_attach|drivers/media/dvb-frontends/tda1004x.c|2
kfree ( state ) ;|return NULL ;|tda10046_attach|drivers/media/dvb-frontends/tda1004x.c|2
Unfortunately, I get another unexpected test result by the following command.
elfring@Sonne:~/Projekte/Linux/next-patched> spatch -D URL=postgresql+psycopg2:///media_duplicates1 drivers/media/dvb-frontends/tda1004x.c ~/Projekte/Coccinelle/janitor/list_duplicate_statement_pairs_from_if_branches4.cocci
…
Traceback (most recent call last):
File "<string>", line 4, in <module>
NameError: name 'store_statements' is not defined
exn while in timeout_function
…
The following display shows intended differences between these SmPL scripts.
@initialize:python@
+URL << virtual.database_URL;
@@
import sqlalchemy, sys
…
-engine = create_engine("sqlite:///:memory:", echo=False)
+
+if URL == False or URL == "default":
+ URL = "sqlite:///result-duplicates.db"
+
+engine = create_engine(URL, echo = False)
The custom function “store_statements” should be usable in both script variants.
Now I wonder about the shown software behaviour again. How can it be fixed?
Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
next prev parent reply other threads:[~2019-04-20 7:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-12 9:42 [Cocci] Checking the “display” of last two statements in code blocks Markus Elfring
2019-04-12 9:45 ` Julia Lawall
2019-04-12 10:28 ` Markus Elfring
2019-04-12 10:32 ` Julia Lawall
2019-04-12 10:42 ` [Cocci] Clarification for SmPL asterisk functionality Markus Elfring
2019-04-18 10:00 ` [Cocci] Searching for last two statements in code blocks Markus Elfring
2019-10-22 15:19 ` Markus Elfring
2019-04-19 12:14 ` [Cocci] Checking the search for duplicate statements at the end of if branches Markus Elfring
2019-04-20 7:30 ` Markus Elfring [this message]
2019-04-20 7:35 ` [Cocci] Checking execution environment for Python code in SmPL scripts Julia Lawall
2019-04-20 7:51 ` Markus Elfring
2019-04-20 8:05 ` Julia Lawall
2019-04-20 8:11 ` Markus Elfring
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=8c9c537c-60b7-a9da-9787-bf28a83b72e8@web.de \
--to=markus.elfring@web.de \
--cc=cocci@systeme.lip6.fr \
/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).