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

Re: git 2.2.2 annotate crash (strbuf.c:32)

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 9, 2015, 20:50 UTC
Message-ID
<xmqq7fvqbyhw.fsf@gitster.dls.corp.google.com>
In-Reply-To
<20150209184612.GA4327@flurp.local>
Eric Sunshine <sunshine@sunshineco.com> writes:
> There is a bit of suspicious code in builtin/blame.c where it is
> destroying the commit_info without ever initializing it,...
Good eyes.  I wonder why the compiler does not notice it.

It seems that this came from ea02ffa3 (mailmap: simplify map_user() interface, 2013-01-05) and dates back to 1.8.2 or so.

Show 37 quoted lines
> diff --git a/builtin/blame.c b/builtin/blame.c
> index 303e217..a3cc972 100644
> --- a/builtin/blame.c
> +++ b/builtin/blame.c
> @@ -2085,7 +2085,6 @@ static void find_alignment(struct scoreboard *sb, int *option)
>  
>  	for (e = sb->ent; e; e = e->next) {
>  		struct origin *suspect = e->suspect;
> -		struct commit_info ci;
>  		int num;
>  
>  		if (compute_auto_abbrev)
> @@ -2096,6 +2095,7 @@ static void find_alignment(struct scoreboard *sb, int *option)
>  		if (longest_file < num)
>  			longest_file = num;
>  		if (!(suspect->commit->object.flags & METAINFO_SHOWN)) {
> +			struct commit_info ci;
>  			suspect->commit->object.flags |= METAINFO_SHOWN;
>  			get_commit_info(suspect->commit, &ci, 1);
>  			if (*option & OUTPUT_SHOW_EMAIL)
> @@ -2104,6 +2104,7 @@ static void find_alignment(struct scoreboard *sb, int *option)
>  				num = utf8_strwidth(ci.author.buf);
>  			if (longest_author < num)
>  				longest_author = num;
> +			commit_info_destroy(&ci);
>  		}
>  		num = e->s_lno + e->num_lines;
>  		if (longest_src_lines < num)
> @@ -2113,8 +2114,6 @@ static void find_alignment(struct scoreboard *sb, int *option)
>  			longest_dst_lines = num;
>  		if (largest_score < ent_score(sb, e))
>  			largest_score = ent_score(sb, e);
> -
> -		commit_info_destroy(&ci);
>  	}
>  	max_orig_digits = decimal_width(longest_src_lines);
>  	max_digits = decimal_width(longest_dst_lines);
Previous: Dilyan Palauzov
Message 7 of 7 in “git 2.2.2 annotate crash (strbuf.c:32)”
  1. Dilyan PalauzovFeb 8, 2015
  2. Jeff KingFeb 9, 2015
  3. Eric SunshineFeb 9, 2015
  4. Dilyan PalauzovFeb 9, 2015
  5. Eric SunshineFeb 9, 2015
  6. Dilyan PalauzovFeb 9, 2015
  7. Junio C HamanoFeb 9, 2015

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.