On Tue, Sep 1, 2020 at 5:08 AM Richard Damon <rich...@damon-family.org> wrote: > The file descriptor could remember the path used to get to it. chroot > shows that .. needs to be somewhat special, as it needs to go away for > anyone that . is their current root.
But my point is that there might not actually *be* a valid path that gets you to a file descriptor. It can't remember something that doesn't exist. (And it's pretty impractical to do that even if it does.) > I see no problem with it being a hardlink, and in fact, executables know > the name they were executed by, so directories knowing the path isn't > that different. Actually no, they don't. They are all taught, and being taught, believe, that their first argument is their name. > The key differnce between a hardlink and a symlink is > that hardlinks maintain existance, and always point to something that > exists (things know how many hardlinks refer to them). symlinks don't > reference the actual file object, but the symbolic path to it, which may > or may not actually exist, and who doesn't know such a link exists. Symlinks refer to a path, which may be relative. Hardlinks refer to an inode (or whatever other way you choose to identify an actual file's contents). It's entirely possible to have an open file or directory that no longer has any actual path referring to it; in fact, things don't know how many hardlinks refer to them, just how many references there are. ChrisA -- https://mail.python.org/mailman/listinfo/python-list