PATCH: Issue 1617: 'svn status' segfault
From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2003-12-06 22:19:06 CET
"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
Fix a segmentation fault on "svn status .." when "." is a WC but ".." is not.
* subversion/include/svn_path.h
* subversion/libsvn_client/status.c
Index: subversion/include/svn_path.h
---------------------------------------------------------------------
|
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.