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

problem in unpack-trees.c

From
RZRoman Zippel <zippel@linux-m68k.org>
Date
Dec 3, 2006, 01:21 UTC
Message-ID
<Pine.LNX.4.64.0612022125530.1867@scrub.home>
Hi,

Git currently fails to succeed the tests as you can see here: http://buildd.debian.org/fetch.cgi?&pkg=git-core&ver=1%3A1.4.4-2&arch=m68k&stamp=1164303729&file=log

I looked into it and the problem is during the "git-read-tree --reset" step and it seems that the local df_conflict_entry variable of unpack_trees() survives past that function. If you check in add_cache_entry() it's called with this variable and only because verify_path() fails it's not added to the tree on the other archs, but on m68k the data on the stack is a bit different and thus verify_path() succeeds and the stack variable is added to the tree and later saved.

Using the patch below, you can simulate what's happing on m68k and now I need some help fixing this properly, as I'm not that familiar with the internals. Thanks.

bye, Roman

diff -ur git-core-1.4.4.1/unpack-trees.c git-core-1.4.4.1/unpack-trees.c --- git-core-1.4.4.1/unpack-trees.c 2006-11-23 03:38:07.000000000 +0100 +++ git-core-1.4.4.1/unpack-trees.c 2006-12-03 01:54:04.000000000 +0100

@@ -370,7 +370,10 @@
 	int i;
 	struct object_list *posn = trees;
 	struct tree_entry_list df_conflict_list;
-	struct cache_entry df_conflict_entry;
+	static struct {
+		struct cache_entry entry;
+		char name[4];
+	} df_conflict_entry;
 
 	memset(&df_conflict_list, 0, sizeof(df_conflict_list));
 	df_conflict_list.next = &df_conflict_list;
@@ -382,7 +385,8 @@
 
 	o->merge_size = len;
 	memset(&df_conflict_entry, 0, sizeof(df_conflict_entry));
-	o->df_conflict_entry = &df_conflict_entry;
+	o->df_conflict_entry = &df_conflict_entry.entry;
+	df_conflict_entry.entry.name[0] = 'x';
 
 	if (len) {
 		posns = xmalloc(len * sizeof(struct tree_entry_list *));
@@ -399,6 +403,7 @@
 		die("Merge requires file-level merging");
 
 	check_updates(active_cache, active_nr, o);
+	memset(&df_conflict_entry, 0x11, sizeof(df_conflict_entry));
 	return 0;
 }
Next: Junio C Hamano
Message 1 of 4 in “problem in unpack-trees.c”
  1. Roman ZippelDec 3, 2006
  2. Junio C HamanoDec 4, 2006
  3. Junio C HamanoDec 4, 2006
  4. Roman ZippelDec 4, 2006

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.