[racket-dev] desired behavior of (in-directory …) when lacking permissions?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Aug 31 13:03:07 EDT 2012

At Fri, 31 Aug 2012 09:55:04 -0700, John Clements wrote:
> #lang racket
> 
> (sequence->list (in-directory "/tmp/f"))
> 
> … produces this pair of errors:
> 
> . . plt/collects/racket/private/for.rkt:1857:28: directory-list: could not 
> open directory
>   path: /tmp/f/sekrit
>   system error: Permission denied; errno=13
> . . car: contract violation
>   expected: pair?
>   given: #<void>
> 
> The first one looks reasonable, but why wouldn't that error just abort the 
> whole computation? It looks like there's a handler somewhere that eats this 
> error but then tries to continue by passing #<void> rather than a list.
> 
> The docs don't seem to have anything to say about this.
> 
> Is this a bug?

Yes.

The implementation of `in-directory' uses a prompt with the default
continuation prompt tag. It should use its own tag, instead, to avoid
interfering with error escapes. I'll push a repair.



Posted on the dev mailing list.