Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GAP interface broken after CTRL-C #3294

Closed
wdjoyner opened this issue May 24, 2008 · 7 comments
Closed

GAP interface broken after CTRL-C #3294

wdjoyner opened this issue May 24, 2008 · 7 comments

Comments

@wdjoyner
Copy link

For example (you need to hit CTRL-C pretty quickly to beat the first line...):

sage: gap.eval('B := ExtendedBinaryGolayCode();')
^CInterrupting Gap...
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)

/Users/rlmill/sage-3.0.6/<ipython console> in <module>()

/Users/rlmill/sage-3.0.6/local/lib/python2.5/site-packages/sage/interfaces/gap.py in eval(self, x, newlines, strip)
    307         if len(x) == 0 or x[len(x) - 1] != ';':
    308             x += ';'
--> 309         s = Expect.eval(self, x)
    310         if newlines:
    311             return s

/Users/rlmill/sage-3.0.6/local/lib/python2.5/site-packages/sage/interfaces/expect.py in eval(self, code, strip, synchronize, **kwds)
    915         try:
    916             with gc_disabled():
--> 917                 return '\n'.join([self._eval_line(L, **kwds) for L in code.split('\n') if L != ''])
    918         except KeyboardInterrupt:
    919             # DO NOT CATCH KeyboardInterrupt, as it is being caught

/Users/rlmill/sage-3.0.6/local/lib/python2.5/site-packages/sage/interfaces/gap.py in _eval_line(self, line, allow_use_file, wait_for_prompt)
    511 
    512         except KeyboardInterrupt:
--> 513             self._keyboard_interrupt()
    514             raise KeyboardInterrupt, "Ctrl-c pressed while running %s"%self
    515 #        i = out.find("\n")

/Users/rlmill/sage-3.0.6/local/lib/python2.5/site-packages/sage/interfaces/gap.py in _keyboard_interrupt(self)
    448         print "Interrupting %s..."%self
    449         os.killpg(self._expect.pid, 2)
--> 450         raise KeyboardInterrupt, "Ctrl-c pressed while running %s"%self
    451 
    452     def _eval_line_using_file(self, line):

KeyboardInterrupt: Ctrl-c pressed while running Gap

Now we try to do something else using GAP:

sage: C = ReedSolomonCode(4,3,GF(5)); C
Linear code of length 4, dimension 3 over Finite Field of size 5
sage: C.minimum_distance()
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)

/Users/rlmill/sage-3.0.6/<ipython console> in <module>()

/Users/rlmill/sage-3.0.6/local/lib/python2.5/site-packages/sage/coding/linear_code.py in minimum_distance(self)
   1366         q = F.order()
   1367         G = self.gen_mat()
-> 1368         gapG = gap(G)
   1369         Gstr = "%s*Z(%s)^0"%(gapG, q)
   1370         return hamming_weight(min_wt_vec(Gstr,F))

/Users/rlmill/sage-3.0.6/local/lib/python2.5/site-packages/sage/interfaces/expect.py in __call__(self, x, name)
    945             return cls(self, x, name=name)
    946         try:
--> 947             return self._coerce_from_special_method(x)
    948         except TypeError:
    949             raise

/Users/rlmill/sage-3.0.6/local/lib/python2.5/site-packages/sage/interfaces/expect.py in _coerce_from_special_method(self, x)
    969             s = '_gp_'
    970         try:
--> 971             return (x.__getattribute__(s))(self)
    972         except AttributeError:
    973             return self(x._interface_init_())

/Users/rlmill/sage-3.0.6/sage_object.pyx in sage.structure.sage_object.SageObject._gap_ (sage/structure/sage_object.c:2456)()

/Users/rlmill/sage-3.0.6/sage_object.pyx in sage.structure.sage_object.SageObject._interface_ (sage/structure/sage_object.c:2082)()

/Users/rlmill/sage-3.0.6/matrix1.pyx in sage.matrix.matrix1.Matrix._gap_init_ (sage/matrix/matrix1.c:1447)()

/Users/rlmill/sage-3.0.6/integer_mod.pyx in sage.rings.integer_mod.IntegerMod_abstract._gap_init_ (sage/rings/integer_mod.c:3315)()

/Users/rlmill/sage-3.0.6/local/lib/python2.5/site-packages/sage/interfaces/gap.py in eval(self, x, newlines, strip)
    307         if len(x) == 0 or x[len(x) - 1] != ';':
    308             x += ';'
--> 309         s = Expect.eval(self, x)
    310         if newlines:
    311             return s

/Users/rlmill/sage-3.0.6/local/lib/python2.5/site-packages/sage/interfaces/expect.py in eval(self, code, strip, synchronize, **kwds)
    915         try:
    916             with gc_disabled():
--> 917                 return '\n'.join([self._eval_line(L, **kwds) for L in code.split('\n') if L != ''])
    918         except KeyboardInterrupt:
    919             # DO NOT CATCH KeyboardInterrupt, as it is being caught

/Users/rlmill/sage-3.0.6/local/lib/python2.5/site-packages/sage/interfaces/gap.py in _eval_line(self, line, allow_use_file, wait_for_prompt)
    508                         return ''
    509                 else:
--> 510                     raise RuntimeError, message
    511 
    512         except KeyboardInterrupt:

RuntimeError: Gap produced error output
user interrupt while printing

   executing Int(Z(5));

Component: interfaces

Issue created by migration from https://trac.sagemath.org/ticket/3294

@wdjoyner wdjoyner added this to the sage-3.1 milestone May 24, 2008
@sagetrac-mabshoff sagetrac-mabshoff mannequin modified the milestones: sage-3.1, sage-3.0.3 May 24, 2008
@wdjoyner
Copy link
Author

comment:2

This is wrong and I don't know how to close the ticket. What is true, at least on my machine, is that if you stop the command using ctl-C the restart it then the above happens. That might be a bug in the GAP interface, I don't know.

Sorry for the false alarm.

@sagetrac-mabshoff
Copy link
Mannequin

sagetrac-mabshoff mannequin commented May 24, 2008

comment:3

This is still a bug then and somebody should come up with a better title then.

Cheers,

Michael

@sagetrac-mabshoff sagetrac-mabshoff mannequin changed the title linear code bug: minimum_distance breaks over "large" fields linear code bug: minimum_distance breaks over "large" fields after CTRL-C May 24, 2008
@wdjoyner
Copy link
Author

comment:4

It breaks over all fields. This is after a GAP computation was stopped using ctl-C:

sage: C = HammingCode(3,GF(2))
sage: C
Linear code of length 7, dimension 4 over Finite Field of size 2
sage: C.minimum_distance()
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)

/home/wdj/sagefiles/sage-3.0.2.rc3/<ipython console> in <module>()

/home/wdj/sagefiles/sage-3.0.2.rc3/local/lib/python2.5/site-packages/sage/coding/linear_code.py in minimum_distance(self)
   1366         q = F.order()
   1367         G = self.gen_mat()
-> 1368         gapG = gap(G)
   1369         Gstr = "%s*Z(%s)^0"%(gapG, q)
   1370         return hamming_weight(min_wt_vec(Gstr,F))

/home/wdj/sagefiles/sage-3.0.2.rc3/local/lib/python2.5/site-packages/sage/interfaces/expect.py in __call__(self, x)
    948             return cls(self, x)
    949         try:
--> 950             return self._coerce_from_special_method(x)
    951         except TypeError:
    952             raise

/home/wdj/sagefiles/sage-3.0.2.rc3/local/lib/python2.5/site-packages/sage/interfaces/expect.py in _coerce_from_special_method(self, x)
    972             s = '_gp_'
    973         try:
--> 974             return (x.__getattribute__(s))(self)
    975         except AttributeError:
    976             return self(x._interface_init_())

/home/wdj/sagefiles/sage-3.0.2.rc3/sage_object.pyx in sage.structure.sage_object.SageObject._gap_ (sage/structure/sage_object.c:2257)()

/home/wdj/sagefiles/sage-3.0.2.rc3/sage_object.pyx in sage.structure.sage_object.SageObject._interface_ (sage/structure/sage_object.c:1884)()

/home/wdj/sagefiles/sage-3.0.2.rc3/matrix1.pyx in sage.matrix.matrix1.Matrix._gap_init_ (sage/matrix/matrix1.c:1287)()

/home/wdj/sagefiles/sage-3.0.2.rc3/integer_mod.pyx in sage.rings.integer_mod.IntegerMod_abstract._gap_init_ (sage/rings/integer_mod.c:3124)()

/home/wdj/sagefiles/sage-3.0.2.rc3/local/lib/python2.5/site-packages/sage/interfaces/gap.py in eval(self, x, newlines, strip)
    307         if len(x) == 0 or x[len(x) - 1] != ';':
    308             x += ';'
--> 309         s = Expect.eval(self, x)
    310         if newlines:
    311             return s

/home/wdj/sagefiles/sage-3.0.2.rc3/local/lib/python2.5/site-packages/sage/interfaces/expect.py in eval(self, code, strip, synchronize, **kwds)
    915         try:
    916             with gc_disabled():
--> 917                 return '\n'.join([self._eval_line(L, **kwds) for L in code.split('\n') if L != ''])
    918         except KeyboardInterrupt:
    919             # DO NOT CATCH KeyboardInterrupt, as it is being caught

/home/wdj/sagefiles/sage-3.0.2.rc3/local/lib/python2.5/site-packages/sage/interfaces/gap.py in _eval_line(self, line, allow_use_file, wait_for_prompt)
    508                         return ''
    509                 else:
--> 510                     raise RuntimeError, message
    511
    512         except KeyboardInterrupt:

RuntimeError: Unexpected EOF from Gap executing Int(Z(2));
sage:  

@wdjoyner wdjoyner changed the title linear code bug: minimum_distance breaks over "large" fields after CTRL-C linear code bug: minimum_distance breaks after CTRL-C May 24, 2008
@rlmill
Copy link
Mannequin

rlmill mannequin commented May 25, 2008

comment:5

Yes, the GAP interface needs a kick after using CTRL-C.

@rlmill

This comment has been minimized.

@rlmill rlmill mannequin modified the milestones: sage-3.1.1, sage-3.1 Aug 10, 2008
@rlmill rlmill mannequin changed the title linear code bug: minimum_distance breaks after CTRL-C GAP interface broken after CTRL-C Aug 10, 2008
@rlmill rlmill mannequin removed their assignment Aug 10, 2008
@rlmill rlmill mannequin added p: critical / 2 and removed p: major / 3 labels Aug 10, 2008
@mwhansen mwhansen self-assigned this Jan 23, 2009
@mwhansen
Copy link
Contributor

Attachment: trac_3294.patch.gz

@sagetrac-mabshoff
Copy link
Mannequin

sagetrac-mabshoff mannequin commented Jan 24, 2009

comment:9

Merged in Sage 3.3.alpha2

@sagetrac-mabshoff sagetrac-mabshoff mannequin closed this as completed Jan 24, 2009
@sagetrac-mabshoff sagetrac-mabshoff mannequin modified the milestones: sage-3.4.1, sage-3.3 Jan 24, 2009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants