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

Re: [PATCH] range-diff: support reading mbox files

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Nov 18, 2022, 11:39 UTC
Message-ID
<6590112p-1n6o-4413-n805-0pp6o9r1r3sn@tzk.qr>
In-Reply-To
<221117.86leo9h20m.gmgdl@evledraar.gmail.com>
Hi Ævar,
On Thu, 17 Nov 2022, Ævar Arnfjörð Bjarmason wrote:
Show 34 quoted lines
>
> On Tue, Nov 15 2022, Johannes Schindelin via GitGitGadget wrote:
>
> > +		if (starts_with(line, "diff --git ")) {
> > +			struct patch patch = { 0 };
> > +			struct strbuf root = STRBUF_INIT;
> > +			int linenr = 0;
> > +			int orig_len;
> > +
> > +			state = MBOX_IN_DIFF;
> > +			old_count = new_count = 0;
> > +			strbuf_addch(&buf, '\n');
> > +			if (!util->diff_offset)
> > +				util->diff_offset = buf.len;
> > +			line[len - 1] = '\n';
> > +			orig_len = len;
> > +			len = parse_git_diff_header(&root, &linenr, 1, line,
> > +						    len, size, &patch);
>
> Try this with SANITIZE=leak, e.g. this seems to fix 1/4 leaks that pop
> up if you try the command noted in the patch:
>
> 	diff --git a/range-diff.c b/range-diff.c
> 	index 77fa9b970b1..7ff33f92e39 100644
> 	--- a/range-diff.c
> 	+++ b/range-diff.c
> 	@@ -142,6 +142,7 @@ static int read_mbox(const char *path, struct string_list *list)
> 	 			orig_len = len;
> 	 			len = parse_git_diff_header(&root, &linenr, 1, line,
> 	 						    len, size, &patch);
> 	+			free(patch.def_name);
> 	 			if (len < 0) {
> 	 				error(_("could not parse git header '%.*s'"),
> 	 				      orig_len, line);
Thank you for keeping your feedback concise. Much appreciated.

This will be addressed in the next iteration, Johannes

Previous: Ævar Arnfjörð BjarmasonNext: Johannes Schindelin via GitGitGadget
Message 8 of 16 in “range-diff: support reading mbox files”
  1. range-diff: support reading mbox filesJohannes Schindelin via GitGitGadget, Nov 15, 2022
  2. Taylor BlauNov 16, 2022
  3. Phillip WoodNov 16, 2022
  4. Phillip WoodNov 17, 2022
  5. Johannes SchindelinNov 18, 2022
  6. Johannes SchindelinNov 18, 2022
  7. Ævar Arnfjörð BjarmasonNov 17, 2022
  8. Johannes SchindelinNov 18, 2022
  9. range-diff: support reading mbox filesJohannes Schindelin via GitGitGadget, Nov 19, 2022
  10. Phillip WoodNov 21, 2022
  11. Johannes SchindelinNov 22, 2022
  12. Phillip WoodNov 22, 2022
  13. range-diff: support reading mbox filesJohannes Schindelin via GitGitGadget, Nov 22, 2022
  14. Phillip WoodNov 22, 2022
  15. Junio C HamanoNov 22, 2022
  16. Junio C HamanoMar 3, 2023

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.