Re: Really stupid use of cleanlinks

2003-08-14 Thread Anthony Campbell
On 06 Aug 2003, Joerg Johannes wrote:
 On Wednesday 06 August 2003 16:56, Anthony Campbell wrote:
  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?
 
 
 Hi Anthony
 
 As I understand the manpage, it should only remove empty dirs and
 dangling symlinks. And it spits out a list of what it deletes. Do you
 have this list saved to a file? So you should be able to see what was
 deleted, and judge if it was a good or a bad idea.
 
 joerg
 
 --
 Gib GATES keine Chance!
 

Yes, this is what it says and in fact I think I used it previously
without problems. I ran it as root, starting at /. What happened was
that it removed a number of empty directories in /var that were actually
needed (mainly related to apt and tex) and also removed /usr/bin/X11
which is a symlink to /usr/X11R6/bin and is pointed to by /etc/X11/X, so
that X would not start. The modem also would not work, I can't remember
why (something to do with /dev/ttyS0).

You're right; I should have saved a list to file but I didn't. However,
I have another computer which has a similar though not identical file
structure and by comparing the two I was able to restore things pretty
much to what it was previously and as far as I can see everything is
working again.

I do think the man file for cleanlinks should include a warning. I
certainly shan't use it again.

AC

-- 
[EMAIL PROTECTED]||  http://www.acampbell.org.uk
using Linux GNU/Debian ||  for book reviews, electronic 
Windows-free zone  ||  books and skeptical articles


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Really stupid use of cleanlinks

2003-08-14 Thread Joerg Johannes
On Wednesday 06 August 2003 16:56, Anthony Campbell wrote:
 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?


Hi Anthony

As I understand the manpage, it should only remove empty dirs and 
dangling symlinks. And it spits out a list of what it deletes. Do you 
have this list saved to a file? So you should be able to see what was 
deleted, and judge if it was a good or a bad idea.

joerg

-- 
Gib GATES keine Chance!


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Really stupid use of cleanlinks

2003-08-14 Thread John Hasler
mds writes:
 This is plain scary !?!?

The thing is dangerously broken.  File a bug.
-- 
John Hasler
[EMAIL PROTECTED]
Dancing Horse Hill
Elmwood, Wisconsin


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Really stupid use of cleanlinks

2003-08-14 Thread Alan Shutko
Michael D. Schleif [EMAIL PROTECTED] writes:

# Remove dangling symlinks and empty directories from a shadow link tree
# (created with lndir).

 What could be the purpose of this script?

As described in the script and manpage, it's to fix up a shadow link
tree that was created with lndir.  It's not a general tool!

The lndir manpage describes what the point is:

   The lndir program makes  a  shadow  copy  todir  of  a  directory  tree
   fromdir,  except  that  the shadow is not populated with real files but
   instead with symbolic links pointing at the real files in  the  fromdir
   directory tree.  This is usually useful for maintaining source code for
   different machine architectures.  You create a  shadow  directory  con-
   taining  links  to the real source, which you will have usually mounted
   from a remote machine.  You can build  in  the  shadow  tree,  and  the
   object files will be in the shadow directory, while the source files in
   the shadow directory are just symlinks to the real files.

   This scheme has the advantage that if you update the source,  you  need
   not  propagate the change to the other architectures by hand, since all
   source in all shadow directories are symlinks to the real  thing:  just
   cd to the shadow directory and recompile away.

-- 
Alan Shutko [EMAIL PROTECTED] - I am the rocks.
I wish you luck on your journey. Tel


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Really stupid use of cleanlinks

2003-08-14 Thread Michael D. Schleif
Also sprach Colin Watson (Wed 06 Aug 02003 at 07:21:57PM +0100):
 On Wed, Aug 06, 2003 at 12:48:11PM -0500, Michael D. Schleif wrote:
  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?
 
 It's a utility to reverse the effects of lndir, which is mainly intended
 for building cheap copies of source trees. See their respective man
 pages.

Colin, I do not want to dis you, and I did not know that you _are_ David
Dawes ;

However, on my systems, man cleanlinks produces this:

   NAME
  cleanlinks - remove dangling symbolic links and empty directories

...

   DESCRIPTION
  The  cleanlinks  program searches the directory tree descended from the
  current directory for symbolic links whose targets do  not exist,  and
  removes  them.  It then removes all empty directories in that directory
  tree.
   
  cleanlinks is useful for cleaning up a shadow link  tree  created with
  lndir(1) after files have been removed from the real directory.

Pardon my understanding; but, the name line and the first description
paragraph are quite clear.  Not to mention, that they are erroneous, and
dangerously misleading.

The _second_ description paragraph, especially that phrase ``is useful
for'', appears to me to be an afterthought -- not the actual program
intent.

What am I missing?

-- 
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 . . .
--


pgp0.pgp
Description: PGP signature


Re: Really stupid use of cleanlinks

2003-08-14 Thread Florian Ernst
On Wednesday 06 August 2003 19:50, John Hasler wrote:

 Anthony Campbell writes:
 ...also removed /usr/bin/X11 which is a symlink to /usr/X11R6/bin
 and is pointed to by /etc/X11/X...
 
 That sounds like a bug.

...which I just reported:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=204363

But removing empty directories is documented behaviour of cleanlinks,
so better never try not to run it ie. in a maildir, as it will break
its structure... :-/

Cheers,
Flo


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Really stupid use of cleanlinks

2003-08-14 Thread Colin Watson
On Wed, Aug 06, 2003 at 12:48:11PM -0500, Michael D. Schleif wrote:
 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?

It's a utility to reverse the effects of lndir, which is mainly intended
for building cheap copies of source trees. See their respective man
pages.

-- 
Colin Watson  [EMAIL PROTECTED]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Really stupid use of cleanlinks

2003-08-14 Thread John Hasler
Colin Watson writes:
 I wrote [cleanlinks] in a spare ten minutes or so some months back

Did you intend it to remove all symlinks not pointing to ordinary files?
-- 
John Hasler
[EMAIL PROTECTED] (John Hasler)
Dancing Horse Hill
Elmwood, WI


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Really stupid use of cleanlinks

2003-08-14 Thread Colin Watson
On Wed, Aug 06, 2003 at 02:24:50PM -0500, Michael D. Schleif wrote:
 Also sprach Colin Watson (Wed 06 Aug 02003 at 07:21:57PM +0100):
  It's a utility to reverse the effects of lndir, which is mainly intended
  for building cheap copies of source trees. See their respective man
  pages.
 
 Colin, I do not want to dis you, and I did not know that you _are_ David
 Dawes ;
 
 However, on my systems, man cleanlinks produces this:
 
NAME
   cleanlinks - remove dangling symbolic links and empty directories

Go ahead and fix the man page; at the time I was concentrating on
getting rid of an xutils bug by having it documented *at all*. :)

-- 
Colin Watson  [EMAIL PROTECTED]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Really stupid use of cleanlinks

2003-08-14 Thread Anthony Campbell
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? 

AC


-- 
[EMAIL PROTECTED]||  http://www.acampbell.org.uk
using Linux GNU/Debian ||  for book reviews, electronic 
Windows-free zone  ||  books and skeptical articles


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Really stupid use of cleanlinks

2003-08-14 Thread Colin Watson
On Wed, Aug 06, 2003 at 03:57:21PM -0500, John Hasler wrote:
 On Wed, Aug 06, 2003 at 01:41:43PM -0500, John Hasler wrote:
 Colin Watson writes:
  I wrote it in a spare ten minutes or so some months back
 
 I wrote:
  Did you intend it to remove all symlinks not pointing to ordinary files?
 
 Colin Watson writes:
  I didn't say I wrote cleanlinks; I said I wrote the man page.
 
 Sorry.  The script _looks_ like it was written in ten minutes.

Oh, I don't doubt it :)

-- 
Colin Watson  [EMAIL PROTECTED]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Really stupid use of cleanlinks

2003-08-14 Thread Colin Watson
On Wed, Aug 06, 2003 at 01:41:43PM -0500, John Hasler wrote:
 Colin Watson writes:
  I wrote [cleanlinks] in a spare ten minutes or so some months back
 
 Did you intend it to remove all symlinks not pointing to ordinary files?

Eh? I didn't say I wrote cleanlinks; I said I wrote the man page. Your
pronoun replacement above is inaccurate.

Cheers,

-- 
Colin Watson  [EMAIL PROTECTED]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Really stupid use of cleanlinks

2003-08-14 Thread Michael D. Schleif
Also sprach Alan Shutko (Wed 06 Aug 02003 at 01:20:57PM -0500):
 Michael D. Schleif [EMAIL PROTECTED] writes:
 
 # Remove dangling symlinks and empty directories from a shadow link tree
 # (created with lndir).
 
  What could be the purpose of this script?
 
 As described in the script and manpage, it's to fix up a shadow link
 tree that was created with lndir.  It's not a general tool!

Yes, if *only* this made it into the manpage, and my previously
referenced man content was removed, then I'd agree with you:

   # Remove dangling symlinks and empty directories from a shadow link tree
   # (created with lndir).

As it stands, I heartily disagree with your position . . .

 The lndir manpage describes what the point is:
snip /

Wow!  Are you recommending that one should read *every* manpage, for
*every* command referenced in *every* other manpage -- recursively, ad
infinitum ???

Yes, I really wish that I had the time necessary to accomplish this;
but, as it stands, I find that suggestion grossly un-reasonable . . .

P.S., I am *NOT* trying to dis anybody, in this thread or otherwise.
Nevertheless, in this case, the cleanlinks manpage is erroneous and
dangerously misleading -- and, I'd really love to reach consensus on
that point.  Thank you.

-- 
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 . . .
--


pgp0.pgp
Description: PGP signature


Re: Really stupid use of cleanlinks

2003-08-14 Thread Colin Watson
On Wed, Aug 06, 2003 at 05:48:17PM +0100, Anthony Campbell wrote:
 I do think the man file for cleanlinks should include a warning.

Yeah, it probably should (I wrote it in a spare ten minutes or so some
months back). File a bug against xutils.

Cheers,

-- 
Colin Watson  [EMAIL PROTECTED]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Really stupid use of cleanlinks

2003-08-08 Thread Florian Ernst
Hello there!

On Wednesday 06 August 2003 17:10, Anthony Campbell wrote:

 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?

Now that I came to think about it, the bug report I sent in [1]
doesn't seem to be quite sufficient.

Currently IMVHO this little script cleanlinks better shouldn't exist
at all in its current state, since
a) its handling of (dangling) symlinks is done far better by the
symlinks package
b) its cleaning of empty dirs is actually a simple one-liner
c) it doesn't do what it is supposed to do and thus
d) it can seriously screw up your system

If this script persists I think the following changes should be made:
a) see [1], somebody better check this for correctness
b) fix Colin's manpage (DIAGNOSTICS), as the message about empty
directories will be printed regardless of the results, and the user
doesn't get feedback about which dirs have been removed
c) or alternatively let it print out the names of removed dirs:
find . -type d -depth -print |
(
read i
echo \$i\ empty, removing
rmdir --ignore-fail-on-non-empty $i
)


What do you think?

Cheers,
Flo

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=204363


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Really stupid use of cleanlinks

2003-08-08 Thread Michael D. Schleif
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? 

Now that we have that out of the way, there exists an alternative that I
believe works quite well:

symlinks

I don't know how this package came to be on my system; but, it is
limited to this program, and appears to work.   I just tested it out,
and everything appears to function as expected, including test mode that
shows what it will do -- if you let it ;

-- 
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 . . .
--


pgp0.pgp
Description: PGP signature


Re: Really stupid use of cleanlinks

2003-08-07 Thread John Hasler
On Wed, Aug 06, 2003 at 01:41:43PM -0500, John Hasler wrote:
Colin Watson writes:
 I wrote it in a spare ten minutes or so some months back

I wrote:
 Did you intend it to remove all symlinks not pointing to ordinary files?

Colin Watson writes:
 I didn't say I wrote cleanlinks; I said I wrote the man page.

Sorry.  The script _looks_ like it was written in ten minutes.
-- 
John Hasler
[EMAIL PROTECTED] (John Hasler)
Dancing Horse Hill
Elmwood, WI


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Really stupid use of cleanlinks

2003-08-06 Thread John Hasler
Anthony Campbell writes:
 ...also removed /usr/bin/X11 which is a symlink to /usr/X11R6/bin and is
 pointed to by /etc/X11/X...

That sounds like a bug.

 The modem also would not work, I can't remember why (something to do with
 /dev/ttyS0).

Perhaps you had /dev/modem pointing to /dev/ttyS0 and it removed
/dev/modem?
-- 
John Hasler
[EMAIL PROTECTED] (John Hasler)
Dancing Horse Hill
Elmwood, WI


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Re: Really stupid use of cleanlinks

2003-08-06 Thread Michael D. Schleif
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 [EMAIL PROTECTED]
   #
   # $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 21
   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 . . .
--


pgp0.pgp
Description: PGP signature