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

Re: [PATCH/RFC] builtin/tag.c: move PGP verification inside builtin.

From
STSantiago Torres <torresariass@gmail.com>
Date
Mar 24, 2016, 22:24 UTC
Message-ID
<20160324222451.GD8830@LykOS>
In-Reply-To
<20160324221020.GA17805@sigill.intra.peff.net>
Show 6 quoted lines
> I know you are just copying this from the one in builtin/verify-tag.c,
> but I find the use of "size" and "len" for two different purposes
> confusing. Those words are synonyms, so how do the variables differ?
> 
> Perhaps "payload_size", or "signature_offset" would be a better term for
> "len".
I agree, I'll give this a go.
Show 7 quoted lines
> 
> > +	if (size == len) {
> > +		write_in_full(1, buf, len);
> > +	}
> 
> If the two are the same, we have no signature. Should we be returning
> early, and skipping check_signature() in that case?

This makes sense, for both the builtin and the plumbing. Let me give this a try.

 
Show 15 quoted lines
> > @@ -104,13 +125,24 @@ static int delete_tag(const char *name, const char *ref,
> >  static int verify_tag(const char *name, const char *ref,
> >  				const unsigned char *sha1)
> >  {
> > -	const char *argv_verify_tag[] = {"verify-tag",
> > -					"-v", "SHA1_HEX", NULL};
> 
> So the original was passing "-v" to verify-tag. That should put
> GPG_VERIFY_VERBOSE into the flags field. But later:
> 
> > +	ret = run_gpg_verify(buf, size, 0);
> 
> We don't pass any flags. Shouldn't this unconditionally pass
> GPG_VERIFY_VERBOSE?
> 
Right, I missed this. Sorry about this.
Show 6 quoted lines
> All of this seems like a repetition of verify_tag() in
> builtin/verify-tag.c (and ditto with run_gpg_verify()). Can we move
> those functions into tag.c and just call them from both places, or is
> there some difference that needs to be taken into account (and if the
> latter, can we refactor them to account for the differences?).
> 

Yep, this is what was troubling me (as I mentioned on the followup). I didn't want to remove the "static" classifier for the function (as there could be a major reason for this decision).

If this last chage is ok with you I can send the fixed-up version right away.

Thanks! -Santiago.

Previous: Jeff King
Message 7 of 7 in “builtin/tag.c: move PGP verification inside builtin.”
  1. builtin/tag.c: move PGP verification inside builtin.santiago@nyu.edu, Mar 24, 2016
  2. Santiago TorresMar 24, 2016
  3. Jeff KingMar 24, 2016
  4. Santiago TorresMar 24, 2016
  5. Jeff KingMar 24, 2016
  6. Jeff KingMar 24, 2016
  7. Santiago TorresMar 24, 2016

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.