qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/6] scripts/coccinelle: add error-use-after-free.cocci


From: Peter Maydell
Subject: Re: [PATCH 1/6] scripts/coccinelle: add error-use-after-free.cocci
Date: Thu, 2 Apr 2020 08:19:15 +0000

On Thu, 2 Apr 2020 at 07:55, Markus Armbruster <address@hidden> wrote:
> Peter Maydell <address@hidden> writes:
> > I use this thing maybe once a month at most, more likely once
> > every three months, and the documentation is notoriously
> > impenetrable. I really really don't want to have to start looking in it
> > and guessing about how the original author ran the script, when
> > they could have just told me.
>
> I'm afraid we're talking part each other.

Perhaps; but I think we're also genuinely disagreeing.

> >>           $  spatch --sp-file scripts/coccinelle/qobject.cocci \
> >>                     --macro-file scripts/cocci-macro-file.h \
> >>                     --dir block --in-place
> >
> > Yep, that command line would be great to see in the script file.
>
> Except for the --dir block part, which is even worse than noise: it
> suggests this is just for block/, which is wrong.

It tells the reader that the original author only tested
the script to work inside block/, which is useful information.
(This is why scripts/coccinelle/cpu-reset.cocci specifies
--dir target in its command.)

> > The least-effort way for the author of the script to do that is to
> > simply give the command line they used to run it.
>
> If you're capable of writing a Coccinelle script that actually does what
> you want, you're certainly capable of doing better than blindly paste
> from your shell history.  Kindly drop the options that are specific to
> just this particular use of the script.  Keep the ones that future users
> will actually need.

I'm a future user; in fact I'm the future user whose needs I have
the best information on. I want to see the whole command, please.

> Two proficiencies: using a script somebody else wrote, and writing
> simple scripts.  Let me try to sketch just about the most basic of basic
> levels for the former.  Note that I'm making *liberal* allowance for
> reluctance to learn tools[*].
>
> Understand
>
> * that .cocci means Coccinelle
> * how to install Coccinelle
> * that you need to feed the .cocci to spatch
> * that this produces a patch
> * how to apply the patch to the tree
>
> None of this I want to explain in every .cocci script.  All of this
> I want be explained in scripts/coccinelle/README.

I'm certainly not arguing against having a README which helps
people with onboarding into the world of coccinelle scripts;
I think that would be great. I just don't really see much benefit
to either authors or script readers in asking authors to do more
than quote the coccinelle command line they used in the
comments at the top of their script.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]