Ticket #3294 (new defect)

Opened 6 months ago

Last modified 4 months ago

GAP interface broken after CTRL-C

Reported by: wdj Assigned to:
Priority: critical Milestone: sage-3.2.2
Component: interfaces Keywords:
Cc:

Description (Last modified by rlm)

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));

Change History

05/24/2008 01:25:16 PM changed by mabshoff

  • milestone changed from sage-3.1 to sage-3.0.3.

05/24/2008 01:27:22 PM changed by wdj

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.

05/24/2008 01:30:36 PM changed by mabshoff

  • summary changed from linear code bug: minimum_distance breaks over "large" fields to linear code bug: minimum_distance breaks over "large" fields after CTRL-C.

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

Cheers,

Michael

05/24/2008 01:39:03 PM changed by wdj

  • summary changed from linear code bug: minimum_distance breaks over "large" fields after CTRL-C to linear code bug: minimum_distance breaks after CTRL-C.

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:  

05/24/2008 06:30:19 PM changed by rlm

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

08/09/2008 08:38:39 PM changed by rlm

  • description changed.
  • component changed from coding theory to interfaces.
  • summary changed from linear code bug: minimum_distance breaks after CTRL-C to GAP interface broken after CTRL-C.
  • priority changed from major to critical.
  • milestone changed from sage-3.1.1 to sage-3.1.
  • owner deleted.