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

Re: [GSoC][RFC] Replace use of atoi() with strtol_i(), as a microproject

From
Mohit Marathe <mohitmarathe@proton.me>
Date
Jan 12, 2024, 13:04 UTC
Message-ID
<N4StHAGzqHVGHJxcPqm6LviErWK3vILDzmedr0WVcNyjprnEh4PgVUXk3LufOjO90wMZKqAeujSdzKa2OJx_uTvEzK0bSk_QdFDwggZAjnk=@proton.me>
In-Reply-To
<xmqqa5pdav04.fsf@gitster.g>
 > > I took a closer look at `builtin/patch-id.c` and it seems replacing
Show 18 quoted lines
> > `atoi()` (which is used to parse numbers in the hunk header) wouldn't
> > improve anything, unless I'm missing something.
> 
> 
> You can of course notice an invalid patch that places non-digit to
> the hunk header and error out with such a change. If we are reading
> output from Git that we are invoking, hopefully we will not see such
> an invalid patch, but the command is designed to read arbitrary
> input like a patch e-mail you received over the network, so I do not
> think it is fair to say there is no merit to such a change, even
> though I agree that it may not matter all that much.
> 
> A corrupt patch may be getting a nonsense patch-ID with the current
> code and hopefully is not matching other patches that are not
> corrupt, but with such a change, a corrupt patch may not be getting
> any patch-ID and a loop that computes patch-ID for many files and
> try to match them up might need to be rewritten to take the new
> failure case into account.

Oh, I didn't know corrupt patches were a thing. I will start working on the patch for this.

Previous: Junio C HamanoNext: Mohit Marathe
Message 7 of 8 in “[GSoC][RFC] Replace use of atoi() with strtol_i(), as a microproject”
  1. mohitmarathe@proton.meJan 8, 2024
  2. Christian CouderJan 9, 2024
  3. Mohit MaratheJan 10, 2024
  4. rsbecker@nexbridge.comJan 10, 2024
  5. Junio C HamanoJan 10, 2024
  6. Junio C HamanoJan 10, 2024
  7. Mohit MaratheJan 12, 2024
  8. Mohit MaratheJan 17, 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.