Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!brl-tgr!tgr!phil@RICE.ARPA From: phil@RICE.ARPA (William LeFebvre) Newsgroups: net.unix-wizards Subject: Re: inode number -> pathname? (4.2BSD) Message-ID: <11503@brl-tgr.ARPA> Date: Thu, 11-Jul-85 14:27:54 EDT Article-I.D.: brl-tgr.11503 Posted: Thu Jul 11 14:27:54 1985 Date-Received: Sat, 13-Jul-85 11:01:06 EDT Sender: news@brl-tgr.ARPA Lines: 46 > Ahh! Now you changed the rules! (and only want directories). You could > backtrack thru .. which is what pwd does but it still is a bit irksome, I did not change the rules! The original article stated: "I am looking for a good way to generate the full path name of a directory..." Looks to me like he said "path name of a directory". As I said in my previous message, this problem is much, much harder to solve for any arbitrary file. > By the way, UNIX does not limit a directory to have a unique pathname, > but rmdir, mvdir, ln, and mkdir try to make it look like it does. If > you are superuser and write your own little C program you can make > extra links to a directory. It is true that the Unix *kernel* does not limit directories to a single pathname. Neither does the kernel require the two filenames "." and ".." to be the first two names in a directory. Nor does it require that file descriptors 0, 1, and 2 be used for standard input, output, and error, respectively. Yet all three of these characteristics are considered to be part of the overall Unix system. They are conventions that should be adhered to. Are you claiming that "rmdir, mvdir, ln, and mkdir" are not part of Unix? Clarification: the "mkdir" system call does make "." and ".." in the directory it creates. But "mknod" with the right bits doesn't. And under 4.1, "mv" was setuid to root so that directories could be moved. The only way to move them was by linking and unlinking them, and only root can do that. There was no "rename" call in 4.1. BUT the kernel doesn not require that a directory always have "." and "..". Root can easily unlink them! Yes you can have five different names all pointing to the same directory inode, but ".." can only point back to one of them. And if you really are crazed enough to do this, you had better make sure your Unix system never crashes again, because "fsck" will get gastric distress trying to digest the spaghetti file system it will find. Urp! Such a file system is just really disagreeable to many parts of Unix, even though the kernel lets you get away with it. See? I know my Unix. William LeFebvre Department of Computer Science Rice Universityor, for the daring: