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

Re: [PATCH v2 1/6] test-lib: introduce test_commit_bulk

From
Jeff King <peff@peff.net>
Date
Jul 2, 2019, 05:22 UTC
Message-ID
<20190702052243.GB16344@sigill.intra.peff.net>
In-Reply-To
<xmqq36jp5qzm.fsf@gitster-ct.c.googlers.com>
On Mon, Jul 01, 2019 at 03:28:45PM -0700, Junio C Hamano wrote:
Show 8 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> >   - replace eval formatting magic with "%s" printf formatters (safer and
> >     gets rid of quoting issues in the callers).
> 
> This one actually made me think twice about safety, as we'd be using
> end-user supplied formatting string without any inspection.  I think
> it is fine as it is merely a test helper.

Yeah, and most shells do something sensible with nonsense formats. E.g., "%s %s" will yield an empty string for the second one in both dash and bash (and that's what POSIX says, though I'd be happy with any implementation that avoids segfaulting).

> If somebody is later making it into a test-tool function, I expect
> that our interpolation engine, not the bare sprintf(), would be used
> there, and it would hopefully also be safe?

Yes, that was exactly my plan. It would also let you mention the number more than once in the format, though I doubt any callers would care about that feature.

I also think more potential callers could be converted if the refname was formatted, too (e.g., some of them seem to write to branch-1, branch-2, etc). I drew the line there, but anybody is welcome to explore it further.

-Peff
Previous: Junio C HamanoNext: Jeff King
Message 35 of 43 in “Git Test Coverage Report (Thurs. June 27)”
  1. Derrick StoleeJun 27, 2019
  2. Derrick StoleeJun 27, 2019
  3. Jeff KingJun 28, 2019
  4. 0/6 easy bulk commit creation in testsJeff King, Jun 28, 2019
  5. 1/6 test-lib: introduce test_commit_bulkJeff King, Jun 28, 2019
  6. Derrick StoleeJun 28, 2019
  7. Junio C HamanoJun 28, 2019
  8. Jeff KingJun 29, 2019
  9. Junio C HamanoJun 28, 2019
  10. Jeff KingJun 29, 2019
  11. Ævar Arnfjörð BjarmasonJun 28, 2019
  12. Jeff KingJun 29, 2019
  13. Eric SunshineJun 28, 2019
  14. SZEDER GáborJun 28, 2019
  15. Eric SunshineJun 28, 2019
  16. Jeff KingJun 29, 2019
  17. SZEDER GáborJun 29, 2019
  18. Junio C HamanoJul 1, 2019
  19. Jeff KingJun 29, 2019
  20. 2/6 t5310: increase the number of bitmapped commitsJeff King, Jun 28, 2019
  21. 3/6 t3311: use test_commit_bulkJeff King, Jun 28, 2019
  22. 4/6 t5702: use test_commit_bulkJeff King, Jun 28, 2019
  23. 5/6 t5703: use test_commit_bulkJeff King, Jun 28, 2019
  24. 6/6 t6200: use test_commit_bulkJeff King, Jun 28, 2019
  25. Johannes SchindelinJun 28, 2019
  26. Jeff KingJun 29, 2019
  27. Elijah NewrenJun 29, 2019
  28. Jeff KingJun 30, 2019
  29. Ævar Arnfjörð BjarmasonJun 28, 2019
  30. Jeff KingJun 29, 2019
  31. 1/6 test-lib: introduce test_commit_bulkJeff King, Jun 29, 2019
  32. Junio C HamanoJul 1, 2019
  33. Jeff KingJul 2, 2019
  34. Junio C HamanoJul 1, 2019
  35. Jeff KingJul 2, 2019
  36. Jeff KingJun 28, 2019
  37. Derrick StoleeJun 28, 2019
  38. Jeff KingJun 28, 2019
  39. Derrick StoleeJun 29, 2019
  40. Jeff KingJun 29, 2019
  41. Duy NguyenJun 28, 2019
  42. Derrick StoleeJun 28, 2019
  43. Christian CouderJun 28, 2019

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.