Opened 5 years ago

Closed 5 years ago

#17184 closed enhancement (fixed)

Upgrade to Singular-3-1-7p1

Reported by: jdemeyer Owned by:
Priority: major Milestone: sage-6.4
Component: packages: standard Keywords:
Cc: vbraun, nbruin, burcin Merged in:
Authors: Jean-Pierre Flori Reviewers: Volker Braun
Report Upstream: N/A Work issues:
Branch: 4e287c4 (Commits) Commit: 4e287c4a5a72e1a23c35046c71bddde9786110cc
Dependencies: Stopgaps:

Change History (67)

comment:1 Changed 5 years ago by jdemeyer

  • Branch set to u/jdemeyer/ticket/17184
  • Created changed from 10/20/14 20:04:32 to 10/20/14 20:04:32
  • Modified changed from 10/20/14 20:04:32 to 10/20/14 20:04:32

comment:2 Changed 5 years ago by jdemeyer

  • Commit set to 7c3f691d1f544592516312f2e4961239baf6d262

boxen is down, cannot test...


New commits:

7c3f691Upgrade to Singular-3-1-7

comment:3 Changed 5 years ago by jpflori

One thing I actually did not test because i just forgot: check that it still builds with SAGE_DEBUG as it is quite involved for Singular.

comment:4 Changed 5 years ago by jpflori

Boxen is back up (from here at least)!

comment:5 Changed 5 years ago by git

  • Commit changed from 7c3f691d1f544592516312f2e4961239baf6d262 to 1027b8fbfced15a69dc4b4da4511eb43470b631e

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

1027b8fDocument templates.patch

comment:6 Changed 5 years ago by fbissey

That's a lot of dropped patches. That, on its own, would justify the upgrade.

comment:7 Changed 5 years ago by jpflori

Needs some work for the debug version. I'm on it.

comment:8 Changed 5 years ago by jpflori

  • Branch changed from u/jdemeyer/ticket/17184 to u/jpflori/ticket/17184
  • Commit changed from 1027b8fbfced15a69dc4b4da4511eb43470b631e to f70af8cc6cb04621cc785681e894724066d7b36b

Should compile ok in debug mode now, though potentially not on top of the new NTL.


New commits:

3968376Update patches for Singular 3-1-7.
f70af8cAdd new alias for Singular debug memory allocation.

comment:9 Changed 5 years ago by git

  • Commit changed from f70af8cc6cb04621cc785681e894724066d7b36b to cdedfc61ca715961acca343dea87e7e5c1163063

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

cdedfc6Correct fuzz for Singular patches.

comment:10 Changed 5 years ago by jpflori

  • Status changed from new to needs_review

comment:11 Changed 5 years ago by jdemeyer

Without the latest debug patches, without SAGE_DEBUG=yes, together with NTL-6.2.1:

sage -t --long src/sage/schemes/plane_curves/constructor.py
**********************************************************************
File "src/sage/schemes/plane_curves/constructor.py", line 69, in sage.schemes.plane_curves.constructor.Curve
Failed example:
    C.genus()
Expected:
    1
Got:
    // ** redefining my_awesome_sage_ring **
    1
**********************************************************************
1 item had failures:
   1 of  30 in sage.schemes.plane_curves.constructor.Curve
    [29 tests, 1 failure, 1.96 s]
sage -t --long src/sage/schemes/plane_curves/curve.py
**********************************************************************
File "src/sage/schemes/plane_curves/curve.py", line 116, in sage.schemes.plane_curves.curve.Curve_generic.geometric_genus
Failed example:
    C.geometric_genus()
Expected:
          1
Got:
    // ** redefining my_awesome_sage_ring **
    1
**********************************************************************
1 item had failures:
   1 of  16 in sage.schemes.plane_curves.curve.Curve_generic.geometric_genus
    [35 tests, 1 failure, 1.65 s]
sage -t --long src/sage/rings/polynomial/multi_polynomial_ideal.py
**********************************************************************
File "src/sage/rings/polynomial/multi_polynomial_ideal.py", line 1971, in sage.rings.polynomial.multi_polynomial_ideal.?.integral_closure
Failed example:
    I.integral_closure()
Expected:
    [x^2, y^5, -x*y^3]
Got:
    [x^2, x*y^4, y^5, x*y^3]
**********************************************************************
1 item had failures:
   1 of   4 in sage.rings.polynomial.multi_polynomial_ideal.?.integral_closure
    [708 tests, 1 failure, 11.48 s]
sage -t --long src/sage/schemes/plane_curves/projective_curve.py
**********************************************************************
File "src/sage/schemes/plane_curves/projective_curve.py", line 70, in sage.schemes.plane_curves.projective_curve.ProjectiveCurve_generic.arithmetic_genus
Failed example:
    C.genus()
Expected:
    4
Got:
    // ** redefining my_awesome_sage_ring **
    4
**********************************************************************

comment:12 Changed 5 years ago by jdemeyer

I get these doctest failures also with the latest version of this ticket, without NTL.

comment:13 Changed 5 years ago by jdemeyer

  • Status changed from needs_review to needs_work

comment:14 follow-up: Changed 5 years ago by jpflori

  • Cc vbraun nbruin added

I don't really remember who committed the "my_awesome_ring" code. Was it Volker, or Nils, or anyone else? I didn't have a look at the code yet, but if the author could help, that would... help!

comment:15 Changed 5 years ago by jpflori

Looking at the failing example in src/sage/schemes/plane_curves/constructor.py, which is a call to genus going through Singular, it seems that there are three creations of SingularFunction objects:

  • twice normal__lib;
  • then genus.

Somehow the global currRingHdl is set back to zero when the second normal__lib object is created. This was not the case with 3.1.6. (I'm just discovering the way Singular internally works, so my description may seem naive and wrong.)

comment:16 Changed 5 years ago by vbraun

Wasn't me, but if there were any changes to the genus function then hopefully they fix #15477

comment:17 Changed 5 years ago by jpflori

When the normal lib is loaded, currRingHdl is set back to zero. Here is when:

#0  rSetHdl (h=0x0) at ipshell.cc:4592
#1  0x00003fffa487ce04 in iiPStart (pn=<optimized out>, v=<optimized out>) at iplib.cc:456
#2  0x00003fffa487d334 in iiMake_proc (pn=0x3fffa426dd10, pack=0x3fffa42584b8, sl=0x0) at iplib.cc:612
#3  0x00003fffa487f65c in iiRunInit (p=<error reading variable: value has been optimized out>) at iplib.cc:889
#4  iiLoadLIB (fp=0x0, libnamebuf=0x3fffffffa280 "/home/jpflori/sage.git/local/share/singular/modstd.lib", newlib=0x3fffa4270280 "modstd.lib", 
    pl=<optimized out>, autoexport=<optimized out>, tellerror=<optimized out>) at iplib.cc:941
#5  0x00003fffa487f840 in iiLibCmd (newlib=0x3fffa4270280 "modstd.lib", autoexport=<optimized out>, tellerror=<optimized out>, force=<optimized out>)
    at iplib.cc:842
#6  0x00003fffa487f3f8 in iiLoadLIB (fp=0x0, libnamebuf=0x3fffffffa4a0 "/home/jpflori/sage.git/local/share/singular/locnormal.lib", newlib=
    0x3fffa42701a0 "locnormal.lib", pl=<optimized out>, autoexport=<optimized out>, tellerror=<optimized out>) at iplib.cc:950
#7  0x00003fffa487f840 in iiLibCmd (newlib=0x3fffa42701a0 "locnormal.lib", autoexport=<optimized out>, tellerror=<optimized out>, 
    force=<optimized out>) at iplib.cc:842
#8  0x00003fffa487f3f8 in iiLoadLIB (fp=0x0, libnamebuf=0x3fffffffa6c0 "/home/jpflori/sage.git/local/share/singular/reesclos.lib", newlib=
    0x3fffa4254b20 "reesclos.lib", pl=<optimized out>, autoexport=<optimized out>, tellerror=<optimized out>) at iplib.cc:950
#9  0x00003fffa487f840 in iiLibCmd (newlib=0x3fffa4254b20 "reesclos.lib", autoexport=<optimized out>, tellerror=<optimized out>, 
    force=<optimized out>) at iplib.cc:842
#10 0x00003fffa487f3f8 in iiLoadLIB (fp=0x0, libnamebuf=0x3fffffffa8e0 "/home/jpflori/sage.git/local/share/singular/normal.lib", newlib=
    0x3fffa4254a60 "normal.lib", pl=<optimized out>, autoexport=<optimized out>, tellerror=<optimized out>) at iplib.cc:950
#11 0x00003fffa487f840 in iiLibCmd (newlib=0x3fffa4254a60 "normal.lib", autoexport=<optimized out>, tellerror=<optimized out>, force=<optimized out>)
    at iplib.cc:842
#12 0x00003fffa4082cd8 in __pyx_pf_4sage_4libs_8singular_8function_10lib (__pyx_self=<optimized out>, __pyx_v_name='normal.lib')
    at build/cythonized/sage/libs/singular/function.cpp:16752
#13 __pyx_pw_4sage_4libs_8singular_8function_11lib (__pyx_self=<optimized out>, __pyx_v_name='normal.lib')
    at build/cythonized/sage/libs/singular/function.cpp:16623
#14 0x00003fffb7ecbfb4 in call_function (oparg=<optimized out>, pp_stack=0x3fffffffab28) at Python/ceval.c:4021
#15 PyEval_EvalFrameEx (f=
    Frame 0x3fff9e5b0b60, for file /home/jpflori/sage.git/local/lib/python2.7/site-packages/sage/libs/singular/function_factory.py, line 44, in __getattr__ (self=<type unknown at remote 0x3fffa40dee90>, name='normal'), throwflag=<optimized out>) at Python/ceval.c:2679
#16 0x00003fffb7ecd7e0 in PyEval_EvalCodeEx (co=<code at remote 0x3fffa40f9430>, globals=<optimized out>, locals=<optimized out>, 
    args=<optimized out>, argcount=<optimized out>, kws=<optimized out>, kwcount=<optimized out>, defs=0x0, defcount=0, closure=0x0)
    at Python/ceval.c:3265
#17 0x00003fffb7e1d5d4 in function_call (func=<function at remote 0x3fffa40fc2a8>, arg=(<type unknown at remote 0x3fffa40dee90>, 'normal__lib'), kw=
    0x0) at Objects/funcobject.c:526

comment:18 Changed 5 years ago by jpflori

And this is the new piece of code in 3-1-7 in iplib.cc around line 453:

+    if ((currRing!=NULL) &&
+      ((currRingHdl==NULL)||(IDRING(currRingHdl)!=currRing)
+       ||(IDLEV(currRingHdl)>=myynest-1)))
+    {
+      rSetHdl(rFindHdl(currRing,NULL));
+      iiLocalRing[myynest-1]=NULL;
+    }

In fact the whole block (not only the one included above) used to be around line 556 in 3-1-6.

comment:19 Changed 5 years ago by jpflori

In that very piece of code, Singular 4-0-1 and 3-1-7 look similar, so we might face this issue even if going for 4-0-1 directly...

comment:20 Changed 5 years ago by jpflori

Groumpf, I don't remmeber if anyone from the Singualr team has an account here on trac...

comment:21 Changed 5 years ago by jakobkroeker

Groumpf, I don't remmeber if anyone from the Singualr team has an account here on trac...

I do, you are welcome to ask questions if you have any.

Jakob

comment:22 Changed 5 years ago by jpflori

The following segfaults with Singular 3-1-7.

  • 3-1-6:
    sage: from sage.libs.singular import ff
    sage: ff.modstd__lib
    <sage.libs.singular.function_factory.SingularFunctionFactory object at 0x3fff9e6c5450>
    sage: ff.modstd__lib
    <sage.libs.singular.function_factory.SingularFunctionFactory object at 0x3fff9e6c5590>
    sage: ff.modstd__lib
    <sage.libs.singular.function_factory.SingularFunctionFactory object at 0x3fff9e6c5690>
    
  • 3-1-7:
    sage: from sage.libs.singular import ff
    sage: ff.modstd__lib
    <sage.libs.singular.function_factory.SingularFunctionFactory object at 0x3fff9e695450>
    sage: ff.modstd__lib
    // ** redefining root my_awesome_sage_ring **
    Program received signal SIGSEGV, Segmentation fault.
    nSetChar (r=0x3fffa42365f0) at numbers.cc:205
    

with backtrace:

#0  nSetChar (r=0x3fffa42365f0) at numbers.cc:205
#1  0x00003fffa49aef34 in rChangeCurrRing (r=<error reading variable: value has been optimized out>) at ring.cc:112
#2  0x00003fffa4864b54 in killlocals (v=<optimized out>) at ipshell.cc:386
#3  0x00003fffa484ce24 in iiPStart (pn=<optimized out>, v=<optimized out>) at iplib.cc:499
#4  0x00003fffa484d334 in iiMake_proc (pn=0x3fffa424fc80, pack=0x3fffa4228260, sl=0x0) at iplib.cc:612
#5  0x00003fffa484f65c in iiRunInit (p=<error reading variable: value has been optimized out>) at iplib.cc:889
#6  iiLoadLIB (fp=0x0, libnamebuf=0x3fffffffb980 "/home/jpflori/sage.git/local/share/singular/modstd.lib", newlib=0x3fffa42521c0 "modstd.lib", 
    pl=<optimized out>, autoexport=<optimized out>, tellerror=<optimized out>) at iplib.cc:941
#7  0x00003fffa484f840 in iiLibCmd (newlib=0x3fffa42521c0 "modstd.lib", autoexport=<optimized out>, tellerror=<optimized out>, force=<optimized out>)
    at iplib.cc:842
#8  0x00003fffa4052cd8 in __pyx_pf_4sage_4libs_8singular_8function_10lib (__pyx_self=<optimized out>, __pyx_v_name='modstd.lib')
    at build/cythonized/sage/libs/singular/function.cpp:16752
...

comment:23 Changed 5 years ago by jpflori

No issue using ./sage -singular:

> option(loadLib);
> LIB "modstd.lib";
// ** loaded /home/jpflori/sage.git/local/share/singular/modstd.lib (3-1-7-0,May_2014)
// ** loaded /home/jpflori/sage.git/local/share/singular/parallel.lib (3-1-7-0,Dec_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/tasks.lib (3-1-7-0,Dec_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/resources.lib (3-1-7-0,Dec_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/modular.lib (3-1-7-0,Dec_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/poly.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/ring.lib (4.0.0.0,Jun_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/primdec.lib (4.0.0.0,Jun_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/absfact.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/triang.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/matrix.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/nctools.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/random.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/elim.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/inout.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/general.lib (3-1-7-0,Sep_2013)
> LIB "modstd.lib";
// ** redefining modStd **
...

comment:24 Changed 5 years ago by jpflori

  • Cc burcin added

comment:26 Changed 5 years ago by git

  • Commit changed from cdedfc61ca715961acca343dea87e7e5c1163063 to 32f3be69d6a195e73e767c179d1c855886faf667

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

32f3be6Avoid redefining Singular mock ring.

comment:27 Changed 5 years ago by jpflori

  • Status changed from needs_work to needs_review

Fix extracted from the discussion at #13447.

comment:28 Changed 5 years ago by git

  • Commit changed from 32f3be69d6a195e73e767c179d1c855886faf667 to e2d29209a8ca5c03ad8830596cc69578491df047

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

e2d2920Remove debug stuff.

comment:29 Changed 5 years ago by jpflori

  • Status changed from needs_review to needs_work

There is still one doctest to fix.

comment:30 Changed 5 years ago by git

  • Commit changed from e2d29209a8ca5c03ad8830596cc69578491df047 to cde293057415ab28388bbdd43d813c5a21182392

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

cde2930Update doctest for Singular new behavior.

comment:31 Changed 5 years ago by jpflori

  • Status changed from needs_work to needs_review

comment:32 in reply to: ↑ 14 Changed 5 years ago by nbruin

Replying to jpflori:

I don't really remember who committed the "my_awesome_ring" code.

It looks like it was there from the start: #6628 introduced this in 2009. It also looks like you've resolved your issue with it already.

comment:33 Changed 5 years ago by jpflori

I hope so, I just picked up a minimal change from #13447.

comment:34 Changed 5 years ago by vbraun

  • Reviewers set to Volker Braun
  • Status changed from needs_review to positive_review

lgtm

comment:35 Changed 5 years ago by vbraun

  • Status changed from positive_review to needs_work

A build with SAGE_DEBUG=yes fails in:

sage -t --long src/sage/schemes/plane_curves/curve.py
**********************************************************************
File "src/sage/schemes/plane_curves/curve.py", line 122, in sage.schemes.plane_curves.curve.Curve_generic.geometric_genus
Failed example:
    C.geometric_genus()
Expected:
          3
Got:
    <BLANKLINE>
    // ***dError: T[3] pLength error: has 1, specified to have 2 occured at: 
    <BLANKLINE>
    // ***dError: T[3] pLength error: has 1, specified to have 2 occured at: 
    3

there are more failures, always in geometric genus. If somebody can extract a singular-only testcase from that and report it on libsingular-devel then Hans is usually quick to patch that...

comment:37 Changed 5 years ago by jpflori

Ok it seems to be upstream and not because of our broken reference handling. I'm just discovering singular syntax and might be wrong, but I get the following:

$ ./sage -singular
                     SINGULAR                                 /  Development
 A Computer Algebra System for Polynomial Computations       /   version 3-1-7
                                                           0<
 by: W. Decker, G.-M. Greuel, G. Pfister, H. Schoenemann     \   Aug 2013
FB Mathematik der Universitaet, D-67653 Kaiserslautern        \
> LIB "normal.lib";
// ** loaded /home/jpflori/sage.git/local/share/singular/normal.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/algebra.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/matrix.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/nctools.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/random.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/reesclos.lib (3-1-7-1,Jan_2014)
// ** loaded /home/jpflori/sage.git/local/share/singular/locnormal.lib (3-1-7-1,Jan_2014)
// ** loaded /home/jpflori/sage.git/local/share/singular/modstd.lib (3-1-7-0,May_2014)
// ** loaded /home/jpflori/sage.git/local/share/singular/parallel.lib (3-1-7-0,Dec_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/tasks.lib (3-1-7-0,Dec_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/resources.lib (3-1-7-0,Dec_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/modular.lib (3-1-7-0,Dec_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/hnoether.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/primitiv.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/ring.lib (4.0.0.0,Jun_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/inout.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/presolve.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/elim.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/primdec.lib (4.0.0.0,Jun_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/absfact.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/triang.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/sing.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/poly.lib (3-1-7-0,Sep_2013)
// ** loaded /home/jpflori/sage.git/local/share/singular/general.lib (3-1-7-0,Sep_2013)
> ring R=5,(x,y,z),dp;
// ** Could not open dynamic library: /home/jpflori/sage.git/local/bin/p_Procs_FieldIndep.sog
// ** Error message from system: /home/jpflori/sage.git/local/bin/p_Procs_FieldIndep.sog: cannot open shared object file: No such file or directory
// ** Singular will work properly, but much slower.
// ** See the INSTALL section in the Singular manual for details.
> ideal I = x^10 + y^7*z^3 + z^10;
> genus(I);

// ***dError: T[3] pLength error: has 1, specified to have 2 occured at: 

// ***dError: T[3] pLength error: has 1, specified to have 2 occured at: 
3

Also note the Singular's warning, so it seems our way of launching singular might not be the best.

comment:38 Changed 5 years ago by vbraun

Looks good, can you post to libsingular-devel?

comment:39 Changed 5 years ago by jpflori

I'm not subscribed there and I just applied. In the meantime I posted on the forum on their homepage:

(And I don't have access to the bugtracker because of the unusual port it uses.)

comment:40 Changed 5 years ago by jpflori

Great a fix was posted upstream and a 3-1-7p1 version released. I'm in the process of testing it.

comment:41 Changed 5 years ago by git

  • Commit changed from cde293057415ab28388bbdd43d813c5a21182392 to ac60a769503ec0ad4a227ad9cec0aa7cebd10bb6

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

badc6f7Merge remote-tracking branch 'trac/develop' into ticket/17184
ac60a76Update Singular to 3-1-7p1.

comment:42 Changed 5 years ago by jpflori

  • Description modified (diff)
  • Status changed from needs_work to needs_review
  • Summary changed from Upgrade to Singular-3-1-7 to Upgrade to Singular-3-1-7p1

comment:43 Changed 5 years ago by git

  • Commit changed from ac60a769503ec0ad4a227ad9cec0aa7cebd10bb6 to 9b3b9333ca798420edcfd07f03e2ace0991d1431

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

9b3b933Use actual upstream version number for Singular.

comment:44 Changed 5 years ago by jpflori

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.

comment:45 Changed 5 years ago by jpflori

  • Description modified (diff)

comment:46 Changed 5 years ago by vbraun

  • Status changed from needs_review to positive_review

lgtm

comment:47 Changed 5 years ago by jpflori

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.

comment:48 Changed 5 years ago by vbraun

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
**********************************************************************

comment:49 Changed 5 years ago by vbraun

  • Status changed from positive_review to needs_work

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

comment:50 Changed 5 years ago by jpflori

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.

comment:51 Changed 5 years ago by jpflori

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

comment:52 Changed 5 years ago by vbraun

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

comment:53 Changed 5 years ago by jpflori

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

comment:54 Changed 5 years ago by jpflori

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

comment:55 Changed 5 years ago by jpflori

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

comment:56 Changed 5 years ago by vbraun

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

comment:57 Changed 5 years ago by jpflori

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)

comment:58 Changed 5 years ago by jpflori

comment:59 Changed 5 years ago by jpflori

Upstream report at:

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

comment:60 Changed 5 years ago by git

  • Commit changed from 9b3b9333ca798420edcfd07f03e2ace0991d1431 to 0a5f6951bd84d6596c292e26e8ad9b8101ca51f8

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

0a5f695Try to prevent Singular from segfaulting.

comment:61 Changed 5 years ago by jpflori

  • Status changed from needs_work to needs_review

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

comment:62 Changed 5 years ago by vbraun

  • Status changed from needs_review to needs_work

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

comment:63 Changed 5 years ago by jpflori

Can you try without templates.patch?

comment:64 Changed 5 years ago by jpflori

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.

comment:65 Changed 5 years ago by git

  • Commit changed from 0a5f6951bd84d6596c292e26e8ad9b8101ca51f8 to 4e287c4a5a72e1a23c35046c71bddde9786110cc

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

4e287c4Remove useless explicit templates instantiations in Singular.

comment:66 Changed 5 years ago by jpflori

  • Status changed from needs_work to needs_review

comment:67 Changed 5 years ago by vbraun

  • Branch changed from u/jpflori/ticket/17184 to 4e287c4a5a72e1a23c35046c71bddde9786110cc
  • Resolution set to fixed
  • Status changed from needs_review to closed
Note: See TracTickets for help on using tickets.