sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.43k stars 479 forks source link

Upgrade to Singular-3-1-7p1 #17184

Closed jdemeyer closed 9 years ago

jdemeyer commented 10 years ago

Singular 3-1-7p1 repackaged (see spkg-src):

CC: @vbraun @nbruin @burcin

Component: packages: standard

Author: Jean-Pierre Flori

Branch/Commit: 4e287c4

Reviewer: Volker Braun

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

jpflori commented 9 years ago
comment:44

Some additional patches were integrated into the 3-1-7p1 release.

Hopefully the p1 part of the upstream version number and the p0 from our patch level won't clash.

jpflori commented 9 years ago

Description changed:

--- 
+++ 
@@ -1,2 +1,2 @@
 Singular 3-1-7p1 repackaged (see spkg-src):
-* http://boxen.math.washington.edu/home/jpflori/upstream/singular-3.1.7.tar.bz2
+* http://boxen.math.washington.edu/home/jpflori/upstream/singular-3.1.7p1.tar.bz2
vbraun commented 9 years ago
comment:46

lgtm

jpflori commented 9 years ago
comment:47

I got two failing doctests in sage/interfaces/test.py and indeed it seems I can get Singular to crash by issuing: """ sage: 2*singular('2') Singular crashed -- automatically restarting. """ but then the same command is ok. And just """ sage: singular('2') 2 """ is ok.

So maybe coercion is involved here... I suggest to deal with it in a separate ticket as it only involves debug builds.

vbraun commented 9 years ago
comment:48

I also get them, but only on the buildbot with SAGE_DEBUG=yes

sage -t --long src/sage/interfaces/tests.py
**********************************************************************
File "src/sage/interfaces/tests.py", line 20, in sage.interfaces.tests
Failed example:
    a = 2 * singular('2'); a
Exception raised:
    Traceback (most recent call last):
      File "/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 488, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 851, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.interfaces.tests[7]>", line 1, in <module>
        a = Integer(2) * singular('2'); a
      File "sage/structure/element.pyx", line 1763, in sage.structure.element.RingElement.__mul__ (build/cythonized/sage/structure/element.c:16813)
      File "sage/structure/coerce.pyx", line 797, in sage.structure.coerce.CoercionModel_cache_maps.bin_op (build/cythonized/sage/structure/coerce.c:7925)
      File "sage/structure/coerce.pyx", line 793, in sage.structure.coerce.CoercionModel_cache_maps.bin_op (build/cythonized/sage/structure/coerce.c:7872)
      File "sage/structure/element.pyx", line 1758, in sage.structure.element.RingElement.__mul__ (build/cythonized/sage/structure/element.c:16745)
      File "sage/structure/element.pyx", line 1765, in sage.structure.element.RingElement._mul_ (build/cythonized/sage/structure/element.c:16890)
      File "/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/lib/python2.7/site-packages/sage/interfaces/interface.py", line 1121, in _mul_
        return self._operation('*', right)
      File "/mnt/disk/home/buildslave-sage/slave/sage_git/build/local/lib/python2.7/site-packages/sage/interfaces/interface.py", line 1078, in _operation
        raise TypeError(msg)
    TypeError: Singular error:
       ? `sage0` is not defined
       ? error occurred in or before STDIN line 17: `def sage23=sage22 * sage0;`
**********************************************************************
File "src/sage/interfaces/tests.py", line 22, in sage.interfaces.tests
Failed example:
    parent(a)
Expected:
    Singular
Got:
    Maxima
**********************************************************************
vbraun commented 9 years ago
comment:49

Can you try to fix this? If we merge it then that makes one of our buildbots basically useless...

jpflori commented 9 years ago
comment:50

I'll give it a shot, but as Singular is a standalone process I need some dark magic to attach gdb to it and debug it.

jpflori commented 9 years ago
comment:51

Backtrace:

(gdb) bt
#0  0x00000000102e98a8 in p_Init (r=0x0) at ../kernel/pInline1.h:108
#1  0x00000000102edd6c in p_One (r=0x0) at p_polys.cc:1170
#2  0x00000000100ba578 in jjE (res=0x3ffff92fe068, v=0x3ffff92fb388) at iparith.cc:4056
#3  0x00000000100cd7b0 in iiExprArith1 (res=0x3ffff92fe068, a=0x3ffff92fb388, op=291) at iparith.cc:7992
#4  0x000000001011d390 in yyparse () at grammar.y:626
#5  0x00000000100a619c in main (argc=4, argv=0x3ffff92ff628) at tesths.cc:245
vbraun commented 9 years ago
comment:52

Run with SAGE_PEXPECT_LOG=yes, this will log to $DOT_SAGE/pexpect_logs

jpflori commented 9 years ago
comment:53

Thanks a lot for the pointer. Here is what Singular is fed with:

...
> def sage1="redTail";
> def sage2=option(sage1);
// ** right side is not a datum, assignment ignored^M
> if(defined(sage1)){kill sage1;};if(defined(sage2)){kill sage2;};def sage3="redThrough";
> def sage4=option(sage3);
// ** right side is not a datum, assignment ignored^M
> if(defined(sage3)){kill sage3;};if(defined(sage4)){kill sage4;};def sage5="intStrategy";
> def sage6=option(sage5);
// ** right side is not a datum, assignment ignored^M
> option(get);
100663424,10321^M
> if(defined(sage5)){kill sage5;};if(defined(sage6)){kill sage6;};intvec sage7=100663424,10321;
> def sage0=2;
> print(sage0);
2^M
> def sage8=2;
> def sage9=0;
> def sage10=gen(sage9);
Singular : signal 11 (v: 3170):^M
current line:>>def sage10=gen(sage9);<<^M
Segment fault/Bus error occurred (r:1416496567)^M
please inform the authors^M
^M
// ***dError: Caught Signal 11 occured at: ^M
quit

And on relaunch:

...
> def sage11="redTail";
> def sage12=option(sage11);
// ** right side is not a datum, assignment ignored^M
> if(defined(sage11)){kill sage11;};if(defined(sage12)){kill sage12;};def sage13="redThrough";
> def sage14=option(sage13);
// ** right side is not a datum, assignment ignored^M
> if(defined(sage13)){kill sage13;};if(defined(sage14)){kill sage14;};def sage15="intStrategy";
> def sage16=option(sage15);
// ** right side is not a datum, assignment ignored^M
> option(get);
100663424,10321^M
> if(defined(sage15)){kill sage15;};if(defined(sage16)){kill sage16;};intvec sage17=100663424,10321;
> def sage10=gen(sage9);
   ? `sage9` is not defined^M
   ? error occurred in or before STDIN line 10: `def sage10=gen(sage9);`^M
> def sage18=gen();
   ? error occurred in or before STDIN line 11: `def sage18=gen();`^M
   ? last reserved name was `gen`^M
   skipping text from `;` error at token `)`^M
> def sage19=_an_element_;
   ? error occurred in or before STDIN line 12: `def sage19=_an_element_;`^M
   ? last reserved name was `def`^M
   skipping text from `;` error at token `$INVALID$`^M
> def sage20=pi;
   ? `pi` is undefined^M
   ? error occurred in or before STDIN line 13: `def sage20=pi;`^M
> def sage21=1.2;
   ? no ring active^M
   ? error occurred in or before STDIN line 14: `def sage21=1.2;`^M
> def sage22=2;
> def sage23=2;
> def sage24=sage23 * sage8;
   ? `sage8` is not defined^M
   ? error occurred in or before STDIN line 17: `def sage24=sage23 * sage8;`^M
> def sage25=2;
> print(sage25);
2^M
> def sage26=2;
> def sage27=2;
> def sage28=sage27 * sage26;
> print(sage28);
4^M
> quit
jpflori commented 9 years ago
comment:54

Ok, the issue is that currRing is NULL when pOne is called.

jpflori commented 9 years ago
comment:55

It seems Singular 3-1-6 was more careful:

> def sage8=2;
> def sage9=0;
> def sage10=gen(sage9);
   ? no ring active
   ? error occurred in or before STDIN line 14: `def sage10=gen(sage9);`
vbraun commented 9 years ago
comment:56

Looks like an upstream bug, did you post it there?

jpflori commented 9 years ago
comment:57

Not yet, still investigating, it seems the following change (here reversed) between 3-1-6 and 3-1-7 may be the issue:

diff -druN latest.orig/Singular/iparith.cc latest.new/Singular/iparith.cc
--- latest.orig/Singular/iparith.cc     2014-11-19 05:06:05.000000000 -0800
+++ latest.new/Singular/iparith.cc      2014-11-20 08:30:25.068389635 -0800
@@ -8477,7 +8477,6 @@
     sArithBase.sCmds[i].name);
     sArithBase.sCmds[i].alias=1;
   }
-  #if 0
   if (currRingHdl==NULL)
   {
     #ifdef SIQ
@@ -8493,7 +8492,6 @@
     }
     #endif
   }
-  #endif
   if (!expected_parms)
   {
     switch (tok)
jpflori commented 9 years ago
comment:58

For future ref the change was part of Singular commit:

jpflori commented 9 years ago
comment:59

Upstream report at:

And removing the "#if 0" makes the simple test pass. Running again the testsuite now.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

0a5f695Try to prevent Singular from segfaulting.
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from 9b3b933 to 0a5f695

jpflori commented 9 years ago
comment:61

Things look fine for me except for timeouts which I already got before in debug mode, and two spurious errors I can not reproduce.

vbraun commented 9 years ago
comment:62

Fails on OSX with (this is a fresh install):

g++ -O2 -g  -fPIC -I.. -I/Users/buildslave-sage/slave/sage_git/build/local -pipe -I. -I.. -I/Users/buildslave-sage/slave/sage_git/build/local -I/Users/buildslave-sage/slave/sage_git/build/local/include -I/Users/buildslave-sage/slave/sage_git/build/local/include -I/Users/buildslave-sage/slave/sage_git/build/local/include   -I/Users/buildslave-sage/slave/sage_git/build/local/include -fno-implicit-templates -I.. -I/Users/buildslave-sage/slave/sage_git/build/local -DNDEBUG -DOM_NDEBUG -Dx86_64Mac_darwin -DHAVE_CONFIG_H \
      -o Singular \
      tesths.cc iparith.o mpsr_Tok.o claptmpl.o\
      grammar.o scanner.o attrib.o blackbox.o eigenval_ip.o extra.o fehelp.o feOpt.o ipassign.o ipconv.o ipid.o iplib.o ipprint.o ipshell.o newstruct.o lists.o sdb.o fglm.o interpolation.o silink.o ssiLink.o s_buff.o subexpr.o janet.o wrapper.o libparse.o sing_win.o gms.o pcv.o maps_ip.o walk.o walk_ip.o cntrlc.o misc_ip.o calcSVD.o pipeLink.o Minor.o MinorProcessor.o MinorInterface.o bigintm.o pyobject_setup.o denom_list.o minpoly.o countedref.o singmathic.o semaphore.o rlimit.o slInit_Static.o mpsr_Put.o mpsr_PutPoly.o mpsr_GetPoly.o mpsr_sl.o mpsr_Get.o mpsr_GetMisc.o mpsr_Error.o ndbm.o sing_dbm.o -dynamic -L/Users/buildslave-sage/slave/sage_git/build/local/kernel -L../kernel -lkernel -L/Users/buildslave-sage/slave/sage_git/build/local/lib -L/Users/buildslave-sage/slave/sage_git/build/local/lib  -L/Users/buildslave-sage/slave/sage_git/build/local/lib -lflint -lmpfr -lmpir  -ldl -lm -lsingfac -lsingcf -lflint -lmpfr -lntl -lgmp -lreadline -ltermcap -lpthread -lm   -lomalloc  ../kernel/mmalloc.o 
ld: warning: directory not found for option '-L/Users/buildslave-sage/slave/sage_git/build/local/kernel'
duplicate symbol NTL::Mat<NTL::zz_p>::Mat()  in:
    claptmpl.o
    /Users/buildslave-sage/slave/sage_git/build/local/lib/libsingcf.a(ftmpl_inst.o)

and more like that, see http://build.sagedev.org/release/builders/%20%20fast%20Volker%20MiniMac%20%28OSX%2010.10%20x86_64%29%20full/builds/0/steps/compile_1/logs/singular

jpflori commented 9 years ago
comment:63

Can you try without templates.patch?

jpflori commented 9 years ago
comment:64

Anyway, I don't see any use of the instantiated NTL classes within the Singular directory files, so I'll just update our patches to remove the explicit instantiations in claptmpl.cc.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from 0a5f695 to 4e287c4

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

4e287c4Remove useless explicit templates instantiations in Singular.
vbraun commented 9 years ago

Changed branch from u/jpflori/ticket/17184 to 4e287c4