#9938: GAP does not start if the path to the GAP workspace file contains more
than
82 characters
--------------------------+-------------------------------------------------
Reporter: saliola | Owner: saliola
Type: defect | Status: new
Priority: blocker | Milestone: sage-4.6
Component: interfaces | Keywords: gap
Author: | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
--------------------------+-------------------------------------------------
Changes (by saliola):
* cc: slabbe, mrobado (added)
* owner: was => saliola
Old description:
> As pointed out in
> [http://groups.google.com/group/sage-
> support/browse_thread/thread/7e169e371308838/a1403ee743fd6ea6?lnk=gst&q=tremblay+gap#a1403ee743fd6ea6|this
> thread], on some machines one there is a problem starting GAP from within
> Sage:
> {{{
> sage: gap('3+2')
> A workspace appears to have been corrupted... automatically rebuilding
> (this is harmless).
> ---------------------------------------------------------------------------
> ...
> TypeError: Unable to start gap
> }}}
> The problem is in Sage's attempt to rebuild the GAP workspace. It turns
> out that Sage calls GAP's {{{SaveWorkspace}}} command incorrectly in a
> particular case.
>
> To explain the problem, first recall the process used by the GAP
> interface to evaluate a line of GAP code, say {{{LineOfGapCode}}}. It
> begins by checking the length {{{LineOfGapCode}}} (as a string). If this
> length is greater than 100 (a pre-defined cut-off value), then a file is
> created containing:
> {{{
> Print(LineOfGapCode);
> }}}
> This file is read into GAP using the expect interface and the output is
> parsed and returned to Sage. (There is no problem if the length is less
> than 100, because the interface does not use a file.)
>
> Let's apply this to the case where we need to rebuild a workspace. The
> workspace is just a file contained in a user's .sage directory. If the
> number of characters in the path to the workspace is greater than the
> cut-off, then Sage tries to execute the following command:
> {{{
> Print(SaveWorkspace("PathToWorkspaceFile"));
> }}}
> This is not permitted by GAP, as explained in the [http://www.gap-
> system.org/Manuals/doc/htm/ref/CHAP003.htm#SSEC011.1 GAP Reference
> Manual]:
> {{{
> SaveWorkspace can only be used at the main gap> prompt. It cannot be
> included in the body of a loop or function, or called from a break loop.
> }}}
> So to fix this, we need to force the interface not to use a file to
> execute the {{{SaveWorkspace}}} command.
>
> (This problem has plagued all the computers in our computer lab for
> months since a user's home directory is located on a network drive with a
> long name.)
New description:
As pointed out in
[http://groups.google.com/group/sage-
support/browse_thread/thread/7e169e371308838/a1403ee743fd6ea6?lnk=gst&q=tremblay+gap#a1403ee743fd6ea6|this
thread], on some machines one there is a problem starting GAP from within
Sage:
{{{
sage: gap('3+2')
A workspace appears to have been corrupted... automatically rebuilding
(this is harmless).
---------------------------------------------------------------------------
...
TypeError: Unable to start gap
}}}
The problem is in Sage's attempt to rebuild the GAP workspace. It turns
out that Sage calls GAP's {{{SaveWorkspace}}} command incorrectly in a
particular case.
To explain the problem, first recall the process used by the GAP interface
to evaluate a line of GAP code, say {{{LineOfGapCode}}}. It begins by
checking the length {{{LineOfGapCode}}} (as a string). If this length is
greater than 100 (a pre-defined cut-off value), then a file is created
containing:
{{{
Print(LineOfGapCode);
}}}
This file is read into GAP using the expect interface and the output is
parsed and returned to Sage. (There is no problem if the length is less
than 100, because the interface does not use a file.)
Let's apply this to the case where we need to rebuild a workspace. The
workspace is just a file contained in a user's .sage directory. If the
number of characters in the path to the workspace is greater than the cut-
off, then Sage tries to execute the following command:
{{{
Print(SaveWorkspace("PathToWorkspaceFile"));
}}}
This is not permitted by GAP, as explained in the [http://www.gap-
system.org/Manuals/doc/htm/ref/CHAP003.htm#SSEC011.1 GAP Reference
Manual]:
{{{
SaveWorkspace can only be used at the main gap> prompt. It cannot be
included in the body of a loop or function, or called from a break loop.
}}}
So to fix this, we need to force the interface not to use a file to
execute the {{{SaveWorkspace}}} command.
(This problem has plagued all the computers in our computer lab for months
since a user's home directory is located on a network drive with a long
name.)
This is reproducible:
{{{
sage: ws = sage.interfaces.gap.WORKSPACE
sage: sage.interfaces.gap.WORKSPACE += "0"*(83-len(ws))
sage: gap = Gap()
sage: gap('3+2')
}}}
Boom!
--
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9938#comment:1>
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.