Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!ginosko!uunet!pyrdc!isi!mike From: mike@isi.UUCP (Mike Maloney) Newsgroups: comp.unix.wizards Subject: How does 'mv' rename directories? Message-ID: <544@isi.UUCP> Date: 13 Sep 89 15:24:52 GMT Organization: Integral Systems, Inc., Lanham MD Lines: 27 Dear wizards, I was recently trying to figure out why the 'mv' command on a Microport System V box would refused to rename directories. The commands cd mkdir junk mv junk junk2 would elicit the response: mv: cannot link 'junk' and 'junk2'. (No, 'junk2' did not already exist.) The same commands would work fine on another system RUNNING THE SAME OPERATING SYSTEM! I suspect that it is something subtle to do with permissions. But anyway, this led me to wonder how the 'mv' command can rename directories at all. The Rochkind book shows an implementation of 'mv' using link() and unlink(). If the target path is a directory it first checks to see if it already exists, and if it does, fails. If I understand him correctly, his version of 'mv' must have the Set-UID bit set and be owned be root because only processes with an effective UID of root can link directories. But on Microport, Xenix, and Sun Unix 4.0, /bin/mv is -rwxr-xr-x and is owned by 'bin'. How is 'mv' able to rename directories on a properly working system? -- Mike Maloney Integral Systems, Inc (301) 731-4233 5000 Philadelpha Way, Suite A, Lanham, MD 20706