Fix #271: properly resolve symlinks in all paths (#329)

I've replaced all instances in the code of `os.path.abspath`
with `os.path.realpath`, as this does the same as `abspath`
plus resolving symlinks.
See also: https://stackoverflow.com/a/40311142
This commit is contained in:
Oliver Smith 2017-08-15 14:08:48 +00:00 committed by GitHub
parent 2f8d589ed6
commit ff9f2d620f
19 changed files with 24 additions and 24 deletions

View file

@ -25,7 +25,7 @@ def ismount(folder):
Ismount() implementation, that works for mount --bind.
Workaround for: https://bugs.python.org/issue29707
"""
folder = os.path.abspath(os.path.realpath(folder))
folder = os.path.realpath(os.path.realpath(folder))
with open("/proc/mounts", "r") as handle:
for line in handle:
words = line.split()
@ -86,7 +86,7 @@ def umount_all_list(prefix, source="/proc/mounts"):
:returns: a list of folders, that need to be umounted
"""
ret = []
prefix = os.path.abspath(prefix)
prefix = os.path.realpath(prefix)
with open(source, "r") as handle:
for line in handle:
words = line.split()