Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!brutus.cs.uiuc.edu!wuarchive!wugate!uunet!virtech!cpcahil From: cpcahil@virtech.UUCP (Conor P. Cahill) Newsgroups: comp.unix.xenix Subject: Re: Linking directories on Xenix??? Message-ID: <1032@virtech.UUCP> Date: 19 Aug 89 21:31:17 GMT References: <1114@ispi.UUCP> Organization: Virtual Technologies Inc Lines: 41 In article <1114@ispi.UUCP>, jbayer@ispi.UUCP (Jonathan Bayer) writes: > > I have a need to be able to link a directory to another directory. I > know that it normally is not possible, but I was wondering if there was > a way to fool the OS into linking a directory to another? Normally the super-user can link directories (note that the .. in the current directory is a link to the . in the parent directory), so that should solve your problem. (The /etc/mvdir shell that is usefull only for root uses this feature). A side issue is that having linked directories that are not in the normal child/parent relationship can wreck havoc on your backups if the backup utilities are not designed to handle this situation. The find(1) utility (which is part of lots of backup utilities) does not correctly handle this situation because of the way it traverses the directory structure. As it processes sub-directories, find changes to the child directory and when finished changes to "..". If you link a directory to another place where it has a different parent directory, when find changes to ".." it will go to the true parent. For example: you link /etc to /usr/rootdir/etc if you cd to /usr/rootdir/etc and cd .. you will be in / if you cd to /usr/rootdir/etc/.. you will also be in / > is here because I have a program that for safety's sake must run > chroot'ed in a directory, but also has to have access to the standard > /etc directory, and has to be able to create files in /etc that will be > there later. Another solution would be to copy all modified /etc files into the local etc directory, run the chrooted program, and copy back out all modified etc files. Inefficient, but it works (unless, of course, you need the modified files to be placed into /etc immediately).