#11551: Pari segfault on Sage startup in Cygwin
------------------------+---------------------------------------------------
   Reporter:  kcrisman  |          Owner:  tbd       
       Type:  defect    |         Status:  new       
   Priority:  major     |      Milestone:  sage-4.7.2
  Component:  cygwin    |       Keywords:  pari      
Work_issues:            |       Upstream:  N/A       
   Reviewer:            |         Author:            
     Merged:            |   Dependencies:            
------------------------+---------------------------------------------------

Comment(by kcrisman):

 Replying to [comment:26 jdemeyer]:
 > Replying to [comment:24 kcrisman]:
 > > But here is something perhaps slightly more interesting. If I print
 before and after
 > > I get `bot=0` before, but `bot=212...` after, but `bot=0` again by the
 time the program segfaults.
 >
 > `bot == 0` is certainly very bad and is surely the cause of the
 segfault.  It would be great if you could figure out why `bot` is set to
 zero.

 Hmm, okay.  So here is what I discovered so far:
  * The !PariInstance init is called well before the Pynac initialization.
  * In the !PariInstance init, the actual deep copy is called three times,
 and all is well.
  * I am able to insert a statement like
 {{{
 print "bot is now", bot
 }}}
    in `real_mpfr.pyx`.
  * I am '''not''' allowed to do this in other files where !PariInstance is
 imported, such as `matrix/matrix_integer_dense.pyx`.  On the very
 reasonable grounds that
 {{{
 undeclared name not builtin:bot
 }}}

 Well!  So why the heck is `real_mpfr.pyx` allowing me to insert this print
 statement in the first place?   It seems like this is why bot is causing
 problems - it shouldn't even be defined.  Nowhere else in that file is bot
 used, other than in my print statements, as far as I could tell.

 Anyway, in integer.pyx, Cython doesn't complain about this, and to my
 surprise bot is already 0 there!

 Let's look at the relevant order in sage/all.py:
 {{{
 <snip>
 from sage.libs.all       import *  # here is where Pari gets imported, and
 hence the PariInstance

 from sage.rings.all      import * # here is where integer.pyx presumably
 is initialized and bot is already zero
 from sage.matrix.all     import *

 # This must come before Calculus -- it initializes the Pynac library.
 import sage.symbolic.pynac # here is where the symptom turned up while
 initializing the square root of -1
 }}}

 I'll try to look into this a little more now, otherwise more tomorrow.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11551#comment:27>
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.

Reply via email to