Summary

find-files traverses symlinks

Metadata

Description

find-files traverses symlinks. This behavior isn't specifically documented so I would like to know if it is correct (and I will document) or incorrect.

 ~/tmp$ ls -lR foo
 total 8
 lrwxr-xr-x  1 jim  jim  1 Nov 28 20:45 bar@ -> .
 -rw-r--r--  1 jim  jim  0 Nov 28 20:39 baz
 
 ~/tmp$ csi4 -R posix -e '(find-files "foo" identity (lambda (x xs) (print x))
          #f 2)'
 foo/bar
 foo/bar/bar
 foo/bar/bar/bar
 foo/bar/bar/baz
 foo/bar/baz
 foo/baz

If I set a LIMIT procedure to check for symlink it will not traverse it.

 ~/tmp$ csi4 -R posix -e '(find-files "foo" identity (lambda (x xs) (print x))
          #f (lambda (x) (not (symbolic-link? x))))'
 foo/bar
 foo/baz

If I use directory? as limit procedure the symlink traversal is still done because directory? reads through the link, so it prints out a large yet attractive triangle.

Actually I would also like to know if this behavior is correct for directory?, and I will document that result too.

Changes and comments

[2009-11-30 11:58:14 UTC] felix wrote:

Yes, symlinks are not specifically handled (and I think they shouldn't, in the default case). It would possibly be useful to make traversing symlinks optional in `find-files`, but that may perhaps cause other headaches - the implications are not quite clear to me.

[2010-04-13 13:43:36 UTC] felix wrote:

It would be nice if symlink-traversal could be optional (default being #t). Unfortunately the procedure already has too many optional argumentsm, converting to keyword args would break backwards compatibility.

[2010-05-07 11:55:36 UTC] felix changed status from new to closed

[2010-05-07 11:55:36 UTC] felix set resolution to worksforme

[2010-05-07 11:55:36 UTC] felix wrote:

Changing the signature to use keyword arguments will break too much code. Since the LIMIT hack can be used, I'll close this ticket.