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

Re: [PATCH] tag: fix sign_buffer() call to create a signed tag

From
Jeff King <peff@peff.net>
Date
Feb 8, 2024, 20:26 UTC
Message-ID
<20240208202634.GA1090198@coredump.intra.peff.net>
In-Reply-To
<xmqq5xyzr6tm.fsf@gitster.g>
On Wed, Feb 07, 2024 at 07:08:37PM -0800, Junio C Hamano wrote:
Show 12 quoted lines
> > FWIW, I would have gone the other way, and fixed sign_buffer_ssh(). Your
> > solution here is future-proofing the tag code against other
> > sign_buffer_*() functions behaving like ssh. But it is also leaving
> > other sign_buffer() callers to introduce the same bug.
> >
> > Your documentation change at least makes that less likely. But given how
> > much of our code uses the "negative is error" convention, I wouldn't be
> > surprised to see it happen anyway.
> 
> Yeah, but other callers are prepared to honor the current return
> value convention used by gpg-interface, so "fixing" sign_buffer_ssh()
> would not give us any future-proofing.

It future-proofs against a hypothetical new sign_buffer() caller (just like your patch future-proofs against a hypothetical new signing backend).

Show 5 quoted lines
> We could do belt and suspenders by tightening the other callers to
> only expect negative for errors (but then what should they do when
> they receive non-zero positive?  Should they BUG() out???) while
> teaching sign_buffer_ssh() that our convention is to return negative
> for an error, of course, but I am not sure if it that is worth it.

I'm not sure that's worth it, since we'd only notice if the error triggered (so writing a test).

-Peff
Previous: Jeff King
Message 6 of 6 in “tag: fix sign_buffer() call to create a signed tag”
  1. tag: fix sign_buffer() call to create a signed tagJunio C Hamano, Feb 7, 2024
  2. Jeff KingFeb 8, 2024
  3. Junio C HamanoFeb 8, 2024
  4. Junio C HamanoFeb 8, 2024
  5. Jeff KingFeb 8, 2024
  6. Jeff KingFeb 8, 2024

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.