From: Markus Armbruster <armbru@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Kevin Wolf" <kwolf@redhat.com>,
"Vladimir Sementsov-Ogievskiy" <vsementsov@virtuozzo.com>,
zhanghailiang <zhang.zhanghailiang@huawei.com>,
Qemu-block <qemu-block@nongnu.org>,
"Juan Quintela" <quintela@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"Denis V. Lunev" <den@openvz.org>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Max Reitz" <mreitz@redhat.com>, "John Snow" <jsnow@redhat.com>,
"Michael Roth" <mdroth@linux.vnet.ibm.com>
Subject: Re: [PATCH 1/6] scripts/coccinelle: add error-use-after-free.cocci
Date: Wed, 01 Apr 2020 16:44:33 +0200 [thread overview]
Message-ID: <87tv23fepa.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <CAFEAcA-mZ5nPOoPz0kafmEjUORYQj-DvieMeWqgbFarp1_DhNg@mail.gmail.com> (Peter Maydell's message of "Wed, 1 Apr 2020 11:04:41 +0000")
Peter Maydell <peter.maydell@linaro.org> writes:
> On Wed, 1 Apr 2020 at 06:07, Markus Armbruster <armbru@redhat.com> wrote:
>
>> Generic instructions for using .cocci scripts should go into README.
>> Enough to get you started if you know nothing about Coccinelle.
>>
>> Options that should always be used with a certain script should be
>> documented in that script.
>>
>> Options that only affect work-flow, not the patch, I'd rather keep out
>> of the script. If there are any we feel we should mention, do that in
>> README. Example: --no-show-diff.
>
> But then as a coccinelle script author I need to know which of
> the options I needed are standard, which are for-this-script-only,
> and which are just 'workflow'.
If you're capable of writing a Coccinelle script that actually does what
you want, I bet you dollars to donuts that you can decide which options
actually affect the patch in comparably no time whatsoever ;)
If you prefer to bother your reader with your personal choices, that's
between you and your reviewers. Myself, I prefer less noise around the
signal.
> And as a reader I *still* need to
> go and look through the README and look at this script and
> then try to reconstitute what command line might have been
> used.
You don't. The "just work-flow" options by definition do not affect the
patch.
If you got Coccinelle installed and know the very basics, then the
incantation in the script should suffice to use the script, and the
incantation in the commit message should suffice to reproduce the patch.
If you know nothing about Coccinelle, the README should get you started.
Example:
commit 4e20c1becba3fd2e8e71a2663cefb9627fd2a6e0
Author: Markus Armbruster <armbru@redhat.com>
Date: Thu Dec 13 18:51:54 2018 +0100
block: Replace qdict_put() by qdict_put_obj() where appropriate
Patch created mechanically by rerunning:
$ spatch --sp-file scripts/coccinelle/qobject.cocci \
--macro-file scripts/cocci-macro-file.h \
--dir block --in-place
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
scripts/coccinelle/qobject.cocci has no usage comment. I doubt it needs
one, but I'd certainly tolerate something like
// Usage:
// spatch --sp-file scripts/coccinelle/qobject.cocci \
// --macro-file scripts/cocci-macro-file.h \
// FILES ...
I'd even tolerate throwing in --in-place. But --use-gitgrep is too much
for my taste.
> That's more work for the author *and* more work for the
> reader than just "put the command line you used into the script
> as a comment" -- so who's it benefiting?
Anyone with basic Coccinelle proficiency benefits slightly from the
reduction of noise.
Coccinelle noobs benefit from the more verbose instructions in the
README. Duplicating those in every script is not maintainable.
Maintainers benefit slightly from less redundancy.
>> Brief instructions for how a patch was created should be included in the
>> commit message. They should suffice for readers familiar with
>> Coccinelle. Yes, there's a bit of redundancy with README and the
>> script.
next prev parent reply other threads:[~2020-04-01 14:45 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-24 15:36 [PATCH for-5.0 0/6] Several error use-after-free Vladimir Sementsov-Ogievskiy
2020-03-24 15:36 ` [PATCH 1/6] scripts/coccinelle: add error-use-after-free.cocci Vladimir Sementsov-Ogievskiy
2020-03-31 9:00 ` Markus Armbruster
2020-03-31 9:12 ` Vladimir Sementsov-Ogievskiy
2020-03-31 13:14 ` Markus Armbruster
2020-03-31 13:49 ` Vladimir Sementsov-Ogievskiy
2020-03-31 18:38 ` Markus Armbruster
2020-03-31 18:56 ` Peter Maydell
2020-04-01 5:07 ` Markus Armbruster
2020-04-01 11:04 ` Peter Maydell
2020-04-01 14:44 ` Markus Armbruster [this message]
2020-04-01 16:12 ` Peter Maydell
2020-04-02 6:55 ` Markus Armbruster
2020-04-02 8:19 ` Peter Maydell
2020-04-02 8:36 ` Markus Armbruster
2020-03-24 15:36 ` [PATCH 2/6] block/mirror: fix use after free of local_err Vladimir Sementsov-Ogievskiy
2020-03-24 15:57 ` Eric Blake
2020-03-24 17:10 ` John Snow
2020-03-25 11:11 ` Max Reitz
2020-03-25 11:29 ` Max Reitz
2020-03-25 11:47 ` Vladimir Sementsov-Ogievskiy
2020-03-25 12:00 ` Max Reitz
2020-03-31 9:12 ` Markus Armbruster
2020-03-25 13:01 ` Eric Blake
2020-03-25 12:01 ` Max Reitz
2020-03-24 15:36 ` [PATCH 3/6] dump/win_dump: fix use after free of err Vladimir Sementsov-Ogievskiy
2020-03-30 15:54 ` Markus Armbruster
2020-03-24 15:36 ` [PATCH 4/6] migration/colo: fix use after free of local_err Vladimir Sementsov-Ogievskiy
2020-03-24 19:40 ` Dr. David Alan Gilbert
2020-03-24 15:36 ` [PATCH 5/6] migration/ram: " Vladimir Sementsov-Ogievskiy
2020-03-24 19:41 ` Dr. David Alan Gilbert
2020-03-24 15:36 ` [PATCH 6/6] qga/commands-posix: " Vladimir Sementsov-Ogievskiy
2020-03-24 20:03 ` Eric Blake
2020-03-25 4:28 ` Vladimir Sementsov-Ogievskiy
2020-03-31 11:46 ` Markus Armbruster
2020-03-31 12:04 ` Vladimir Sementsov-Ogievskiy
2020-03-31 8:13 ` Markus Armbruster
2020-03-24 15:50 ` [PATCH for-5.0 0/6] Several error use-after-free Richard Henderson
2020-04-04 12:18 ` Markus Armbruster
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=87tv23fepa.fsf@dusky.pond.sub.org \
--to=armbru@redhat.com \
--cc=den@openvz.org \
--cc=dgilbert@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mreitz@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=vsementsov@virtuozzo.com \
--cc=zhang.zhanghailiang@huawei.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.