git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] describe: use strbuf_add_unique_abbrev() for adding short hashes

From
René Scharfe <l.s.r@web.de>
Date
Jan 18, 2018, 21:40 UTC
Message-ID
<7390fd9c-5969-61f1-86b8-6971eaf1432b@web.de>
In-Reply-To
<20180116171130.16568-1-szeder.dev@gmail.com>
Am 16.01.2018 um 18:11 schrieb SZEDER Gábor:
Show 14 quoted lines
> 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:

---
 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
Previous: SZEDER GáborNext: SZEDER Gábor
Message 4 of 11 in “describe: use strbuf_add_unique_abbrev() for adding short hashes”
  1. describe: use strbuf_add_unique_abbrev() for adding short hashesRené Scharfe, Jan 15, 2018
  2. Derrick StoleeJan 16, 2018
  3. SZEDER GáborJan 16, 2018
  4. René ScharfeJan 18, 2018
  5. SZEDER GáborJan 18, 2018
  6. Lars SchneiderJan 18, 2018
  7. René ScharfeJan 19, 2018
  8. Use MOVE_ARRAYSZEDER Gábor, Jan 22, 2018
  9. Jeff KingJan 22, 2018
  10. Junio C HamanoJan 22, 2018
  11. Jeff KingJan 22, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.