git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>,
	Stefan Beller <sbeller@google.com>,
	Lars Schneider <larsxschneider@gmail.com>
Subject: Re: [PATCH] describe: use strbuf_add_unique_abbrev() for adding short hashes
Date: Thu, 18 Jan 2018 23:40:17 +0100	[thread overview]
Message-ID: <CAM0VKj=eL5ZnnwKrxqtDYE+ijqJvcU-4bJNhjurvdn+Bpv7gUQ@mail.gmail.com> (raw)
In-Reply-To: <7390fd9c-5969-61f1-86b8-6971eaf1432b@web.de>

On Thu, Jan 18, 2018 at 10:40 PM, René Scharfe <l.s.r@web.de> wrote:
> Am 16.01.2018 um 18:11 schrieb SZEDER Gábor:
>> Unfortunately, most of the changes coming from 'strbuf.cocci' don't
>> make any sense, they appear to be the mis-application of the "use
>> strbuf_addstr() instead of strbuf_addf() to add a single string" rule:
>>
>>    -             strbuf_addf(&sb_repo, "%d", counter);
>>    +             strbuf_addstr(&sb_repo, counter);
>>
>> It seems that those rules need some refinement, but I have no idea
>> about Coccinelle and this is not the time for me to dig deeper.
>>
>> What makes all this weird is that running 'make coccicheck' on my own
>> machine doesn't produce any of these additional proposed changes, just
>> like at René's.  Can it be related to differing Coccinelle versions?
>> Travis CI installs 1.0.0~rc19.deb-3; I have 1.0.4.deb-2.
>
> The version difference may explain it, but I couldn't find a matching
> bugfix in http://coccinelle.lip6.fr/distrib/changes.html when I just
> skimmed it.  I wonder if the following patch could make a difference:

Yes, it does, now all those nonsense suggestions are gone on Travis CI.

  https://travis-ci.org/szeder/git/jobs/330572425#L713

Those "memmove() -> MOVE_ARRAY" suggestions are still there, of course.

> ---
>  contrib/coccinelle/strbuf.cocci | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/contrib/coccinelle/strbuf.cocci b/contrib/coccinelle/strbuf.cocci
> index 1d580e49b0..6fe8727421 100644
> --- a/contrib/coccinelle/strbuf.cocci
> +++ b/contrib/coccinelle/strbuf.cocci
> @@ -29,8 +29,9 @@ cocci.include_match("%" not in fmt)
>
>  @@
>  expression E1, E2;
> +format F =~ "s";
>  @@
> -- strbuf_addf(E1, "%s", E2);
> +- strbuf_addf(E1, "%@F@", E2);
>  + strbuf_addstr(E1, E2);
>
>  @@
> --
> 2.16.0

  reply	other threads:[~2018-01-18 22:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-15 17:10 [PATCH] describe: use strbuf_add_unique_abbrev() for adding short hashes René Scharfe
2018-01-16 13:48 ` Derrick Stolee
2018-01-16 17:11 ` SZEDER Gábor
2018-01-18 21:40   ` René Scharfe
2018-01-18 22:40     ` SZEDER Gábor [this message]
2018-01-18 23:02       ` Lars Schneider
2018-01-19 17:53       ` René Scharfe
2018-01-22 17:50         ` [PATCH] Use MOVE_ARRAY SZEDER Gábor
2018-01-22 22:44           ` Jeff King
2018-01-22 23:26             ` Junio C Hamano
2018-01-22 23:34               ` Jeff King

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAM0VKj=eL5ZnnwKrxqtDYE+ijqJvcU-4bJNhjurvdn+Bpv7gUQ@mail.gmail.com' \
    --to=szeder.dev@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=l.s.r@web.de \
    --cc=larsxschneider@gmail.com \
    --cc=sbeller@google.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).