From 1b0f840a51d902f209089ece4bf8184cc99af052 Mon Sep 17 00:00:00 2001 From: Rob Hart Date: Tue, 8 Dec 2020 05:01:24 -0800 Subject: [PATCH] Move maxiter check after the feasible_tree() call. Edit from Matt: changelog entry and un-xfailed the test case. Quoting the description of MR !1688 if it ever ends up lost to the sands of time: If `nslimit1` is zero, then `rank2` is called with `maxiter=0`. It is likely the intent here is to at least compute and return an initial feasible solution (though not running any network simplex iterations). Gitlab: fixes #1902 Co-authored-by: Matthew Fernandez --- CHANGELOG.md | 1 + lib/common/ns.c | 9 +++++---- rtest/test_regression.py | 1 - 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f998c4b9b..05cfc529a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -100,6 +100,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - stdout and stderr are not flushed at exit on MinGW #2178 - Gvedit on macOS now understands the `-?` help command line argument - CMAKE_LIBRARY_PATH is not honored #1973 +- assert failure with `nslimit1=0` #1902 ## [2.50.0] – 2021-12-04 diff --git a/lib/common/ns.c b/lib/common/ns.c index 3c2244419..cf7c2451b 100644 --- a/lib/common/ns.c +++ b/lib/common/ns.c @@ -857,10 +857,6 @@ int rank2(graph_t * g, int balance, int maxiter, int search_size) feasible = init_graph(g); if (!feasible) init_rank(); - if (maxiter <= 0) { - freeTreeList (g); - return 0; - } if (search_size >= 0) Search_size = search_size; @@ -874,6 +870,11 @@ int rank2(graph_t * g, int balance, int maxiter, int search_size) return err; } } + if (maxiter <= 0) { + freeTreeList (g); + return 0; + } + while ((e = leave_edge())) { int err; f = enter_edge(e); diff --git a/rtest/test_regression.py b/rtest/test_regression.py index e1467ac80..fe7d515f2 100644 --- a/rtest/test_regression.py +++ b/rtest/test_regression.py @@ -791,7 +791,6 @@ def test_1898(): # has been reintroduced dot("svg", input) -@pytest.mark.xfail(strict=not is_ndebug_defined()) # FIXME def test_1902(): """ test a segfault from https://gitlab.com/graphviz/graphviz/-/issues/1902 has -- 2.40.0