Symlinks already present

Eryk Sun eryksun at gmail.com
Tue Sep 1 14:55:23 EDT 2020


On 9/1/20, Chris Angelico <rosuav at gmail.com> wrote:
>
> Also, even if all that could be solved, I don't like the idea that
> reading the same directory from two different sources leads to
> different results. Is it really the same directory if reading it in
> different ways gives different results?

What's your take on the following example in Linux?

"test2/spam" is a bind mount for "test1/spam", and note that `mount
--bind` in Linux is a namespace operation, i.e. it's not a new device:

    >>> os.lstat('test1/spam').st_dev == os.lstat('test2/spam').st_dev
    True
    >>> os.lstat('test1/spam').st_ino == os.lstat('test2/spam').st_ino
    True

According to POSIX (st_dev, st_ino), it's the same directory, yet the
".." entry evaluates depending on the path parsing context:

    >>> os.lstat('test1/spam/..').st_ino == os.lstat('test1').st_ino
    True
    >>> os.lstat('test2/spam/..').st_ino == os.lstat('test2').st_ino
    True


More information about the Python-list mailing list