[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: tree conflicts: segfault in merge_dir_opened()

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Tue, 19 Aug 2008 00:17:53 +0100

On Sat, 2008-08-16 at 04:33 +0200, Neels Janosch Hofmeyr wrote:
> Hi tree-conflicts folks,

Hi Neels! It's great to have you helping out here!

> I discovered this case while writing a new set of tests for tree
> conflict detection, which tests for both file and directory victims in
> tree structures of various depths.

Excellent. That is a set of cases I haven't written tests for.

> I am faced with a segmentation fault in
>
> libsvn_client/merge.c: merge_dir_opened()
>
> when it is passed an adm_access == NULL.
>
> This occurs when a merge tries to add a file to a *directory* that
> existed in a common ancestry, but was deleted on the local branch.
>
> First, in subversion/libsvn_client/repos_diff.c, open_directory() looks
> up this previously deleted directory, using get_path_access(). It yields
> an adm_access == NULL, which is passed to merge_dir_opened().
>
> On trunk, merge_dir_opened() is empty. No segmentation fault occurs.
>
> On the tree-conflicts branch, merge_dir_opened() contains tree conflict
> detection code, which dereferences adm_access (== NULL).

> If I fix the first segmentation fault, the subsequent call to
> tree_conflict() causes another segmentation fault, since it too
> dereferences adm_access.

Right. This is a set of cases that is not yet handled.

Basically, what needs to happen is: inside a directory that is a
tree-conflict victim, all further diff-editor calls must be suppressed.

The call to tree_conflict() here is trying to raise a conflict on a
victim "DD/D1/D2" that is a child of a directory "DD/D1" that does not
exist locally. That is wrong. The conflict is between the incoming
"DD/D1" directory tree having been modified, and the local "DD/D1"
directory tree having been deleted.

This call to merge_dir_deleted() should do nothing, by means of code
that says something like:

merge_dir_deleted(...)
{
  if (this dir is inside a tree conflict that we've already raised)
    ignore this dir, and make sure all nested calls ignore it too;
  else
    the tree-conflict detection code that we already have;
}

And all other diff_callbacks methods need a similar check as well.

Does that make sense?

- Julian

> The segmentation fault occurs in merge_tests.py:101,
> subtest local_tree_del_incoming_leaf_edit.
>
> It occurs when calling svn_wc_entry with parameter adm_access==NULL,
> when trying to merge the addition of the file
>
> DD/D1/D2/epsilon
>
> , while in the local working copy, on another branch sharing ancestry,
> a removal of DD/D1 has been committed.
>
> It occurs while trying to get adm_access information on DD/D1/D2.
>
> My guess is that adm_access becomes NULL since neither D2 nor its parent
> D1 are present on the branch.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-08-19 01:18:17 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.