[racket] many permissions & other problems using packages in 5.3.6... workarounds?

From: Eli Barzilay (eli at barzilay.org)
Date: Sun Oct 13 15:37:55 EDT 2013

30 minutes ago, Matthew Flatt wrote:
> At Sun, 13 Oct 2013 13:43:27 -0400, "David T. Pierson" wrote:
> > 
> > If Racket on Windows can't delete the directory because a file
> > downstream of that directory is open, then Windows will not allow
> > renaming the directory either.
> 
> Ah, that's probably often true.
> 
> Windows seems to allow renaming in many cases when it wouldn't allow
> deleting. For example, if I load a DLL from Racket, then I'm not
> able to delete the DLL file, but I can rename its enclosing
> directory (and that's an experiment that I tried earlier). After I
> start Racket, however, I see that I cannot rename the directory that
> contains Racket.

Two related notes:

1. It's not only a Windows thing -- I've seen such things happen on
   Linux with an NFS-mounted directory, both due to some file being
   opened in some process and due to permissions.  (There's also an
   occasional "text file busy" thing that happens in cases that aren't
   too clear to me.)

2. One thing on Windows that prevents removing a directory is when
   there's a process whose working directory you're trying to delete.
   (I keep running into that when I try to remove some directory and
   there's a cygwin shell in that directory.)

   With Racket, you can see this effect too, with what looks like
   changing the process directory for subprocess execution (which I
   vaguely remember as something that you did at some point).  Here's
   an experiment that demonstrates this (starting from some existing
   directory), and running on two shells, marked with [N]:

     [1] $ racket
     [1] > (current-directory "foo")    ; for an nonexistent "foo"
     [1] > (directory-list)
     [1] directory-list: could not open directory
     [2] $ mkdir foo; echo foo > foo/a
     [1] > (directory-list)
     [1] '(#<path:a>)
     [2] $ rm -rf foo; mkdir foo; echo foo > foo/b
     [1] > (directory-list)
     [1] '(#<path:b>)
     [1] > (system "dir")
     [1] ...
     [2] $ rm -rf foo
     [2] rm: cannot remove `foo': Device or resource busy
     [1] > (directory-list)
     [1] '()                            ; it did remove the files
     [1] > (current-directory "..")
     [2] $ rm -rf foo
     [2] rm: cannot remove `foo': Device or resource busy
     [1] > (system "dir")
     [1] ...
     [2] $ rm -rf foo                   # now it works


-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the users mailing list.