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

Re: Fw: Null deref in recursive merge in df73af5f667a479764d2b2195cb0cb60b0b89e3d

From
Clemens Buchacher <drizzd@aon.at>
Date
Jul 29, 2009, 16:10 UTC
Message-ID
<20090729161030.GA3848@localhost>
In-Reply-To
<D5F958F92101F74D8A5683C2FE14F4200F23102F@post.corp.w3data.com>
Hi,

On Tue, Jul 28, 2009 at 03:23:00PM -0700, Josh ben Jore wrote: [...]

Show 5 quoted lines
>   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)
[...]
Show 9 quoted lines
>   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
Previous: Junio C HamanoNext: Josh ben Jore
Message 7 of 11 in “Fw: Null deref in recursive merge in df73af5f667a479764d2b2195cb0cb60b0b89e3d”
  1. Josh ben JoreJul 28, 2009
  2. Josh ben JoreJul 29, 2009
  3. Junio C HamanoJul 30, 2009
  4. Josh ben JoreJul 30, 2009
  5. Junio C HamanoJul 30, 2009
  6. merge-recursive: don't segfault while handling rename clashesJunio C Hamano, Jul 31, 2009
  7. Clemens BuchacherJul 29, 2009
  8. Josh ben JoreJul 29, 2009
  9. Junio C HamanoJul 30, 2009
  10. Johannes SchindelinJul 30, 2009
  11. Fredrik KuivinenAug 18, 2009

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.