Opened 14 years ago

Closed 14 years ago

#134 closed defect (worksforme)

find-files traverses symlinks

Reported by: Jim Ursetto Owned by:
Priority: not urgent at all Milestone:
Component: core libraries Version: 4.2.x
Keywords: Cc:
Estimated difficulty:


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)'

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))))'

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.

Change History (3)

comment:1 Changed 14 years ago by felix winkelmann

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.

comment:2 Changed 14 years ago by felix winkelmann

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.

comment:3 Changed 14 years ago by felix winkelmann

Resolution: worksforme
Status: newclosed

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

Note: See TracTickets for help on using tickets.