]> granicus.if.org Git - graphviz/commitdiff
fix: detect absolute paths correctly in GVPR on Windows
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 3 Jan 2021 00:00:19 +0000 (16:00 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 28 Feb 2021 05:58:24 +0000 (21:58 -0800)
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.

CHANGELOG.md
lib/gvpr/gprstate.c
lib/gvpr/gprstate.h
lib/gvpr/gvpr.c
rtest/test_regression.py

index 0bbe0ccea5ffaf4d94ba53af66728a95d9984cea..6b7f6751d45d4f32e9ad40320fd4338a727a5090 100644 (file)
@@ -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
 
index 46505c0114d2d86c6d531e5f014e1b46dc6a02bc..61ea2c2958e3f288205dd5e13f0ad14c2ef19273 100644 (file)
  *
  */
 
-#ifdef _WIN32
-#include "windows.h"
-#include "shlwapi.h"
-#endif
-
 #include <gvpr/gprstate.h>
 #include <ast/error.h>
 #include <ast/sfstr.h>
@@ -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
-
index 54641c6f4f280d884a76a5c10b600c3c22eaabc8..5e808ca05311f1b4826c57ea65275cc37dea3fc7 100644 (file)
@@ -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
index 3a70c81528fc89e45b22f8955a787721fdd3f656..572f045319c9563155ed5f114037b9b1fe94d208 100644 (file)
@@ -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");
index da6111d9110c670267828dc3688d200355504e5e..5f211d7a3bd9dc9f70e7e948a1bf2af91f3ee1b5 100644 (file)
@@ -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