Kate,

Thanks for the fix.  I've included this in my main tree for sage-2.5.

On 5/3/07, Kate Minola <[EMAIL PROTECTED]> wrote:
>
> For sage-2.4.2, Martin Albrecht reported that he does not see
> the error message that I see when I run
>
> sage -t  devel/sage-main/sage/geometry/lattice_polytope.py
>
> What I see is
>
> [Errno 39] Directory not empty: '/home/kate/.sage//tmp/5852/'
>
> I have investigated and determined that the problem only
> occurs if the DOT_SAGE file is on a shared file system.
> I also do not get the error message when DOT_SAGE is
> on a local disk.  I suspect this is why Martin did not see
> the same error message.
>
> The problem occurs in lattice_polytope.py when the
> following lines are executed:
>
> o = lattice_polytope.octahedron(3)
> lattice_polytope.all_cached_data([o.polar()])
> quit
>
> The first two lines are from the example in
> all_cached_data().  The 'quit' comes from 'sage -t'
>
> Now the line 'lattice_polytope.all_cached_data([o.polar()])'
> is supposed to give a traceback; unfortunately it also leaves
> an open file descriptor.  It is this open file descriptor to a file
> in DOT_SAGE/tmp
> that causes the problem when the sage 'quit' command
> is run on a shared file system.  The shared file system
> notes that a process is reading from the file and so does
> not allow the file to be deleted.  Unfortunately this is precisely
> what the sage 'quit' command tries to do (using shutil.rmtree) to
> DOT_SAGE/tmp.
>
> A fix is to have the sage 'quit' command close
> all open file descriptors before attempting to
> delete the directory DOT_SAGE/tmp.  This
> can be done by adding to
>
> spkg/standard/sage-2.4.2/sage/all.py
>
> in the routine quit_sage() right before the
> lines
>
> from sage.misc.misc import delete_tmpfiles
> delete_tmpfiles()
>
> add the following lines
>
>     # close all open file descriptors
>     import resource             # Resource usage information.
>     maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
>     print maxfd;
>     if (maxfd == resource.RLIM_INFINITY):
>        maxfd = MAXFD
>
>     # Iterate through and close all file descriptors.
>     for fd in range(0, maxfd):
>        try:
>           os.close(fd)
>        except OSError:  # ERROR, fd wasn't open to begin with (ignored)
>           pass
>
> --
> Kate Minola
> University of Maryland, College Park
>
> >
>


-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://www.williamstein.org

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to