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

Re: [PATCH 10/10] add UNLEAK annotation for reducing leak false positives

From
Jeff King <peff@peff.net>
Date
Sep 12, 2017, 15:29 UTC
Message-ID
<20170912152935.iqmj6jpkvgifaju2@sigill.intra.peff.net>
In-Reply-To
<1505223698.27800.30.camel@gmail.com>
On Tue, Sep 12, 2017 at 07:11:38PM +0530, Kaartic Sivaraam wrote:
Show 22 quoted lines
> On Tue, 2017-09-05 at 09:05 -0400, Jeff King wrote:
> > This patch introduces an UNLEAK() macro that lets us do so.
> > To understand its design, let's first look at some of the
> > alternatives.
> > 
> 
> > This patch adds the UNLEAK() macro and enables it
> > automatically when Git is compiled with SANITIZE=leak.
> > It adds some UNLEAK() annotations to show off how the
> > feature works. On top of other recent leak fixes, these are
> > enough to get t0000 and t0001 to pass when compiled with
> > LSAN.
> 
> My nit of the day ;-)
> 
> The above paragraphs seems to going against the following guideline of
> Documentation/SubmittingPatches,
> 
>     Describe your changes in imperative mood, e.g. "make xyzzy do frotz"
>     instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy
>     to do frotz", as if you are giving orders to the codebase to change
>     its behavior.  Try to make sure your explanation can be understood

Like all good writing rules, I think it's important to know when to break them. :)

Writing in the imperative is _most_ important in the subject. You're likely to see a lot of subjects in a list, and it makes the list easier to read if they all match. It also tends to be shorter, which is good for subjects.

For short commit messages, I think the imperative also keeps things tight and to the point: describe the problem and then say how to fix it. The recent 0db3dc75f is a good example (which I picked by skimming recent "git log" output). But saying "this patch" is IMHO not that big a problem there, as long as it isn't done excessively.

When you the explanation is longer or more complicated, the imperative can actually be a bit _too_ terse. In longer text it helps to guide readers in the direction you want their thoughts to take. Having a three-paragraph explanation of the problem or current state of things and then jumping right into "Do this. Do that." lacks context. A marker like "this patch" helps the reader know that you're switching gears to talking about the solution.

I also think that "I" is useful in avoiding the passive voice. It can certainly be used gratuitously and make things less clear, but in most cases I'd rather see something like "I tested performance under these conditions" than "Performance was tested under these conditions". I also often use the "academic we" here even when I worked on something myself.

-Peff
Previous: Kaartic SivaraamNext: Kaartic Sivaraam
Message 22 of 42 in “towards clean leak-checker output”
  1. 0/10 towards clean leak-checker outputJeff King, Sep 5, 2017
  2. 01/10 test-lib: --valgrind should not override --verbose-logJeff King, Sep 5, 2017
  3. 02/10 test-lib: set LSAN_OPTIONS to abort by defaultJeff King, Sep 5, 2017
  4. 03/10 add: free leaked pathspec after add_files_to_cache()Jeff King, Sep 5, 2017
  5. 04/10 update-index: fix cache entry leak in add_one_file()Jeff King, Sep 5, 2017
  6. 05/10 config: plug user_config leakJeff King, Sep 5, 2017
  7. 06/10 reset: make tree counting less confusingJeff King, Sep 5, 2017
  8. 07/10 reset: free allocated tree buffersJeff King, Sep 5, 2017
  9. 08/10 repository: free fields before overwriting themJeff King, Sep 5, 2017
  10. 09/10 set_git_dir: handle feeding gitdir to itselfJeff King, Sep 5, 2017
  11. Brandon WilliamsSep 7, 2017
  12. 10/10 add UNLEAK annotation for reducing leak false positivesJeff King, Sep 5, 2017
  13. Stefan BellerSep 5, 2017
  14. Jeff KingSep 7, 2017
  15. Stefan BellerSep 7, 2017
  16. Kaartic SivaraamSep 12, 2017
  17. Jeff KingSep 12, 2017
  18. Kaartic SivaraamSep 13, 2017
  19. Martin ÅgrenSep 6, 2017
  20. Jeff KingSep 7, 2017
  21. Kaartic SivaraamSep 12, 2017
  22. Jeff KingSep 12, 2017
  23. Kaartic SivaraamSep 13, 2017
  24. Martin ÅgrenSep 5, 2017
  25. Jeff KingSep 5, 2017
  26. Martin ÅgrenSep 5, 2017
  27. Jeff KingSep 6, 2017
  28. Junio C HamanoSep 6, 2017
  29. 0/2 simplifying !RUNTIME_PREFIXJeff King, Sep 6, 2017
  30. 1/2 system_path: move RUNTIME_PREFIX to a sub-functionJeff King, Sep 6, 2017
  31. Johannes SchindelinSep 6, 2017
  32. Jeff KingSep 6, 2017
  33. 2/2 git_extract_argv0_path: do nothing without RUNTIME_PREFIXJeff King, Sep 6, 2017
  34. 10/10 add UNLEAK annotation for reducing leak false positivesJeff King, Sep 8, 2017
  35. Jonathan TanSep 19, 2017
  36. Jeff KingSep 19, 2017
  37. git-compat-util: make UNLEAK less error-proneJonathan Tan, Sep 19, 2017
  38. Jeff KingSep 19, 2017
  39. git-compat-util: make UNLEAK less error-proneJonathan Tan, Sep 19, 2017
  40. Junio C HamanoSep 20, 2017
  41. Jeff KingSep 20, 2017
  42. Junio C HamanoSep 20, 2017

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.