Closed jdemeyer closed 9 years ago
Branch: u/jdemeyer/ticket/17184
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.
Boxen is back up (from here at least)!
Branch pushed to git repo; I updated commit sha1. New commits:
1027b8f | Document templates.patch |
That's a lot of dropped patches. That, on its own, would justify the upgrade.
Needs some work for the debug version. I'm on it.
Changed branch from u/jdemeyer/ticket/17184 to u/jpflori/ticket/17184
Branch pushed to git repo; I updated commit sha1. New commits:
cdedfc6 | Correct fuzz for Singular patches. |
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
**********************************************************************
I get these doctest failures also with the latest version of this ticket, without NTL.
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!
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:
normal__lib
;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.)Wasn't me, but if there were any changes to the genus function then hopefully they fix #15477
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
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.
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...
Groumpf, I don't remmeber if anyone from the Singualr team has an account here on trac...
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
The following segfaults with Singular 3-1-7.
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>
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
...
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 **
...
This looks related... #13447 comment:63
Branch pushed to git repo; I updated commit sha1. New commits:
32f3be6 | Avoid redefining Singular mock ring. |
Fix extracted from the discussion at #13447.
Branch pushed to git repo; I updated commit sha1. New commits:
e2d2920 | Remove debug stuff. |
There is still one doctest to fix.
Branch pushed to git repo; I updated commit sha1. New commits:
cde2930 | Update doctest for Singular new behavior. |
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.
I hope so, I just picked up a minimal change from #13447.
lgtm
Reviewer: Volker Braun
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...
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.
Looks good, can you post to libsingular-devel?
I'm not subscribed there and I just applied. In the meantime I posted on the forum on their homepage:
Great a fix was posted upstream and a 3-1-7p1 version released. I'm in the process of testing it.
Description changed:
---
+++
@@ -1,2 +1,2 @@
-Singular 3-1-7 repackaged (see spkg-src):
+Singular 3-1-7p1 repackaged (see spkg-src):
* http://boxen.math.washington.edu/home/jpflori/upstream/singular-3.1.7.tar.bz2
Branch pushed to git repo; I updated commit sha1. New commits:
9b3b933 | Use actual upstream version number for Singular. |
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