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

Re: [Outreachy PATCH v2 1/2] gpg-interface: replace strbuf_split_max() with string_list_split()

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 17, 2025, 18:47 UTC
Message-ID
<xmqqv7kdz7pn.fsf@gitster.g>
In-Reply-To
<CAP8UFD1FMwrBxbZ6Ck8JwBPBOAhB039US6pHSTusb6qzW=crpg@mail.gmail.com>
Christian Couder <christian.couder@gmail.com> writes:
Show 11 quoted lines
> It seems to me that fingerprint_stdout should contain something like:
>
> 4096 SHA256:PelI2esT2xZlv20wJJyYOkQsli5RMK79oJ2VxqYb2PA
> christian.couder@gmail.com (RSA)
>
> and it looks like the 'key_size fingerprint_hash:fingerprint comment
> (key_type)' format is the standard `ssh-keygen -l` output.
>
> So I think it's safe to say that we should expect
> `string_list_split(..., 2)` to return 3. That should work even if
> there is no comment in the key file.

I do not know why you or anybody can think it is safe from what you observed above, though. Who or which page of what manual told us that the key owner's identity part cannot be missing?

> But on the other hand, I think it's also acceptable to say that we
> just want to keep the same behavior as the original code and check its
> return value with `> 1` since we only need the second element
> resulting from the split.

Yes, as a code clean-up topic, I think it is the *only* acceptable thing to do. Finding the source to justify tightening of the rule to validate data to insist we have to see 3 pieces can be left to a separate topic once this series settles.

Thanks.
Previous: Bello OlamideNext: Bello Olamide
Message 6 of 10 in “gpg-interface.c: use string_list_split() instead of strbuf_split_max()”
  1. 0/2 gpg-interface.c: use string_list_split() instead of strbuf_split_max()Olamide Caleb Bello, Oct 16, 2025
  2. 1/2 gpg-interface: replace strbuf_split_max() with string_list_split()Olamide Caleb Bello, Oct 16, 2025
  3. Junio C HamanoOct 16, 2025
  4. Christian CouderOct 17, 2025
  5. Bello OlamideOct 17, 2025
  6. Junio C HamanoOct 17, 2025
  7. Bello OlamideOct 17, 2025
  8. 2/2 gpg-interface: use string_list_split() instead of strbuf_split_max()Olamide Caleb Bello, Oct 16, 2025
  9. Christian CouderOct 17, 2025
  10. Bello OlamideOct 17, 2025

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.