PDA

View Full Version : ls -R bug? list directory contents endless loop


zootreeves
March 6th, 2006, 06:49 PM
I'm trying to index an ftp site, but when I use ls -R it produces an endless loop of directories, i think due to symlinking. You can try it:

#ftp ftp.brighton.ac.uk
#anonymous
#anon
#ls -R

Is there anyway to overcome this, is there anyway to only list real directories not symlinks?

hod139
March 6th, 2006, 08:03 PM
Who creates a symlink that points back to the current dir!! I wouldn't consider this an ls -R bug, but a problem with the directory structure. As far as I know, you can't tell ls to ignore symlinks or give ls any sort of recursive depth info, it is all or none.

zootreeves
March 6th, 2006, 09:19 PM
Well this is the only site i have ever seen where this happens, but i'm just wondering for the future, if there are other sites like this, because my ftp crawler gets bogged down for weeks trying to crawl it. So there is nothing i can do with ls to stop it showing symlinks?

hod139
March 6th, 2006, 09:48 PM
I know of no way to have ls recursively search while not following symlinks. I wonder if ftp.brighton.ac.uk set up that recursive symlink as a deterrent to crawlers ;)

engla
March 6th, 2006, 10:13 PM
I think you need a smarter crawler.. since you crawl you should keep track of visited urls anyway..

As a sidenote, if you symlink /usr/share/X11/fonts/fonts to /usr/share/X11/fonts, funny stuff happens! (No, actually nothing fun happens. No error is given anywhere, but gnome apps take 25 secs extra to start)