From: Paul Chaignon <paul@cilium.io>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: cocci@systeme.lip6.fr
Subject: Re: [Cocci] Exit with non-zero status
Date: Wed, 29 Apr 2020 17:16:09 +0200 [thread overview]
Message-ID: <20200429151608.GA5703@Mem> (raw)
In-Reply-To: <alpine.DEB.2.21.2004291704240.2450@hadrien>
On Wed, Apr 29, 2020 at 05:07:56PM +0200, Julia Lawall wrote:
>
>
> On Wed, 29 Apr 2020, Paul Chaignon wrote:
>
> > Hi everyone,
> >
> > I am trying to exit spatch with a non-zero exit status when required
> > changes have been found. I have tried to add a rule with finalize:python
> > and the following code:
> >
> > @finalize:python@
> > @@
> > exit(cnt)
> >
> > where cnt is incremented by another Python rule everytime a required
> > change is found. This works as expected except for the --in-place option
> > which becomes ineffective.
> >
> > Is this a bug, or is finalize:python not intended to be used in that
> > manner? Is it possible to overwrite spatch's exit status?
>
> I'm actually surprised that this would ever work...
>
> Finalize was intended for processing information in general, eg printing
> some statistics about what was matched.
>
> Would it be feasible to print cnt instead?
Sure. I can easily get around this issue by e.g. grepping for spatch's
messages in a wrapper script. Getting spatch to return a non-zero exit
status is just a convenience. I thought that would be a fairly common
use case.
Thanks for the quick answer as always :)
Paul
>
> julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
next prev parent reply other threads:[~2020-04-29 15:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-29 14:39 [Cocci] Exit with non-zero status Paul Chaignon
2020-04-29 15:07 ` Julia Lawall
2020-04-29 15:16 ` Paul Chaignon [this message]
2020-04-29 15:25 ` Julia Lawall
2020-04-29 18:40 Markus Elfring
2020-04-29 19:07 ` Paul Chaignon
2020-04-29 19:50 ` Markus Elfring
2020-05-05 9:59 ` Paul Chaignon
2020-05-05 11:08 ` Markus Elfring
2020-05-06 12:01 ` Paul Chaignon
2020-05-06 12:24 ` 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=20200429151608.GA5703@Mem \
--to=paul@cilium.io \
--cc=cocci@systeme.lip6.fr \
--cc=julia.lawall@inria.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).