diff --git a/pym/cl_utils.py b/pym/cl_utils.py index 23a4ae1..497d8a2 100644 --- a/pym/cl_utils.py +++ b/pym/cl_utils.py @@ -617,6 +617,13 @@ def isMount(path): map(lambda x: [x[0], x[1]], map(lambda x: x.split(" "), open(mtabFile)))),[""]))[0] +def commonPath(*paths): + """Return common path from list of paths""" + paths = map(lambda x:os.path.abspath(x).split('/'),paths) + res = map(lambda x:x[0], + filter(lambda x:filter(lambda y:x[0]==y,x[1:]),zip(*paths))) + return "/".join(res) + def childMounts(path): """Get all mount points which contain path""" if path != "none": @@ -627,7 +634,8 @@ def childMounts(path): if not os.access(mtabFile,os.R_OK): return "" return reduce(lambda x,y: x + [y], - filter(lambda x: absPath in x[0] or absPath in x[1], + filter(lambda x: commonPath(absPath,x[0])==absPath or \ + commonPath(absPath,x[1])==absPath, map(lambda x: [x[0], x[1]], map(lambda x: x.split(" "), open(mtabFile)))),