[sagemath] 01/01: Fix 11 GLPK tests and document the incompatibility between Sage vs upstream

Ximin Luo infinity0 at debian.org
Fri Oct 14 20:53:52 UTC 2016


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository sagemath.

commit 8dbec07452ecfbee87f01b3f1cae988262772753
Author: Ximin Luo <infinity0 at debian.org>
Date:   Fri Oct 14 22:52:17 2016 +0200

    Fix 11 GLPK tests and document the incompatibility between Sage vs upstream
---
 debian/README.Debian                               | 10 +---
 debian/patches/debian-fix-trivial-test-cases.patch | 11 ----
 debian/patches/series                              |  2 +
 debian/patches/version-glpk-4.60.patch             | 69 ++++++++++++++++++++++
 .../version-temp-glpk-4.60-extra-hacky-fixes.patch | 35 +++++++++++
 5 files changed, 108 insertions(+), 19 deletions(-)

diff --git a/debian/README.Debian b/debian/README.Debian
index fbffb10..6e72d63 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -74,8 +74,8 @@ Now for the summary:
 
 ### Breakdown
 
-29+5 unreproducible for infinity0
-43 (estimated) for Tobias
+18+5 unreproducible for infinity0
+32 (estimated) for Tobias
 
 ### We have some sort of lead for further investigation
 
@@ -84,12 +84,6 @@ they're all a good idea.
 
 Also check the mailing list for possible ideas.
 
-11 GPLK version difference
-sage -t --long src/sage/numerical/backends/glpk_backend.pyx  # 6 doctests failed
-sage -t --long src/sage/numerical/backends/glpk_graph_backend.pyx  # 3 doctests failed
-sage -t --long src/sage/libs/glpk/error.pyx  # 1 doctest failed
-sage -t --long src/sage/numerical/mip.pyx  # 1 doctest failed
-
 6 Minor floating point differences, can maybe ignore, ask upstream first
 sage -t --long src/sage/numerical/optimize.py  # 4 doctests failed (1 is not floating-point related)
 sage -t --long src/sage/coding/code_bounds.py  # 1 doctest failed
diff --git a/debian/patches/debian-fix-trivial-test-cases.patch b/debian/patches/debian-fix-trivial-test-cases.patch
index 73863f7..35bba1d 100644
--- a/debian/patches/debian-fix-trivial-test-cases.patch
+++ b/debian/patches/debian-fix-trivial-test-cases.patch
@@ -245,17 +245,6 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
  
          sage: s, libs, inc, lang, f, args, libdirs = pyx_preparse("# cargs -O3 -ggdb\n")
          sage: args
---- a/sage/src/sage/numerical/backends/glpk_backend.pyx
-+++ b/sage/src/sage/numerical/backends/glpk_backend.pyx
-@@ -2243,7 +2243,7 @@
-             sage: p.solve()
-             0
-             sage: p.print_ranges()
--            Write sensitivity analysis report to...
-+            ...
-             GLPK ... - SENSITIVITY ANALYSIS REPORT                                                                         Page   1
-             <BLANKLINE>
-             Problem:
 --- a/sage/src/sage/interfaces/tachyon.py
 +++ b/sage/src/sage/interfaces/tachyon.py
 @@ -170,7 +170,8 @@
diff --git a/debian/patches/series b/debian/patches/series
index 343571f..7335594 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -21,6 +21,7 @@ version-ipython-5.patch
 version-singular-4.patch
 version-cddlib-094h.patch
 version-givaro-4.patch
+version-glpk-4.60.patch
 #version-planarity-3.patch #breaks tests
 
 # due to Debian's inherent differences with upstream;
@@ -48,3 +49,4 @@ temp-disable-parallel-sphinx.patch
 temp-cython-include-source.patch
 version-temp-singular-4-extra-fixes.patch
 temp-fix-more-tests.patch
+version-temp-glpk-4.60-extra-hacky-fixes.patch
diff --git a/debian/patches/version-glpk-4.60.patch b/debian/patches/version-glpk-4.60.patch
new file mode 100644
index 0000000..6e14ac9
--- /dev/null
+++ b/debian/patches/version-glpk-4.60.patch
@@ -0,0 +1,69 @@
+Description: Update doctests to GLPK 4.60
+ Taken from https://trac.sagemath.org/ticket/20710
+Author: Jeroen Demeyer <jdemeyer at cage.ugent.be>
+Bug: https://trac.sagemath.org/ticket/20710
+Forwarded: not-needed
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+diff --git a/src/sage/numerical/backends/glpk_backend.pyx b/src/sage/numerical/backends/glpk_backend.pyx
+index 7a7ae0a..b0f9f2a 100644
+--- a/sage/src/sage/numerical/backends/glpk_backend.pyx
++++ b/sage/src/sage/numerical/backends/glpk_backend.pyx
+@@ -1004,8 +1006,8 @@ cdef class GLPKBackend(GenericBackend):
+         Same, now with a time limit::
+ 
+             sage: p.solver_parameter("mip_gap_tolerance",1)
+-            sage: p.solver_parameter("timelimit",0.01)
+-            sage: p.solve() # rel tol 1
++            sage: p.solver_parameter("timelimit",3.0)
++            sage: p.solve() # rel tol 100
+             1
+         """
+ 
+diff --git a/src/sage/numerical/backends/glpk_graph_backend.pyx b/src/sage/numerical/backends/glpk_graph_backend.pyx
+index a099788..498e8e1 100644
+--- a/sage/src/sage/numerical/backends/glpk_graph_backend.pyx
++++ b/sage/src/sage/numerical/backends/glpk_graph_backend.pyx
+@@ -162,12 +162,12 @@ cdef class GLPKGraphBackend(object):
+         sage: a = gbe.add_edge('0', '1')
+         sage: gbe.write_graph(SAGE_TMP+"/graph.txt")
+         Writing graph to ...
+-        2 lines were written
++        4 lines were written
+         0
+         sage: gbe1 = GLPKGraphBackend(SAGE_TMP+"/graph.txt", "plain")
+         Reading graph from ...
+-        Graph has 2 vertices and 1 arc
+-        2 lines were read
++        Graph has 2 vertices and 1 edge
++        3 lines were read
+ 
+     The following example imports a Sage ``Graph`` and then uses it to solve a
+     maxflow problem::
+@@ -1060,7 +1060,7 @@ cdef class GLPKGraphBackend(object):
+             sage: a = gbe.add_edge("0", "1")
+             sage: gbe.write_graph(SAGE_TMP+"/graph.txt")
+             Writing graph to ...
+-            2 lines were written
++            4 lines were written
+             0
+         """
+ 
+diff --git a/src/sage/numerical/mip.pyx b/src/sage/numerical/mip.pyx
+index 8c17d87..b45c82f 100644
+--- a/sage/src/sage/numerical/mip.pyx
++++ b/sage/src/sage/numerical/mip.pyx
+@@ -2519,10 +2519,10 @@ cdef class MixedIntegerLinearProgram(SageObject):
+             sage: b.solver_parameter("simplex_or_intopt", "simplex_only")
+             sage: b.solver_parameter("verbosity_simplex", "GLP_MSG_ALL")
+             sage: p.solve()  # rel tol 1e-5
+-            GLPK Simplex Optimizer, v4.55
++            GLPK Simplex Optimizer, v4.60
+             2 rows, 2 columns, 4 non-zeros
+-            *     0: obj =   7.000000000e+00  infeas =  0.000e+00 (0)
+-            *     2: obj =   9.400000000e+00  infeas =  0.000e+00 (0)
++            *     0: obj =   7.000000000e+00 inf =   0.000e+00 (2)
++            *     2: obj =   9.400000000e+00 inf =   0.000e+00 (0)
+             OPTIMAL LP SOLUTION FOUND
+             9.4
+         """
diff --git a/debian/patches/version-temp-glpk-4.60-extra-hacky-fixes.patch b/debian/patches/version-temp-glpk-4.60-extra-hacky-fixes.patch
new file mode 100644
index 0000000..3d6fda0
--- /dev/null
+++ b/debian/patches/version-temp-glpk-4.60-extra-hacky-fixes.patch
@@ -0,0 +1,35 @@
+Description: Work around Sage/GLPK differences to fix remaining GLPK doctests
+ Sage upstream patch GLPK. Most of this was accepted by upstream, however they
+ rejected one minor part of it:
+ https://git.sagemath.org/sage.git/tree/build/pkgs/glpk/patches/error_recovery.patch?id=3e8450b13d5c5353cd45d5881acf59994cf28b6b
+ This is described in some more detail here:
+ https://trac.sagemath.org/ticket/20710#comment:18
+ It turns out this is quite important for Sage:
+ .
+ Since we don't patch GLPK the same way in Debian, this means that if GLPK in
+ Sage causes one error, and this is caught by Sage and recovered from, then
+ later (because upstream GLPK is not clear the "error" flag) Sage will append
+ all subsequent terminal output of GLPK into the error_message string but not
+ actually forward it to the user's terminal. This breaks some doctests.
+ .
+ The patch below disables the terminal supression, so that doctests work again.
+ In this sense, it is not *this patch* that is hacky; this patch can remain -
+ all it does is print some extra messages to the terminal. However, this
+ inherent incompatibility between what upstream GLPK does and what Sage
+ expects, may cause other problems for us later, so I am just documenting this
+ in detail for future maintainers.
+Author: Ximin Luo <infinity0 at debian.org>
+Forwarded: not-needed
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/sage/src/sage/libs/glpk/error.pyx
++++ b/sage/src/sage/libs/glpk/error.pyx
+@@ -44,7 +44,7 @@
+     if glp_at_error():
+         # Save error message and skip normal printing
+         error_message += s
+-        return 1
++        return 0
+     else:
+         # Normal non-error output: the return value 0 means that GLPK
+         # will write the output as usual.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sagemath.git



More information about the debian-science-commits mailing list