problem in unpack-trees.c

From: Roman Zippel <hidden>
Date: 2016-08-11 20:32:33

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;
 }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help