#11924: lazy_import_cache.get_cache_file doesn't work well if DOT_SAGE doesn't
end
with a slash
-----------------------------+----------------------------------------------
Reporter: jhpalmieri | Owner: tbd
Type: defect | Status: new
Priority: major | Milestone: sage-4.7.2
Component: PLEASE CHANGE | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author: John Palmieri
Merged: | Dependencies:
-----------------------------+----------------------------------------------
The function `get_cache_file` in sage/misc/lazy_import_cache.py uses this
code:
{{{
#!python
return "%s%s-lazy_import_cache.pickle" % (
os.environ['DOT_SAGE'],
os.path.realpath(os.path.join(os.environ['SAGE_ROOT'], 'devel',
'sage')).replace(os.sep, '_'))
}}}
Since this just appends to DOT_SAGE, it returns a file in a different
directory depending on whether DOT_SAGE ends with a slash or not: if
DOT_SAGE is /home/user/.sage/, then this gives
{{{
/home/user/.sage/_mangled_SAGE_ROOT_...
}}}
whereas if DOT_SAGE is /home/user/.sage, then it gives
{{{
/home/user/.sage_mangled_SAGE_ROOT_...
}}}
which is a file in the directory /home/user/, not in .sage/.
The attached patch uses os.path.join to combine the parts of the path
correctly. (I also wonder if it would be a good idea to store the cache
file in a different directory, say `DOT_SAGE/cache/`, so it's hidden more
than it is currently?)
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11924>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
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-trac?hl=en.