threads / discuss / 43603

Re: git-merge-recursive segmentation error

Subject: Re: git-merge-recursive segmentation error

## tl;dr

4 messages between Dec 20, 2006 and Dec 20, 2006.

replies: 3people: 3as markdown or json

Linus Torvalds· Dec 20, 2006, 01:10 UTC · lore
On Tue, 19 Dec 2006, Luben Tuikov wrote:
>
> /home/luben/bin/git-merge: line 394: 12030 Segmentation fault      git-merge-$strategy $common -- "$head_arg" "$@"
> Merge with strategy recursive failed.
Can you run that by hand under gdb and get a backtrace?
Luben Tuikov· Dec 20, 2006, 02:15 UTC · re: Linus Torvalds · lore
--- Linus Torvalds <torvalds@osdl.org> wrote:
> Can you run that by hand under gdb and get a backtrace?
Linus,

Auto-merging init/Kconfig Auto-merging init/version.c

Program received signal SIGSEGV, Segmentation fault.
xdl_merge (orig=Variable "orig" is not available.
) at xdiff/xmerge.c:200
200                     t2.ptr = (char *)xe2->xdf2.recs[m->i2]->ptr;
(gdb) bt
#0  xdl_merge (orig=Variable "orig" is not available.
) at xdiff/xmerge.c:200
#1  0x000000000040322c in merge_file (o=0x7fffd4f762f0, a=0x7fffd4f76270, b=0x7fffd4f762b0,
branch1=0x7fffd4f77976 "HEAD", 
    branch2=0x7fffd4f7797b "cc016448b0bf0764928275d034e367753bde8162") at merge-recursive.c:667
#2  0x0000000000404e87 in merge_trees (head=0x12e4a00, merge=0x555328, common=0x555350,
branch1=Variable "branch1" is not available.
) at merge-recursive.c:1074
#3  0x0000000000405376 in merge (h1=0x5452f0, h2=0x545370, branch1=0x7fffd4f77976 "HEAD",
branch2=0x7fffd4f7797b "cc016448b0bf0764928275d034e367753bde8162", call_depth=0, 
    ancestor=0x5453f0, result=0x7fffd4f764e0) at merge-recursive.c:1245
#4  0x00000000004056a5 in main (argc=Variable "argc" is not available.
) at merge-recursive.c:1312

I also ran git-bisect twice over two well known but overlapping good-bad regions and I get the same commit as being the culprit. It seems to be commit 1510fea781cb0517eeba8c378964f7bc4f9577ab.

    Luben
Shawn Pearce· Dec 20, 2006, 02:32 UTC · re: Luben Tuikov · lore
Luben Tuikov <ltuikov@yahoo.com> wrote:
Show 30 quoted lines
> --- Linus Torvalds <torvalds@osdl.org> wrote:
> > Can you run that by hand under gdb and get a backtrace?
> 
> Linus,
> 
> Auto-merging init/Kconfig
> Auto-merging init/version.c
> 
> Program received signal SIGSEGV, Segmentation fault.
> xdl_merge (orig=Variable "orig" is not available.
> ) at xdiff/xmerge.c:200
> 200                     t2.ptr = (char *)xe2->xdf2.recs[m->i2]->ptr;
> (gdb) bt
> #0  xdl_merge (orig=Variable "orig" is not available.
> ) at xdiff/xmerge.c:200
> #1  0x000000000040322c in merge_file (o=0x7fffd4f762f0, a=0x7fffd4f76270, b=0x7fffd4f762b0,
> branch1=0x7fffd4f77976 "HEAD", 
>     branch2=0x7fffd4f7797b "cc016448b0bf0764928275d034e367753bde8162") at merge-recursive.c:667
> #2  0x0000000000404e87 in merge_trees (head=0x12e4a00, merge=0x555328, common=0x555350,
> branch1=Variable "branch1" is not available.
> ) at merge-recursive.c:1074
> #3  0x0000000000405376 in merge (h1=0x5452f0, h2=0x545370, branch1=0x7fffd4f77976 "HEAD",
> branch2=0x7fffd4f7797b "cc016448b0bf0764928275d034e367753bde8162", call_depth=0, 
>     ancestor=0x5453f0, result=0x7fffd4f764e0) at merge-recursive.c:1245
> #4  0x00000000004056a5 in main (argc=Variable "argc" is not available.
> ) at merge-recursive.c:1312
> 
> I also ran git-bisect twice over two well known but overlapping
> good-bad regions and I get the same commit as being the culprit.
> It seems to be commit 1510fea781cb0517eeba8c378964f7bc4f9577ab.
Oww, the finger points at me!  :-)

Hmm. 1510fe does not look right to me. That return 0 should only be activating when FAST_WORKING_DIRECTORY == 0, so you really want this patch below. Normally NO_FAST_WORKING_DIRECTORY is _not_ defined, which means FAST_WORKING_DIRECTORY == 1, and in that case the if should always be false and the compiler should be stripping the code out entirely.

What's odd is that the xdl_merge routine is crashing out because this code activated. It really should not have, so more work is still required...

diff --git a/diff.c b/diff.c
index 77ba641..1c1de11 100644
--- a/diff.c
+++ b/diff.c
@@ -1194,7 +1194,7 @@ static int reuse_worktree_file(const char *name, const unsigned char *sha1, int
 	 * objects however would tend to be slower as they need
 	 * to be individually opened and inflated.
 	 */
-	if (FAST_WORKING_DIRECTORY && !want_file && has_sha1_pack(sha1, NULL))
+	if (!FAST_WORKING_DIRECTORY && !want_file && has_sha1_pack(sha1, NULL))
 		return 0;
 
Luben Tuikov· Dec 20, 2006, 02:39 UTC · re: Shawn Pearce · lore
--- Shawn Pearce <spearce@spearce.org> wrote:
Show 45 quoted lines
> Luben Tuikov <ltuikov@yahoo.com> wrote:
> > --- Linus Torvalds <torvalds@osdl.org> wrote:
> > > Can you run that by hand under gdb and get a backtrace?
> > 
> > Linus,
> > 
> > Auto-merging init/Kconfig
> > Auto-merging init/version.c
> > 
> > Program received signal SIGSEGV, Segmentation fault.
> > xdl_merge (orig=Variable "orig" is not available.
> > ) at xdiff/xmerge.c:200
> > 200                     t2.ptr = (char *)xe2->xdf2.recs[m->i2]->ptr;
> > (gdb) bt
> > #0  xdl_merge (orig=Variable "orig" is not available.
> > ) at xdiff/xmerge.c:200
> > #1  0x000000000040322c in merge_file (o=0x7fffd4f762f0, a=0x7fffd4f76270, b=0x7fffd4f762b0,
> > branch1=0x7fffd4f77976 "HEAD", 
> >     branch2=0x7fffd4f7797b "cc016448b0bf0764928275d034e367753bde8162") at
> merge-recursive.c:667
> > #2  0x0000000000404e87 in merge_trees (head=0x12e4a00, merge=0x555328, common=0x555350,
> > branch1=Variable "branch1" is not available.
> > ) at merge-recursive.c:1074
> > #3  0x0000000000405376 in merge (h1=0x5452f0, h2=0x545370, branch1=0x7fffd4f77976 "HEAD",
> > branch2=0x7fffd4f7797b "cc016448b0bf0764928275d034e367753bde8162", call_depth=0, 
> >     ancestor=0x5453f0, result=0x7fffd4f764e0) at merge-recursive.c:1245
> > #4  0x00000000004056a5 in main (argc=Variable "argc" is not available.
> > ) at merge-recursive.c:1312
> > 
> > I also ran git-bisect twice over two well known but overlapping
> > good-bad regions and I get the same commit as being the culprit.
> > It seems to be commit 1510fea781cb0517eeba8c378964f7bc4f9577ab.
> 
> Oww, the finger points at me!  :-)
> 
> Hmm.  1510fe does not look right to me.  That return 0 should only
> be activating when FAST_WORKING_DIRECTORY == 0, so you really want
> this patch below.  Normally NO_FAST_WORKING_DIRECTORY is _not_
> defined, which means FAST_WORKING_DIRECTORY == 1, and in that case
> the if should always be false and the compiler should be stripping
> the code out entirely.
> 
> What's odd is that the xdl_merge routine is crashing out because
> this code activated.  It really should not have, so more work is
> still required...

Thanks. It is good to see that the solution patches are identical. That fixes the problem.

   Luben
Show 16 quoted lines
> 
> diff --git a/diff.c b/diff.c
> index 77ba641..1c1de11 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -1194,7 +1194,7 @@ static int reuse_worktree_file(const char *name, const unsigned char
> *sha1, int
>  	 * objects however would tend to be slower as they need
>  	 * to be individually opened and inflated.
>  	 */
> -	if (FAST_WORKING_DIRECTORY && !want_file && has_sha1_pack(sha1, NULL))
> +	if (!FAST_WORKING_DIRECTORY && !want_file && has_sha1_pack(sha1, NULL))
>  		return 0;
>  
>  	len = strlen(name);
> 

← back to recent threads