Opened 10 years ago

Closed 9 years ago

#134 closed defect (worksforme)

find-files traverses symlinks

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

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.

Change History (3)

comment:1 Changed 10 years ago by felix

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 9 years ago by felix

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 9 years ago by felix

  • Resolution set to worksforme
  • Status changed from new to closed

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.