From: Matthew Fernandez Date: Sun, 3 Jan 2021 00:00:19 +0000 (-0800) Subject: fix: detect absolute paths correctly in GVPR on Windows X-Git-Tag: 2.47.0~32^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7f429369da8d50f4484c0003ba19a0f9417010dd;p=graphviz fix: detect absolute paths correctly in GVPR on Windows This code was incorrectly depending on WIN32_DLL which was not defined when the source file was built. Rather than addressing this directly, we make gvpr comply more accurately with its man page: If progfile contains a slash character, the name is taken as the pathname of the file. We now look for a path separator, backslash on Windows and forward slash on anything else. Fixes #1780. --- diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bbe0ccea..6b7f6751d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - private inheritance in IncVPSC #1874 - broken sorting in nearest_neighbor_graph_ann.cpp #1938 - memory leak in ANN bridge +- gvpr on Windows does not support absolute paths #1780 ## [2.46.1] - 2021-02-13 diff --git a/lib/gvpr/gprstate.c b/lib/gvpr/gprstate.c index 46505c011..61ea2c295 100644 --- a/lib/gvpr/gprstate.c +++ b/lib/gvpr/gprstate.c @@ -14,11 +14,6 @@ * */ -#ifdef _WIN32 -#include "windows.h" -#include "shlwapi.h" -#endif - #include #include #include @@ -135,12 +130,3 @@ void closeGPRState(Gpr_t* state) free (state->dp); free (state); } - -#ifdef WIN32_DLL -int pathisrelative (char* path) -{ - return PathIsRelative(path); - -} -#endif - diff --git a/lib/gvpr/gprstate.h b/lib/gvpr/gprstate.h index 54641c6f4..5e808ca05 100644 --- a/lib/gvpr/gprstate.h +++ b/lib/gvpr/gprstate.h @@ -79,10 +79,6 @@ extern "C" { extern void initGPRState(Gpr_t *, Vmalloc_t *); extern int validTVT(int); -#ifdef _WIN32 - extern int pathisrelative (char* path); -#endif - #endif #ifdef __cplusplus diff --git a/lib/gvpr/gvpr.c b/lib/gvpr/gvpr.c index 3a70c8152..572f04531 100644 --- a/lib/gvpr/gvpr.c +++ b/lib/gvpr/gvpr.c @@ -216,11 +216,7 @@ static char *resolve(char *arg, int Verbose) char *pathp = NULL; size_t sz; -#ifdef WIN32_DLL - if (!pathisrelative(arg)) -#else - if (strchr(arg, '/')) -#endif + if (strchr(arg, PATHSEP)) return strdup(arg); path = getenv("GVPRPATH"); diff --git a/rtest/test_regression.py b/rtest/test_regression.py index da6111d91..5f211d7a3 100644 --- a/rtest/test_regression.py +++ b/rtest/test_regression.py @@ -363,7 +363,6 @@ def test_1767(): # 'cluster_2 contains 3 nodes\n' \ # 'cluster_3 contains 3 nodes\n' -@pytest.mark.xfail(strict=True) # FIXME @pytest.mark.skipif(shutil.which('gvpr') is None, reason='GVPR not available') @pytest.mark.skipif(platform.system() != 'Windows', reason='only relevant on Windows') @@ -601,11 +600,6 @@ def test_1909(): stdout=subprocess.PIPE, universal_newlines=True) output, _ = p.communicate() - # FIXME: for some undiagnosed reason, the above command fails on Windows - if platform.system() == 'Windows': - assert p.returncode != 0 - return - assert p.returncode == 0, 'gvpr failed to process graph' # we should have produced this graph without names like "%2" in it