Date: Thu, 27 May 2004 13:03:16 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: "Boucher, Eric" <eric.boucher@messier-dowty.com> Cc: freebsd-questions@freebsd.org Subject: Re: symbolic link cycling Message-ID: <20040527120316.GD9499@happy-idiot-talk.infracaninophile.co.uk> In-Reply-To: <8CD1D9DB65FBF540B06E79015F0DA1111886BD@mon-exch55-01.montreal.mdi.messier-dowty.snecma> References: <8CD1D9DB65FBF540B06E79015F0DA1111886BD@mon-exch55-01.montreal.mdi.messier-dowty.snecma>
next in thread | previous in thread | raw e-mail | index | archive | help
--Xm/fll+QQv+hsKip Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 27, 2004 at 07:12:02AM -0400, Boucher, Eric wrote: > Is it possible to know which folders are pointing to each other in a cycle > manner by doing a find or some other command? I have a backup utility (in > windows thru samba) which seems to backup redundant files, probably due to > some symbolic links pointing to each other in cycle. Maybe a shell script > can do the job? I searched on the internet without good results. I hope t= hat > my question is clear. Thanks, The usual solution to this sort of problem is to make your backup script not chase symlinks at all. You can't create directory loops using hard links[1], and usually you would want your backup system to reproduce the symlinks rather than replacing the link with whatever it points at. Most commands you might use to make backups will default to not following symlinks -- tar(1), find(1)+cpio(1), dump(1), rsync(1) all work that way be default. cp(1) defaults to that behaviour if given the '-R' flag (copy filesystems recursively). Probably the best way to detect a symlink loop would be to record the inode number of any directory visited, and then test if the current directory had been visited before. Note: you can't do this with ordinary files, as it's perfectly legitimate for the same file to have many hard links and so appear in the filesystem in multiple places. Cheers, Matthew [1] Unless you have root access to the filesystem, and know quite a lot about its internals. --=20 Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way PGP: http://www.infracaninophile.co.uk/pgpkey Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK --Xm/fll+QQv+hsKip Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFAtdkEiD657aJF7eIRAm8GAJ9qquEVemAY6ahcgv68NupH/MD8FwCdF6va gjbLHLT/+ijdtpODMLxIoL8= =nwLB -----END PGP SIGNATURE----- --Xm/fll+QQv+hsKip--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040527120316.GD9499>