top | item 24797658

(no title)

mlaux | 5 years ago

> There is only one exception to the rule of identical treatment of files on different devices: no link may exist between one file system hierarchy and another. This restriction is enforced so as to avoid the elaborate bookkeeping which would otherwise be required to assure removal of the links when the removable volume is finally dismounted. In particular, in the root directories of all file systems, removable or not, the name .. refers to the directory itself instead of to its parent.

Is this saying that if I had a removable disk mounted at /mnt/foo and issued “cd ..” in that directory, I’d remain in /mnt/foo instead of moving up to /mnt? When did this change to the current behavior?

discuss

order

JdeBP|5 years ago

That is the current behaviour. And it's not saying what you state.

"no link" literally means no link. It's the straightforward meaning of (an ordinary, not symbolic) "link" in Unix filesystems. They cannot cross devices.

And on disc, ".." in the root is a link to the same directory. (POSIX allows for it to be this, which is the conventional Unix behaviour, or not to exist, which is the case on some non-Unix filesystems and operating systems where conceptually there is stuff "above" the root.)

Executing "cd .." ignores what is on disc at a mount point, and traverses the mount upwards.

Remember that "filesystem" has three meanings: the on-disc format of a DASD volume, the overall tree abstraction presented by the operating system, or what is presented by an FS driver.

aap_|5 years ago

Yes, that is case the early UNIX. it was changed to the current behaviour by the time V7 was released (1979).

kubanczyk|5 years ago

The `mount` is overloading /mnt/foo, and in a similar manner also overloading /mnt/foo/.. that's why.

If you examine an unmounted filesystem however, the raw /.. directory entry points to the same place as /. directory entry.

LeoPanthera|5 years ago

This reads to me as if the concept of "file system hierarchy" refers to multiple roots, which current unixes cannot have.

joshu|5 years ago

i think they mean you can't hardlink across devices. there is a single hierarchy but they have mount points.

mlaux|5 years ago

That makes so much more sense. I was thinking per-device instead of per-logical-root. Thank you!

chsasank|5 years ago

Great question. I never thought of this!