You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Julian Foad <ju...@btopenworld.com> on 2003/12/06 21:19:06 UTC

PATCH: Issue 1617: 'svn status' segfault

"svn status .." seg-faults if "." is a WC but ".." is not.  The reason is that "svn_path_dirname" or (in this case) "svn_path_split" is assumed to return the parent of a path, and this assumption is false when the path ends in "..".

The attached patch solves this case, but it really doesn't go far enough.  There are many other such cases.

My solution is to introduce an alternative to "svn_path_split", called "svn_parent_path_split", which guarantees to return the parent directory rather than just a truncated path string.  I would probably also introduce similar alternatives to "svn_path"dirname" and "svn_path_basename".  In the long run I think we need to review all uses of these functions and see whether they really want the truncated string or the actual parent.

It may turn out that all callers really want the parent, in which case we can simply modify "svn_path_split" and friends instead of introducing new functions.

Does this patch look like a reasonable fix for this particular bug and a suitable starting point for fixing further cases?  I'm not quite sure, because it works by converting a relative path to an absolute one when necessary, and this may not be appropriate in all cases.  It at least avoids the intrusion of converting all user paths to absolute which would probably be unacceptably ugly.

An alternative would be to form the parent path by appending ".." but to do a private conversion to absolute in order to retrieve the appropriate base name of the child.

- Julian