How to use gvpr.exe with absolute path on Windows?

@steveroush or anyone:

I’m trying to get @smattr’s gvpr test case to run on Windows, but I’m getting a Could not find file ... in GVPRPATH error when trying to run gvpr.exe with an absolute path to the gvpr program on Windows. I think this stems from the following UNIX/Linux influenced statement on the gvpr man page:

While I can work around this, I wonder if it’s a bug or if I’m doing something wrong?

Full log:

C:\Users\magja\graphviz>Debug\Graphviz\bin\gvpr.exe -f C:\Users\magja\graphviz\rtest\1594.gvpr
Debug\Graphviz\bin\gvpr.exe: Could not find file "C:\Users\magja\graphviz\rtest\1594.gvpr" in GVPRPATH
Usage: Debug\Graphviz\bin\gvpr.exe  [-o <ofile>] [-a <args>] ([-f <prog>] | 'prog') [files]
   -c         - use source graph for output
   -f <pfile> - find program in file <pfile>
   -i         - create node induced subgraph
   -a <args>  - string arguments available as ARGV[0..]
   -o <ofile> - write output to <ofile>; stdout by default
   -n         - no read-ahead of input graphs
   -q         - turn off warning messages
   -V         - print version info
   -?         - print usage info
If no files are specified, stdin is used


C:\Users\magja\graphviz>more C:\Users\magja\graphviz\rtest\1594.gvpr
BEGIN {
  // a comment
  0p0p0
}

Relative paths works (the error is expected and part of the test):

C:\Users\magja\graphviz>Debug\Graphviz\bin\gvpr.exe -f rtest\1594.gvpr
Debug\Graphviz\bin\gvpr.exe: ".\rtest\1594.gvpr", line 3: 0<<<
 -- 0: invalid numeric constant

I think this is a bug in the GVPR logic. resolve in lib/gvpr/gvpr.c contains this:

 222 #ifdef WIN32_DLL
 223     if (!pathisrelative(arg))
 224 #else
 225     if (strchr(arg, '/'))
 226 #endif
 227   return strdup(arg);

There’s two problems I see here:

  1. WIN32_DLL, despite being defined in msbuilds of some other libraries, is not defined when building lib/gvpr. Maybe this should be _WIN32?
  2. The presence of / in a non-Windows path does not imply it is an absolute path.

I think (1) is the problem affecting you currently. Windows is incorrectly seeing the second alternative, and there is no forward slash in the path you’re passing in.

1 Like

Thanks. I filed: