Re: Fw: Null deref in recursive merge in df73af5f667a479764d2b2195cb0cb60b0b89e3d
From: Clemens Buchacher <hidden>
Date: 2016-06-15 22:47:07
Subsystem:
the rest · Maintainer:
Linus Torvalds
Hi, On Tue, Jul 28, 2009 at 03:23:00PM -0700, Josh ben Jore wrote: [...]
CONFLICT (rename/add): Rename config/conf/target/dev-ubuntu/wpn_rails/appserver.yml->config/conf/target/dev/wpn_rails/appserver.yml in Temporary merge branch 1. config/conf/target/dev/wpn_rails/appse2 Adding as config/conf/target/dev/wpn_rails/appserver.yml~Temporary merge branch 2 instead Skipped config/conf/target/dev/wpn_rails/appserver.yml (merged same as existing)
[...]
There are unmerged index entries: 2 config/conf/target/dev/wpn_rails/appserver.yml 3 config/conf/target/dev/wpn_rails/appserver.yml Merging: virtual merged tree e4a886b Adding legacy click log processing scripts found 1 common ancestor(s): 09fb055 Merge commit 'rel_090630_prod_02' Segmentation fault
Yeah, if process_entry leaves unmerged entries, write_tree_from_memory will return NULL. I can reproduce with the following script (same principle as t7405). Clemens ---
diff --git a/t/t6035-merge-recursive-ra.sh b/t/t6035-merge-recursive-ra.sh
new file mode 100755
index 0000000..15f2c7d
--- /dev/null
+++ b/t/t6035-merge-recursive-ra.sh@@ -0,0 +1,59 @@ +#!/bin/sh + +test_description='test recursive merge with rename/add conflicts' + +. ./test-lib.sh + +# +# history +# +# a --- c +# / \ / +# root X +# \ / \ +# b --- d +# + +test_expect_success setup ' + + : >src && + git add src && + test_tick && + git commit -m root && + + git checkout -b a master && + git mv src dst + test_tick && + git commit -m a && + + git checkout -b b master && + : >dst && + git add dst && + test_tick && + git commit -m b + + git checkout -b c a && + git merge -s ours b && + + git checkout -b d b && + git merge -s ours a +' + +test_expect_success 'merging with rename/add conflict' ' + + git checkout -b test1 a && + test_must_fail git merge b && + test -f .git/MERGE_MSG && + git diff && + test -n "$(git ls-files -u)" +' + +test_expect_success 'merging with a rename/add conflict between merge bases' ' + + git reset --hard HEAD && + git checkout -b test2 c && + git merge d + +' + +test_done
--
1.6.3.1