Also sprach Anthony Campbell (Wed 06 Aug 02003 at 03:56:28PM +0100):
> Never do this!
>
> I just ran cleanlinks on my root directory; really stupid thing to do!
>
> Lots of things were deleted which should not have been and I don't know
> how long it will take to get things back working; only just restored ppp. Possibly a new
> installation will be required?
This is plain scary !?!?
# sudo cat /usr/X11R6/bin/cleanlinks
#!/bin/sh
#
# Copyright © 2000 by The XFree86 Project, Inc
#
# Remove dangling symlinks and empty directories from a shadow link tree
# (created with lndir).
#
# Author: David Dawes <dawes@xfree86.org>
#
# $XFree86: xc/config/util/cleanlinks.sh,v 1.1 2001/03/21 20:25:00 dawes Exp $
find . -type l -print |
(
read i
while [ X"$i" != X ]; do
if [ ! -f "$i" ]; then
echo $i is a dangling symlink, removing
rm -f "$i"
fi
read i
done
)
echo Removing empty directories ...
find . -type d -depth -print | xargs rmdir > /dev/null 2>&1
exit 0
Actually, that script removes every symbolic link that does not test
successfully as a regular file. Yes, that test will follow the symbolic
link; but, it will only check whether or not the destination is a
regular file. It does *NOT* test for dangling symlink at all! On my
system, I have *many* symlinks to directories, all of which contain
something, and this script flags *ALL* of them for removal . . .
What could be the purpose of this script?
--
Best Regards,
mds
mds resource
877.596.8237
-
Dare to fix things before they break . . .
-
Our capacity for understanding is inversely proportional to how much
we think we know. The more I know, the more I know I don't know . . .
--
Attachment:
pgpt4iRvSIhYj.pgp
Description: PGP signature