KIO::listRecursive & link
faure at kde.org
Tue Nov 23 10:17:43 GMT 2004
On Tuesday 23 November 2004 10:58, Andras Mantia wrote:
> I did it locally, so it follows the symlinks with the current
> listRecursive (call a new listRecursive for each item that is a
> directory and a link) *without* any guard against infinite recursion
> and I *tested* it with infinite recursion. I suspected an infinite
> loop. For my surprise it wasn't infinite at all. After some time it
> simply didn't follow the link. I verified in Midnight Commander and
> there as well, after some depth the links are not valid. Konqueror
> gives an error as well: "The file or folder [long path comes here] does
> not exist." I suspect this is because of the limitation of a path name
> length on the file system. The question is if there are filesystems
> with no such limitations, or in other words, can be there a real
> infinite recursion?
Even so, you certainly don't want to go to such depths....
You want to stop at the first recursion, to avoid listing the same files
over and over again.
Check what grep -r does: it detects the loop immediately.
# mkdir foo
# ln -s ../foo foo/foolink
# grep -r test .
grep: warning: ./foo/foolink: recursive directory loop
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the kde-core-devel