Re: [sage-devel] CTRL-C crashes the notebook in 5.2

2012-08-01 Thread Jan Groenewald
Hi

On 31 July 2012 17:31, Charles Bouillaguet wrote:

> Hi William and all,
>
>
> > I don't see this on OS X with a fresh 5.2 build.  You might want to
>
>> give more system details -- in particular, did you build from source
>> or install a binary?
>>
>
> I am running ubuntu 12.04 (64bits), and I installed the right binary...


The right binary being  sage-5.2-linux-64bit-ubuntu_12.04_lts-x86_64-Linux ?

Jean-Pierre Flori, would you mind specifying your OS and versions?

I have tested this on Ubuntu 12.04, and sage-5.2-from-source and
the binary sage-5.2-linux-64bit-ubuntu_12.04_lts-x86_64-Linux.

Both source and binary exhibit the segfault when closing a notebook server
with Control-C.

I have tried on the source version:
sage -i http://sage.math.washington.edu/home/malb/spkgs/givaro-3.7.0.spkg
and then I got:

0 jan@muizenberg:/srv/local/Disk_Space/sage-5.2$./sage -notebook
--
| Sage Version 5.2, Release Date: 2012-07-25 |
| Type "notebook()" for the browser-based notebook interface.|
| Type "help()" for help.|
--

Please wait while the Sage Notebook server starts...
/srv/local/Disk_Space/sage-5.2/spkg/bin/sage: line 711: 16958
Segmentation  fault  (core dumped) sage-notebook "$@"


Then I tried it with an additional (not sure I'm doing this right or that
is all I need?)
hg qimport
http://trac.sagemath.org/sage_trac/attachment/ticket/9511/trac_9511_givaro_3_7_x.patch
And now I get
0 jan@muizenberg:/srv/local/Disk_Space/sage-5.2$./sage
--
| Sage Version 5.2, Release Date: 2012-07-25 |
| Type "notebook()" for the browser-based notebook interface.|
| Type "help()" for help.|
--
---
ImportError   Traceback (most recent call last)

/srv/local/Disk_Space/sage-5.2/local/lib/python2.7/site-packages/IPython/ipmaker.pyc
in force_import(modname, force_reload)
 61 reload(sys.modules[modname])
 62 else:
---> 63 __import__(modname)
 64
 65

/srv/local/Disk_Space/sage-5.2/local/bin/ipy_profile_sage.py in ()
  5 preparser(True)
  6
> 7 import sage.all_cmdline
  8 sage.all_cmdline._init_cmdline(globals())
  9

/srv/local/Disk_Space/sage-5.2/local/lib/python2.7/site-packages/sage/all_cmdline.py
in ()
 12 try:
 13
---> 14 from sage.all import *
 15 from sage.calculus.predefined import x
 16 preparser(on=True)

/srv/local/Disk_Space/sage-5.2/local/lib/python2.7/site-packages/sage/all.py
in ()
 70 from sage.libs.all   import *
 71
---> 72 from sage.rings.all  import *
 73 from sage.matrix.all import *
 74

/srv/local/Disk_Space/sage-5.2/local/lib/python2.7/site-packages/sage/rings/all.py
in ()
 63
 64 # Finite fields
---> 65 from finite_rings.all import *
 66
 67 # Number field

/srv/local/Disk_Space/sage-5.2/local/lib/python2.7/site-packages/sage/rings/finite_rings/all.py
in ()
 19
#*
 20
---> 21 from constructor import (FiniteField, is_FiniteField,
is_PrimeFiniteField,
 22   conway_polynomial,
exists_conway_polynomial)
 23 GF = FiniteField

/srv/local/Disk_Space/sage-5.2/local/lib/python2.7/site-packages/sage/rings/finite_rings/constructor.py
in ()
166 # On a Macbook Pro OSX 10.5.8, this manifests as a Bus Error on
exiting Sage.
167 # TODO: figure out why
--> 168 from finite_field_givaro import FiniteField_givaro
169
170 import sage.interfaces.gap

/srv/local/Disk_Space/sage-5.2/local/lib/python2.7/site-packages/sage/rings/finite_rings/finite_field_givaro.py
in ()
  2 from sage.rings.finite_rings.finite_field_base import FiniteField,
is_FiniteField
  3 from sage.rings.integer import Integer
> 4 from sage.rings.finite_rings.element_givaro import Cache_givaro
  5 from sage.rings.integer_ring import ZZ
  6 from sage.databases.conway import ConwayPolynomials

ImportError:
/srv/local/Disk_Space/sage-5.2/local/lib/python2.7/site-packages/sage/rings/finite_rings/element_givaro.so:
undefined symbol: _ZNK7IntegercvlEv
Error importing ipy_profile_sage - perhaps you should run %upgrade?
WARNING: Loading of ipy_profile_sage failed.

sage:

PS. I've updated the package for the PPA locally but will refrain from
uploading it until this is solved
or I know how serious it is.

Regards,
Jan

-- 
  .~.
  /V\ Jan Groenewald
 /( )\www.aims.ac.za
 ^^-^^

-- 
-- 
To post to this group, send an email to sage-devel@googlegroups.c

Re: [sage-devel] CTRL-C crashes the notebook in 5.2

2012-08-01 Thread Jean-Pierre Flori
 

> Jean-Pierre Flori, would you mind specifying your OS and versions?
>  
>
> It's built from source on Ubuntu 12.04 64 bits on some Xeon processor.

-- 
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org





Re: [sage-devel] CTRL-C crashes the notebook in 5.2

2012-08-01 Thread Jan Groenewald
Hi

So I reran the original problem (using the binary sage)
with sage -gdb.

(gdb) backtrace
#0  0x774e4c3e in waitpid () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x7746af5e in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x77b2d1a6 in posix_system (self=,
args=) at ./Modules/posixmodule.c:2660
#3  0x77aefe45 in call_function (oparg=,
pp_stack=0x7fffb290) at Python/ceval.c:4021
#4  PyEval_EvalFrameEx (f=, throwflag=) at
Python/ceval.c:2666
#5  0x77af1a95 in PyEval_EvalCodeEx (co=,
globals=, locals=, args=,
argcount=1, kws=0xbe8b98, kwcount=0, defs=0x0,
defcount=0, closure=0x480a270) at Python/ceval.c:3253
#6  0x77aefec0 in fast_function (nk=, na=1,
n=, pp_stack=0x7fffb4a0, func=0x4817b18) at
Python/ceval.c:4117
#7  call_function (oparg=, pp_stack=0x7fffb4a0) at
Python/ceval.c:4042
#8  PyEval_EvalFrameEx (f=, throwflag=) at
Python/ceval.c:2666
#9  0x77af1a95 in PyEval_EvalCodeEx (co=,
globals=, locals=, args=,
argcount=1, kws=0xbe88e0, kwcount=0,
defs=0x3dc1888, defcount=19, closure=0x0) at Python/ceval.c:3253
#10 0x77a74843 in function_call (func=0x3f949b0, arg=0x46dba50,
kw=0xbdea90) at Objects/funcobject.c:526
#11 0x77a4c7a3 in PyObject_Call (func=0x3f949b0, arg=, kw=) at Objects/abstract.c:2529
#12 0x77aed5ca in ext_do_call (nk=0, na=,
flags=, pp_stack=0x7fffb780, func=0x3f949b0) at
Python/ceval.c:4334
#13 PyEval_EvalFrameEx (f=, throwflag=) at
Python/ceval.c:2705
#14 0x77af1a95 in PyEval_EvalCodeEx (co=,
globals=, locals=, args=,
argcount=1, kws=0x0, kwcount=0, defs=0x0,
defcount=0, closure=0x0) at Python/ceval.c:3253
#15 0x77a7474c in function_call (func=0x3f94aa0, arg=0xd31390,
kw=0x0) at Objects/funcobject.c:526
#16 0x77a4c7a3 in PyObject_Call (func=0x3f94aa0, arg=, kw=) at Objects/abstract.c:2529
#17 0x77a59f1f in instancemethod_call (func=0x3f94aa0,
arg=0xd31390, kw=0x0) at Objects/classobject.c:2578
#18 0x77a4c7a3 in PyObject_Call (func=0x46d68c0, arg=, kw=) at Objects/abstract.c:2529
#19 0x77a58f2b in instance_call (func=,
arg=0x77f83050, kw=0x0) at Objects/classobject.c:2129
#20 0x77a4c7a3 in PyObject_Call (func=0x3f8fb48, arg=, kw=) at Objects/abstract.c:2529
#21 0x77aeea6d in do_call (nk=, na=,
pp_stack=0x7fffbd70, func=0x3f8fb48) at Python/ceval.c:4239
#22 call_function (oparg=, pp_stack=0x7fffbd70) at
Python/ceval.c:4044
#23 PyEval_EvalFrameEx (f=, throwflag=) at
Python/ceval.c:2666
#24 0x77af1a95 in PyEval_EvalCodeEx (co=,
globals=, locals=, args=,
argcount=0, kws=0x0, kwcount=0, defs=0x0,
defcount=0, closure=0x0) at Python/ceval.c:3253
#25 0x77af1bd2 in PyEval_EvalCode (co=,
globals=, locals=) at Python/ceval.c:667
#26 0x77aefbff in exec_statement (locals=0xb8f900,
globals=0xb8f900, prog=, f=0x420ccb0) at Python/ceval.c:4718
#27 PyEval_EvalFrameEx (f=, throwflag=) at
Python/ceval.c:1880
#28 0x77af1a95 in PyEval_EvalCodeEx (co=,
globals=, locals=, args=,
argcount=2, kws=0x420c610, kwcount=0,
defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3253
#29 0x77aefec0 in fast_function (nk=, na=2,
n=, pp_stack=0x7fffc1c0, func=0xb299b0) at
Python/ceval.c:4117
#30 call_function (oparg=, pp_stack=0x7fffc1c0) at
Python/ceval.c:4042
#31 PyEval_EvalFrameEx (f=, throwflag=) at
Python/ceval.c:2666
#32 0x77af1a95 in PyEval_EvalCodeEx (co=,
globals=, locals=, args=,
argcount=3, kws=0x472def0, kwcount=0,
defs=0xb25de8, defcount=2, closure=0x0) at Python/ceval.c:3253
#33 0x77aefec0 in fast_function (nk=, na=3,
n=, pp_stack=0x7fffc3d0, func=0xb29938) at
Python/ceval.c:4117
#34 call_function (oparg=, pp_stack=0x7fffc3d0) at
Python/ceval.c:4042
#35 PyEval_EvalFrameEx (f=, throwflag=) at
Python/ceval.c:2666
#36 0x77af0beb in fast_function (nk=, na=2,
n=, pp_stack=0x7fffc530, func=0xb29a28) at
Python/ceval.c:4107
#37 call_function (oparg=, pp_stack=0x7fffc530) at
Python/ceval.c:4042
#38 PyEval_EvalFrameEx (f=, throwflag=) at
Python/ceval.c:2666
#39 0x77af1a95 in PyEval_EvalCodeEx (co=,
globals=, locals=, args=,
argcount=2, kws=0x4739058, kwcount=0,
defs=0xb1f968, defcount=1, closure=0x0) at Python/ceval.c:3253
#40 0x77aefec0 in fast_function (nk=, na=2,
n=, pp_stack=0x7fffc740, func=0xb29578) at
Python/ceval.c:4117
#41 call_function (oparg=, pp_stack=0x7fffc740) at
Python/ceval.c:4042
#42 PyEval_EvalFrameEx (f=, throwflag=) at
Python/ceval.c:2666
#43 0x77af1a95 in PyEval_EvalCodeEx (co=,
globals=, locals=, args=,
argcount=2, kws=0xbe98a0, kwcount=0,
defs=0xb1f928, defcount=1, closure=0x0) at Python/ceval.c:3253
#44 0x77aefec0 in fast_function (nk=, na=2,
n=, pp_stack=0x7fffc950, func=0xb292a8) at
Python/ceval.c:4117
#45 call_function (oparg=, pp_stack=0x7fffc950) at
Python/ceval.c:4042
#46 PyEval_EvalFrameEx (f=, throwflag=) at
Python/ceval.c:2666
#47 0x77af1a95 in Py

[sage-devel] Re: homomorphisms between free modules over different rings

2012-08-01 Thread Maarten Derickx
This is now http://trac.sagemath.org/sage_trac/ticket/13321

Le samedi 7 juillet 2012 17:02:40 UTC+2, Maarten Derickx a écrit :
>
> And the following is even more worrying:
>
> sage: (GF(7)^2).hom([[20,0],[0,21]],ZZ^2)
> Free module morphism defined by the matrix
> [6 0]
> [0 0]
> Domain: Vector space of dimension 2 over Finite Field of size 7
> Codomain: Ambient free module of rank 2 over the principal ideal domain 
> Integer Ring
>
>

-- 
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org





[sage-devel] Re: Documenting Factory Functions (RE trac #13282)

2012-08-01 Thread Jason Grout

On 7/31/12 7:07 AM, Andrey Novoseltsev wrote:

I guess you can also have imports inside the functions - if they are
not called too often it should not be a big performance penalty.


IIRC, the imports are cached automatically in Python, so it would be a 
performance hit the first time the function was called (if that module 
hadn't been imported somewhere already), but after that, it should be 
pretty fast.


Thanks,

Jason


--
--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org





[sage-devel] Re: Documenting Factory Functions (RE trac #13282)

2012-08-01 Thread Simon King
Hi Jason,

On 2012-08-01, Jason Grout  wrote:
> On 7/31/12 7:07 AM, Andrey Novoseltsev wrote:
>> I guess you can also have imports inside the functions - if they are
>> not called too often it should not be a big performance penalty.
>
> IIRC, the imports are cached automatically in Python, so it would be a 
> performance hit the first time the function was called (if that module 
> hadn't been imported somewhere already), but after that, it should be 
> pretty fast.

No, the overhead is considerable:

  sage: def test1(s):
  : from sage.all import ZZ
  : return ZZ(s)
  : 
  sage: def test2(s):
  : return ZZ(s)
  : 
  sage: %timeit a = test1('123')
  625 loops, best of 3: 6.47 µs per loop
  sage: %timeit a = test2('123')
  625 loops, best of 3: 2.8 µs per loop

So, if you have a "small" function or method that is called very often
then better avoid local imports.

Best regards,
Simon


-- 
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org





[sage-devel] sagepad.org and thoughts on security

2012-08-01 Thread Volker Braun
I've been thinking about how one can allow arbitrary code execution in a 
web service, which is essentially what the Sage notebook wants to do. As a 
testbed to try out some ideas I set up 

http://www.sagepad.org

which is similar to codepad(.org) but for Sage. The code is on github 
(https://github.com/vbraun/sagepad). It uses flask-celery and the rabbitmq 
amqp messaging to communicate between web server and workers, no database 
polling involved. This works very well so far, and might be a good idea to 
look into for the Sage notebook. Evaluation always starts a new Sage 
process right now, which is why its relatively high latency right now. At 
least the last part will be easily fixable. 

Currently, I'm just using the classic Unix permissions to secure the 
worker. And of course a kvm virtual machine to isolate it. But unless we 
want to revert the whole VM between calls (relatively slow), one should not 
rely on that part. Really, I think a targeted SELinux policy is the way to 
lock down the sage worker process. Its exactly designed for that purpose: 
deny everything by default, and make specific allowances in a fine-grained 
manner. The only alternative I can think of would be light-weight 
containers (e.g. LXC), but they are a bit too new (and too much of a moving 
target) for my taste. But if you have an opinion on that, please share...

-- 
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org





[sage-devel] Re: sagepad.org and thoughts on security

2012-08-01 Thread Jason Grout

On 8/1/12 1:13 PM, Volker Braun wrote:

I've been thinking about how one can allow arbitrary code execution in a
web service, which is essentially what the Sage notebook wants to do. As
a testbed to try out some ideas I set up

http://www.sagepad.org

which is similar to codepad(.org) but for Sage. The code is on github
(https://github.com/vbraun/sagepad). It uses flask-celery and the
rabbitmq amqp messaging to communicate between web server and workers,
no database polling involved. This works very well so far, and might be
a good idea to look into for the Sage notebook. Evaluation always starts
a new Sage process right now, which is why its relatively high latency
right now. At least the last part will be easily fixable.


I'm glad a lot of people are exploring ideas for a better framework for 
execution.  I can't look at this in detail right now, but I'm watching 
the github repository.  Let us know your progress!


Control-enter doesn't seem to submit work for me in Chrome on OS X.

Thanks,

Jason

--
--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org





[sage-devel] OS X Mountain Lion working?

2012-08-01 Thread Jason Grout
Has anyone tried compiling Sage on the released OS X Mountain Lion?  Or 
running tests?


Thanks,

Jason

--
--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org





[sage-devel] Re: OS X Mountain Lion working?

2012-08-01 Thread John H Palmieri


On Wednesday, August 1, 2012 9:29:55 PM UTC-7, jason wrote:
>
> Has anyone tried compiling Sage on the released OS X Mountain Lion?  Or 
> running tests? 
>

Yes. It doesn't compile; there are problems with python and mercurial, for 
starters. See 
 and 
.

-- 
John

-- 
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org