#20326: GenericBackend: Fix doctest of add_linear_constraint_vector
-----------------------------+------------------------
       Reporter:  mkoeppe    |        Owner:
           Type:  defect     |       Status:  new
       Priority:  major      |    Milestone:  sage-7.2
      Component:  numerical  |   Resolution:
       Keywords:  lp         |    Merged in:
        Authors:             |    Reviewers:
Report Upstream:  N/A        |  Work issues:
         Branch:             |       Commit:
   Dependencies:             |     Stopgaps:
-----------------------------+------------------------

Old description:

> The doctest of `add_linear_constraint_vector` from generic_backend.pyx
> (which is never run for any real backend!), when applied to COIN or GLPK
> leads to segfaults:
> {{{
> sage:             sage: coeffs = ([0, vector([1, 2])], [1, vector([2,
> 3])])
> sage:             sage: upper = vector([5, 5])
> sage:             sage: lower = vector([0, 0])
> sage:             sage: from sage.numerical.backends.generic_backend
> import get_solver
> sage:             sage: p = get_solver(solver = "Coin")
> # optional - cbc
> sage: p.add_linear_constraint_vector(2, coeffs, lower, upper, 'foo')
> ------------------------------------------------------------------------
> 0   signals.so                          0x0000000109df05c5
> print_backtrace + 37
> ------------------------------------------------------------------------
> Unhandled SIGSEGV: A segmentation fault occurred.
> This probably occurred because a *compiled* module has a bug
> in it and is not properly wrapped with sig_on(), sig_off().
> Python will now terminate.
> ------------------------------------------------------------------------
> Segmentation fault: 11
> $ sage
> SageMath Version 7.2.beta0, Release Date: 2016-03-24
> sage: sage:             sage: coeffs = ([0, vector([1, 2])], [1,
> vector([2, 3])])
> sage: sage:             sage: upper = vector([5, 5])
> sage: sage:             sage: lower = vector([0, 0])
> sage: sage:             sage: from
> sage.numerical.backends.generic_backend import get_solver
> sage: sage:             sage: p = get_solver(solver = "Coin")
> # optional - cbc
> sage: p.add_linear_constraint_vector(2, coeffs, lower, upper)
> ------------------------------------------------------------------------
> 0   signals.so                          0x0000000109c8a5c5
> print_backtrace + 37
> ------------------------------------------------------------------------
> Unhandled SIGSEGV: A segmentation fault occurred.
> }}}

New description:

 The doctest of `add_linear_constraint_vector` from generic_backend.pyx
 (which is never run for any real backend!), when applied to COIN or GLPK
 leads to segfaults:
 {{{
 sage: coeffs = ([0, vector([1, 2])], [1, vector([2, 3])])
 sage: upper = vector([5, 5])
 sage: lower = vector([0, 0])
 sage: from sage.numerical.backends.generic_backend import get_solver
 sage: p = get_solver(solver = "Coin")      # optional - cbc
 sage: p.add_linear_constraint_vector(2, coeffs, lower, upper, 'foo')
 ------------------------------------------------------------------------
 0   signals.so                          0x0000000109df05c5 print_backtrace
 + 37
 ------------------------------------------------------------------------
 Unhandled SIGSEGV: A segmentation fault occurred.
 This probably occurred because a *compiled* module has a bug
 in it and is not properly wrapped with sig_on(), sig_off().
 Python will now terminate.
 ------------------------------------------------------------------------
 Segmentation fault: 11
 $ sage
 SageMath Version 7.2.beta0, Release Date: 2016-03-24
 sage: coeffs = ([0, vector([1, 2])], [1, vector([2, 3])])
 sage: upper = vector([5, 5])
 sage: lower = vector([0, 0])
 sage: from sage.numerical.backends.generic_backend import get_solver
 sage: p = get_solver(solver = "Coin")       # optional - cbc
 sage: p.add_linear_constraint_vector(2, coeffs, lower, upper)
 ------------------------------------------------------------------------
 0   signals.so                          0x0000000109c8a5c5 print_backtrace
 + 37
 ------------------------------------------------------------------------
 Unhandled SIGSEGV: A segmentation fault occurred.
 }}}

--

Comment (by dimpase):

 with the second example I only get segfault with Coin - with other
 backends I get gracefully handled errors.

--
Ticket URL: <http://trac.sagemath.org/ticket/20326#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to