Ticket #5043 (closed defect: fixed)

Opened 4 years ago

Last modified 11 months ago

gap_console help broken

Reported by: was Owned by: was
Priority: major Milestone: sage-5.2
Component: interfaces Keywords:
Cc: Work issues:
Report Upstream: N/A Reviewers: Karl-Dieter Crisman
Authors: Ivan Andrus Merged in: sage-5.2.beta1
Dependencies: Stopgaps:

Description (last modified by kcrisman) (diff)


On Tue, Jan 20, 2009 at 8:03 PM, davidp <davidp@reed.edu> wrote:
>
> I will be teaching abstract algebra this semester and want to
> introduce my students to Sage and GAP.  I have installed
> gap_packages-4.4.10_6, but I am still having trouble with
> documentation:
>
> ----------------------------------------------------------------------
> | Sage Version 3.2.3, Release Date: 2009-01-05                       |
> | Type notebook() for the GUI, and license() for information.        |
> ----------------------------------------------------------------------
> sage: gap_console()
> GAP4, Version: 4.4.10 of 02-Oct-2007, i686-pc-linux-gnu-gcc
> gap> ?SymmetricGroup
> Help: Showing `Reference: SymmetricGroup'
> Record: '<rec>.tempfile' must have an assigned value at
> str := OutputTextFile( $SAGE.tempfile, false );
>  called from
> HELP_VIEWER_INFO.(viewer).show( data ); called from
> HELP_PRINT_MATCH( i ); called from
> HELP_SHOW_MATCHES( books, str, true ) called from
> <function>( <arguments> ) called from read-eval-loop
> Entering break read-eval-print loop ...
> you can 'quit;' to quit to outer loop, or
> you can 'return;' after assigning a value to continue
> brk>
>
>
> I am running Sage on a thinkpad with Fedora 10.
>
> Any suggestions would be appreciated.

The above happens because the default GAP workspace evidently that messes up the help system.  I think this is a bug (?), probably in GAP. 

You can do the following instead:

sage: gap_console(False)
...

Or

sage: gap.SymmetricGroup?            # <--- i like this


William

Apply trac_5043-extcode-gap-console-help.patch Download to the extcode repository and trac_5043-gap-console-help.patch Download to the Sage library.

Attachments

trac_5043-extcode-gap-console-help.patch Download (606 bytes) - added by iandrus 12 months ago.
trac_5043-gap-console-help.patch Download (585 bytes) - added by iandrus 12 months ago.

Change History

comment:1 Changed 4 years ago by was

#
# SAGE support utilities to read into the GAP session.
#
$SAGE := rec();

$SAGE.OldPager := Pager;


$SAGE.NewPager :=
         function( data )
   local   str,  lines,  line, fn, start;

   str := OutputTextFile($SAGE.tempfile,false);
   start := 1;

but never sets $SAGE.tempfile anywhere.

Steve
- Show quoted text -


On 21 Jan 2009, at 06:39, William Stein wrote:

    On Tue, Jan 20, 2009 at 8:03 PM, davidp <davidp@reed.edu> wrote:


        I will be teaching abstract algebra this semester and want to
        introduce my students to Sage and GAP.  I have installed
        gap_packages-4.4.10_6, but I am still having trouble with
        documentation:

        ----------------------------------------------------------------------
        | Sage Version 3.2.3, Release Date: 2009-01-05                       |
        | Type notebook() for the GUI, and license() for information.        |
        ----------------------------------------------------------------------
        sage: gap_console()
        GAP4, Version: 4.4.10 of 02-Oct-2007, i686-pc-linux-gnu-gcc
        gap> ?SymmetricGroup
        Help: Showing `Reference: SymmetricGroup'
        Record: '<rec>.tempfile' must have an assigned value at
        str := OutputTextFile( $SAGE.tempfile, false );
        called from
        HELP_VIEWER_INFO.(viewer).show( data ); called from
        HELP_PRINT_MATCH( i ); called from
        HELP_SHOW_MATCHES( books, str, true ) called from
        <function>( <arguments> ) called from read-eval-loop
        Entering break read-eval-print loop ...
        you can 'quit;' to quit to outer loop, or
        you can 'return;' after assigning a value to continue
        brk>


        I am running Sage on a thinkpad with Fedora 10.

        Any suggestions would be appreciated.


    The above happens because the default GAP workspace evidently that
    messes up the help system.  I think this is a bug (?), probably in
    GAP.

    You can do the following instead:

    sage: gap_console(False)

    which will give you a gap session that by default has less
    functionality loaded than otherwise.

    ...

    Or

    sage: gap.SymmetricGroup?            # <--- i like this

    I've made this bug trac #5043:

             http://trac.sagemath.org/sage_trac/ticket/5043

    I've also cc'd Steve Linton in case he has any remarks.

    -- William


Steve Linton    School of Computer Science  &

Changed 12 months ago by iandrus

Changed 12 months ago by iandrus

comment:2 Changed 12 months ago by iandrus

  • Status changed from new to needs_review
  • Report Upstream set to N/A
  • Authors set to Ivan Andrus

Since a console session and a session driven through expect are somewhat different, I think it makes sense to source a different file. I could have made it so that console.g reads in sage.g if it wasn't already loaded, but I didn't see much use for the stuff in sage.g when interacting directly with GAP.

This means there could be problems (I haven't tested) if someone calls SaveWorkspace and overwrites Sage's workspace with one in which $SAGE is not set. However, it is currently possible to do that anyway though perhaps not quite as easily. A much simpler way to mess things up is calling $SAGE.StartInteract() which screws with the expect interaction.

comment:3 follow-up: ↓ 4 Changed 11 months ago by kcrisman

Ivan, do you think this might help #3152 as well?

comment:4 in reply to: ↑ 3 Changed 11 months ago by iandrus

Replying to kcrisman:

Ivan, do you think this might help #3152 as well?

I just tested and sadly it doesn't.

comment:5 Changed 11 months ago by kcrisman

  • Status changed from needs_review to positive_review
  • Reviewers set to Karl-Dieter Crisman
  • Description modified (diff)

This does fix the problem as stated, and of course the behavior with False remains the same. The code makes sense, though I had to learn a little bit about how GAP does these things and our interface.

The issue with saving... I mean, when this is called, $SAGE is set, right? So I'm not sure that this is really causing any new problems. What use case are you worried about? The -L isn't even called if we do gap_console(False), and if one does True (default) then everything is the same as it was... I'm missing something here. Unless you think of what the case was where this is really different from the previous behavior, positive review.

Patchbot, apply trac_5043-extcode-gap-console-help.patch Download to the extcode repository and trac_5043-gap-console-help.patch Download to the Sage library.

comment:6 Changed 11 months ago by jdemeyer

  • Milestone changed from sage-5.1 to sage-5.2

comment:7 Changed 11 months ago by jdemeyer

  • Status changed from positive_review to closed
  • Resolution set to fixed
  • Merged in set to sage-5.2.beta1
Note: See TracTickets for help on using tickets.