# the current working directory (from the shell).
mydir = os.environ["PWD"]
mydir = normalize_path(mydir)
-path_ids = set()
+path_ids = {}
p = mydir
s = None
while True:
s = os.stat(p)
- path_ids.add((s.st_dev, s.st_ino))
+ path_ids[(s.st_dev, s.st_ino)] = p
if p == "/":
break
p = os.path.dirname(p)
s = os.stat(overlay)
except OSError:
continue
- overlay_id = (s.st_dev, s.st_ino)
+ overlay = path_ids.get((s.st_dev, s.st_ino))
+ if overlay is None:
+ continue
if overlay[-1] != "/":
overlay += "/"
- if overlay_id in path_ids:
+ if True:
portdir_overlay = overlay
subdir = mydir[len(overlay):]
if subdir and subdir[-1] != "/":