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

From: John Clements (clements at brinckerhoff.org)
Date: Fri Aug 31 12:55:04 EDT 2012

Currently, using the (in-directory …) sequence in a directory where there are unreadable directories causes a funny internal contract failure.

Suppose I have directory "/tmp/f", containing directory "sekrit" which I cannot read. Then this program:

#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?

John

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4800 bytes
Desc: not available
URL: <http://lists.racket-lang.org/dev/archive/attachments/20120831/6318fd3c/attachment.p7s>

Posted on the dev mailing list.