Prev: ANN: expy 0.6.7 released!
Next: long int computations
From: Nobody on 4 May 2010 09:39 On Tue, 04 May 2010 20:08:36 +1200, Gregory Ewing wrote: >> except that Python objects can form a generalized graph, and Unix >> filesystems are constrained to be a tree. > > Actually I believe that root is allowed to create arbitrary hard links to > directories in Unix, so it's possible to turn the file system in to a > general graph. It's highly unrecommended, though, because it confuses the > heck out of programs that recursively traverse directories (which is why > only root is allowed to do it). The 1980s are over already ;) I don't know of any modern Unix which allows creating additional hard links to directories (even for root). It creates too many problems, and isn't necessary if you have symlinks. If you want to turn the filesystem into a cyclic graph, you typically need to bypass the kernel's filesystem interface and modify the block device directly (e.g. with debugfs). If fsck finds out, it's likely to fix it.
From: Baz Walter on 4 May 2010 09:48 On 04/05/10 09:08, Gregory Ewing wrote: > Grant Edwards wrote: > >> except that Python objects can form a generalized graph, and Unix >> filesystems are constrained to be a tree. > > Actually I believe that root is allowed to create arbitrary > hard links to directories in Unix, so it's possible to turn > the file system in to a general graph. It's highly > unrecommended, though, because it confuses the heck out of > programs that recursively traverse directories (which is > why only root is allowed to do it). i think there are versions of mac osx that use hard-linked directories in their backup systems.
From: Grant Edwards on 4 May 2010 10:55 On 2010-05-04, Gregory Ewing <greg.ewing(a)canterbury.ac.nz> wrote: > Grant Edwards wrote: > >> except that Python objects can form a generalized graph, and Unix >> filesystems are constrained to be a tree. > > Actually I believe that root is allowed to create arbitrary > hard links to directories in Unix, I know that used to be the case in SunOS (as I found out the hard way), but I've been told by Solaris experts that it is no longer allowed. I was also under the impression that it wasn't allowed in Linux, but I've never tried it. According the the Linux ln (1) man page: -d, -F, --directory allow the superuser to attempt to hard link directories (note: will probably fail due to system restrictions, even for the superuser) > so it's possible to turn the file system in to a general graph. It's > highly unrecommended, though, because it confuses the heck out of > programs that recursively traverse directories (which is why only > root is allowed to do it). It sure caused trouble when I did it on a SunOS system back in the day (1990 or thereabouts). -- Grant Edwards grant.b.edwards Yow! I feel like I'm at in a Toilet Bowl with a gmail.com thumbtack in my forehead!!
From: Nobody on 4 May 2010 19:44 On Tue, 04 May 2010 14:36:06 +0100, Baz Walter wrote: > this will work so long as the file is in a part of the filesystem that can > be traversed from the current directory to the root. what i'm not sure > about is whether it's possible to cross filesystem boundaries using this > kind of technique. At least on Linux, the kernel "fixes" the links at mount points, i.e. within the root directory of a mounted filesystem, ".." refers to the directory containing the mount point on the parent filesystem, while the mount point refers to the root directory of the mounted filesystem. This also appears to work correctly for bind mounts (mounting an arbitrary directory to another directory, which results in a directory hierarchy appearing at multiple locations within the filesystem), i.e. ".." refers to the appropriate directory for each "instance". OTOH, the algorithm can fail if a directory is moved (whether by rename() or remounting) between the stat("..") and the listdir().
From: Cameron Simpson on 4 May 2010 20:10
On 04May2010 14:48, Baz Walter <bazwal(a)ftml.net> wrote: | On 04/05/10 09:08, Gregory Ewing wrote: | >Grant Edwards wrote: | >>except that Python objects can form a generalized graph, and Unix | >>filesystems are constrained to be a tree. | > | >Actually I believe that root is allowed to create arbitrary | >hard links to directories in Unix, so it's possible to turn | >the file system in to a general graph. It's highly | >unrecommended, though, because it confuses the heck out of | >programs that recursively traverse directories (which is | >why only root is allowed to do it). | | i think there are versions of mac osx that use hard-linked | directories in their backup systems. I believe TimeMachine exploits that. I think one can make loops with recursive mounts. -- Cameron Simpson <cs(a)zip.com.au> DoD#743 http://www.cskk.ezoshosting.com/cs/ You can't go around hoping that most people have sterling moral characters. The most you can hope for is that people will pretend that they do. - Fran Lebowitz |