[racket] Error in in-directory

From: Manfred Lotz (manfred.lotz at arcor.de)
Date: Sun Mar 13 05:18:15 EDT 2011

Hi there,
I just took the example from the http://racket-lang.org/;

#lang racket
;; Finds Racket sources in all subdirs
(for ([path (in-directory)])
  (when (regexp-match? #rx"[.]rkt$" path)
    (printf "source file: ~a\n" path)))

and I found that in-directory has an error. The problem is that it
follows symlinks when the symlink points to a directory. I works ok
when the symlink points to a file.

Example: I have this

d .
l ./fl.rkt -> f.rkt
- ./f.rkt
l ./link_d -> d
l ./link_f -> f.rkt
d ./d
- ./d/g.rkt

and the output of the racket snippet is:

source file: fl.rkt
source file: f.rkt
source file: link_d/g.rkt
source file: d/g.rkt

As can be seen link_d/g.rkt will be shown although link_d is only a
symlink. IMHO, this is an error. 

What do you think?


Posted on the users mailing list.