On Sat, 20 Apr 2019, Markus Elfring wrote:

> 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;

On the command line, your -D argument is URL, but here the variable is
called database_URL.  If you don't provide the variables needed by the
initialize rule, the initialize rule doesn't run.

julia


>  @@
>  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
> [email protected]
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to