Michael Haggerty <mhag...@alum.mit.edu> writes:
> I think I would advocate that the prefix has to match the front of
> the path exactly (including any trailing slashes) and either
> strlen(prefix) == 0
> or the prefix ended with a '/'
> or the prefix and path are identical
> or the character in path following the matching part is a '/'
> This would allow the "is path its own prefix" policy to be decided by
> the caller by either including or omitting a trailing slash on the
> prefix argument.
I think that is sensible thing to do.
The primary thing I found questionable was that the function, given
"/net/wink/project/frotz" to check against "/pub:/s" (or "/pub/:/s/"
if you like), will report that "/net/wink/project" directory is the
longest ancestor, when "/s" is a symlink that happens to point at
"/net/wink/project". It is very counter-intuitive when you view its
two input strings as strings. By making its sole caller expand the
symbolic links, it would be a lot clearer what is going on to
anybody who follow the codepath. We have one path obtained from
getcwd() and a set of paths all of which are real paths without
symbolic aliasing, and we check if one among the latter cover
an earlier part of the former.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html