Opened 15 years ago

Closed 15 years ago

#902 closed defect (fixed)

nviz (tcl) fails on wingrass

Reported by: hamish Owned by: grass-dev@…
Priority: critical Milestone: 6.4.0
Component: Tcl/Tk NVIZ Version: svn-trunk
Keywords: Cc:
CPU: All Platform: All

Description

Hi,

with the latest WinGrass nightly build installer (r40766), installed in C:\Program Files\, nviz (tcl) fails to start.

even from the MSys command prompt there error is:

GRASS 6.4> nviz --help
Sorry <Files/GRASS-64-SNV/etc/nviz2.2/script/nviz2.2_script> is not a valid option

Description
 nviz - Visualization and animation tool for GRASS data.

Keywords:
...
Usage:
...

If I reset $GISBASE beforehand to get rid of the space, it works:

GRASS 6.4> export GISBASE=/C/PROGRA~1/GRASS-64-SVN

I assume we could hardcode that conversion as part of the GRASS-Installer.nsi (as follows), but it would be good to fix it properly.

;Get the short form of the install path (to allow for paths with spaces)
VAR /GLOBAL INST_DIR_SHORT
GetFullPathName /SHORT $INST_DIR_SHORT $INSTALL_DIR

also just to note that the nightly build process still is shipping msys/grass70.* files and does not use a copy of msys.bat with all paths "quoted" which causes (non-fatal) errors in the startup.

Hamish

Attachments (1)

nviz.patch (25.6 KB ) - added by glynn 15 years ago.
Patch to back-port r40879 to 6.5

Download all attachments as: .zip

Change History (28)

in reply to:  description ; comment:1 by hellik, 15 years ago

Replying to hamish:

Hi,

with the latest WinGrass nightly build installer (r40766), installed in C:\Program Files\, nviz (tcl) fails to start.

even from the MSys command prompt there error is:

GRASS 6.4> nviz --help
Sorry <Files/GRASS-64-SNV/etc/nviz2.2/script/nviz2.2_script> is not a valid option

Description
 nviz - Visualization and animation tool for GRASS data.

Keywords:
...
Usage:
...

If I reset $GISBASE beforehand to get rid of the space, it works:

GRASS 6.4> export GISBASE=/C/PROGRA~1/GRASS-64-SVN

I assume we could hardcode that conversion as part of the GRASS-Installer.nsi (as follows), but it would be good to fix it properly.

;Get the short form of the install path (to allow for paths with spaces)
VAR /GLOBAL INST_DIR_SHORT
GetFullPathName /SHORT $INST_DIR_SHORT $INSTALL_DIR

also just to note that the nightly build process still is shipping msys/grass70.* files and does not use a copy of msys.bat with all paths "quoted" which causes (non-fatal) errors in the startup.

Hamish

i can confirm this on self compiled Wingrass64+65-installers installed in C:\Program Files\, even if i use the msys.bat from ticket #629 with all paths "quoted".

but nviz is working if I use the self compiled grass64+65 living in c:\osgeo\apps\grass.

Helmut

p.s. i've integrated the msys from ticket #629 (with quoted paths) locally into GRASS-Installer.nsi for Grass65. should i apply this for testing in Grass65svn? I've tested it a little bit locally and it seems to work (beside the nviz-issue).

in reply to:  description ; comment:2 by glynn, 15 years ago

CPU: x86-32All
Keywords: wingrass removed
Platform: MSWindows XPAll
Version: svn-releasebranch64svn-trunk

Replying to hamish:

with the latest WinGrass nightly build installer (r40766), installed in C:\Program Files\, nviz (tcl) fails to start.

even from the MSys command prompt there error is:

GRASS 6.4> nviz --help
Sorry <Files/GRASS-64-SNV/etc/nviz2.2/script/nviz2.2_script> is not a valid option

This is due to Ngetargs() in nviz_init.c.

It tries to reconstruct the command line with:

	sprintf(tmp2, "%s %s %s", cmd, argv0, tmp);

then convert it back to a list with Tcl_SplitList().

This could be hacked around by using braces, but it should probably be using Tcl_ObjGetVar2(), Tcl_NewListObj() and Tcl_ListObjAppendList(). Or simpler still, change Ngetargs to return argv[0] separately (and just ignore argv[1]), and change parse_command() to match.

Oh, and it's broken in all versions for all platforms (spaces in pathnames are uncommon on Unix, but not prohibited).

in reply to:  2 ; comment:3 by glynn, 15 years ago

Replying to glynn:

Or simpler still, change Ngetargs to return argv[0] separately (and just ignore argv[1]), and change parse_command() to match.

I've applied this solution to trunk in r40784.

And also eliminated a C99/gcc-ism: C89 requires the dimensions of an array declaration to be a compile-time constant, so:

char *argv2[argc - 1];

isn't valid.

in reply to:  3 comment:4 by neteler, 15 years ago

Replying to glynn:

Replying to glynn:

Or simpler still, change Ngetargs to return argv[0] separately (and just ignore argv[1]), and change parse_command() to match.

I've applied this solution to trunk in r40784.

backported to 6.4 and 6.5: r40788 and r40789.

Markus

in reply to:  1 comment:5 by hamish, 15 years ago

Replying to hellik:

p.s. i've integrated the msys from ticket #629 (with quoted paths) locally into GRASS-Installer.nsi for Grass65. should i apply this for testing in Grass65svn? I've tested it a little bit locally and it seems to work (beside the nviz-issue).

sure, that's what the development branches are for. if you are worried about it post the diff as an attachment to the trac system for further eyeballs.

Hamish

comment:6 by hamish, 15 years ago

With today's daily build of the WinGrass installer (r40819) "nviz -q" now works from the msys prompt. But it still doesn't work from the wxGUI.

When you select File -> NVIZ (Tcl/Tk) the module's GUI pops up and you can set elev: elevation.dem by hand.

But then when you hit [Run] you get a popup error and an error in the module gui output tab. The popup error reads:

Error in command execution nviz2.2_script

(X) Execution failed: 'nviz2.2_script elevation=elevation.dem'
Details:
Error:

and in the module GUI output tab it says:

'nviz2.2_script' is not recognized as an internal or external command,
operable program or batch file.

nviz2.2_script is at $GISBASE/etc/nviz2.2/scripts/nviz2.2_script and $GISBASE/bin/nviz.bat calls it.

The gui popup window says "nviz2.2_script" as the program name in the window's title bar.


From the GIS.m tcl tk gui menu it also fails, but there just with a (X) in the main gui output window and other feedback. You can run "nviz -q" from the stealth command region at the bottom of the output window + [Run]. in doing that it picks up the nviz icon as well. You can also start it ok from the GIS.m Map Display window toolbar.


there is nothing in the help page or Usage: text about it, but fwiw g.parser -s has been backported to 6.5 but not 6.4.

Hamish

in reply to:  6 ; comment:7 by glynn, 15 years ago

Replying to hamish:

With today's daily build of the WinGrass installer (r40819) "nviz -q" now works from the msys prompt. But it still doesn't work from the wxGUI.

When you select File -> NVIZ (Tcl/Tk) the module's GUI pops up and you can set elev: elevation.dem by hand.

But then when you hit [Run] you get a popup error and an error in the module gui output tab. The popup error reads:

Error in command execution nviz2.2_script

Right. The "nviz" script doesn't invoke g.parser. It invokes

"$GISBASE/etc/nviz2.2/nviz" -f "$GISBASE/etc/nviz2.2/scripts/nviz2.2_script"

and the nviz binary calls G_parser() (with argv[0] set to Tcl's $argv0, which is the name of the script).

One solution is to simply force argv[0] to "nviz" unless script_mode is set.

in reply to:  7 ; comment:8 by hamish, 15 years ago

Replying to glynn:

One solution is to simply force argv[0] to "nviz" unless script_mode is set.

( source:grass/trunk/visualization/nviz/src/nviz_init.c, r40784)

I tried with DEBUG=2 but it dies before getting to the G_debug(2, "nviz_init:arg* lines in nviz_init.c.

It dies in the same way on trunk + linux too.

  • "nviz" by itself on the command line dies with a segfault:

(all versions, all platforms)

GRASS7> gdb $GISBASE/etc/nviz2.2/nviz
(gdb) run -f $GISBASE/etc/nviz2.2/scripts/nviz2.2_script
(gdb) bt
#0  0x00007f4faac098dc in strstr () from /lib/libc.so.6
#1  0x000000000041b117 in parse_command (data=0x630b40, interp=0x10e82b0, argc=0, 
    argv0=0x1187a90 "/usr/local/src/grass/svn/trunk/dist.x86_64-unknown-linux-gnu/etc/nviz2.2/scripts/nviz2.2_script", argv=0x10fa8b0) at nviz_init.c:165
#2  0x000000000041be83 in Ninitdata (interp=0x10e82b0, data=0x630b40) at nviz_init.c:543
#3  0x000000000041bddf in Ninit (interp=0x10e82b0, w=0x0) at nviz_init.c:507
#4  0x000000000041abce in NVIZ_AppInit (interp=0x10e82b0) at nvizAppInit.c:130
#5  0x00007f4fac4d47e6 in Tk_MainEx () from /usr/lib/libtk8.4.so.0
#6  0x000000000041ac82 in main (argc=3, argv=0x7fffb7eddc28) at nvizMain.c:61

(gdb) bt full
#0  0x00007f4faac098dc in strstr () from /lib/libc.so.6
No symbol table info available.
#1  0x000000000041b117 in parse_command (data=0x630b40, interp=0x10e82b0, argc=0, 
    argv0=0x1187a90 "/usr/local/src/grass/svn/trunk/dist.x86_64-unknown-linux-gnu/etc/nviz2.2/scripts/nviz2.2_script", argv=0x10fa8b0) at nviz_init.c:165
        elev = (struct Option *) 0x7f4face2fca0
        colr = (struct Option *) 0x1187c00
        vct = (struct Option *) 0x1187fc0
        pnt = (struct Option *) 0x1188060
        vol = (struct Option *) 0x1188100
        panel_path = (struct Option *) 0x11881a0
        script = (struct Option *) 0x11884c0
        state = (struct Option *) 0x1188560
        no_args = (struct Flag *) 0x7f4face2fc70
        script_kill = (struct Flag *) 0x1187b70
        demo = (struct Flag *) 0x1187ca0
        module = (struct GModule *) 0x7f4face2fc40
        arglist = {0x0, 0x62f4d8 "\177eS®O\177", 0x0}
        autoload = 0x0
        i = 0
        aload = 1
        argv2 = (char **) 0x11882e0
        argc2 = 1
        ii = 0
        jj = 0
#2  0x000000000041be83 in Ninitdata (interp=0x10e82b0, data=0x630b40) at nviz_init.c:543
        argv0 = 0x1187a90 "/usr/local/src/grass/svn/trunk/dist.x86_64-unknown-linux-gnu/etc/nviz2.2/scripts/nviz2.2_script"
        argv = (const char **) 0x10fa8b0
        argc = 0
#3  0x000000000041bddf in Ninit (interp=0x10e82b0, w=0x0) at nviz_init.c:507
        data = {Zrange = 0, XYrange = 0, NumCplanes = 0, CurCplane = 0, Cp_on = {0, 0, 0, 0, 0, 0}, Cp_trans = {{
      0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, Cp_rot = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, 
    {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, light = {{id = 0, brt = 0, r = 0, g = 0, b = 0, ar = 0, ag = 0, ab = 0, 
      x = 0, y = 0, z = 0, w = 0}, {id = 0, brt = 0, r = 0, g = 0, b = 0, ar = 0, ag = 0, ab = 0, x = 0, y = 0, 
      z = 0, w = 0}, {id = 0, brt = 0, r = 0, g = 0, b = 0, ar = 0, ag = 0, ab = 0, x = 0, y = 0, z = 0, w = 0}}, 
  BGcolor = 0}
#4  0x000000000041abce in NVIZ_AppInit (interp=0x10e82b0) at nvizAppInit.c:130
No locals.
#5  0x00007f4fac4d47e6 in Tk_MainEx () from /usr/lib/libtk8.4.so.0
No symbol table info available.
#6  0x000000000041ac82 in main (argc=3, argv=0x7fffb7eddc28) at nvizMain.c:61

what does ~/.nvizrc do? it is just ~/.nvwishrc by another name?

to be honest nviz's startup method is (and always has been) about as confusing to me as the custom osgeo4w grass64.bat startup method is. I think I need to slowly draw out a large flowchart for both :)

thanks, Hamish

in reply to:  8 ; comment:9 by glynn, 15 years ago

Replying to hamish:

One solution is to simply force argv[0] to "nviz" unless script_mode is set.

( source:grass/trunk/visualization/nviz/src/nviz_init.c, r40784)

I tried with DEBUG=2 but it dies before getting to the G_debug(2, "nviz_init:arg* lines in nviz_init.c.

It dies in the same way on trunk + linux too.

Oops; moving argv[0] to a separate argument also needs this:

-    if ((strstr(argv[0], "nviz") != NULL) && (!demo->answer)) {
+    if ((strstr(argv0, "nviz") != NULL) && (!demo->answer)) {

what does ~/.nvizrc do? it is just ~/.nvwishrc by another name?

Yes. It's the setting for tcl_rcFilename.

to be honest nviz's startup method is (and always has been) about as confusing to me as the custom osgeo4w grass64.bat startup method is.

The documentation for embedding Tcl/Tk assumes that you want to write a custom tclsh/wish, with the normal argument processing (i.e. -f), which gets in the way of G_parser(). Apart from the lack of documentation on doing otherwise, some of the NVIZ scripts require it to work that way (i.e. scripts/script_* starting with "#!nviz -f").

in reply to:  9 comment:10 by glynn, 15 years ago

Replying to glynn:

Oops; moving argv[0] to a separate argument also needs this:

-    if ((strstr(argv[0], "nviz") != NULL) && (!demo->answer)) {
+    if ((strstr(argv0, "nviz") != NULL) && (!demo->answer)) {

Actually, it needs to have the command passed separately; argv0 is the name of the script. Fixed (hopefully) in r40835.

comment:11 by hamish, 15 years ago

Fixed (hopefully) in r40835.

nope.

trunk:

debian_stable@GRASS7> nviz
...
launches straight into the program, no module options UI.
debian_stable@GRASS7> nviz --ui
sh: /usr/local/src/grass/svn/trunk/dist.x86_64-unknown-linux-gnu/etc/nviz2.2/scripts/nviz2.2_script: nviz: bad interpreter: No such file or directory
Traceback (most recent call last):
  File "/usr/local/src/grass/svn/trunk/dist.x86_64-unknown-linux-gnu/etc/wxpython/gui_modules/menuform.py", line 2058, in <module>
    GrassGUIApp(grassTask(sys.argv[1])).MainLoop()
  File "/usr/local/src/grass/svn/trunk/dist.x86_64-unknown-linux-gnu/etc/wxpython/gui_modules/menuform.py", line 350, in __init__
    processTask(tree = etree.fromstring(getInterfaceDescription(grassModule)),
  File "/usr/local/src/grass/svn/trunk/dist.x86_64-unknown-linux-gnu/etc/wxpython/gui_modules/menuform.py", line 1858, in getInterfaceDescription
    raise IOError, _("Unable to fetch interface description for command '%s'.") % cmd
IOError: Unable to fetch interface description for command '/usr/local/src/grass/svn/trunk/dist.x86_64-unknown-linux-gnu/etc/nviz2.2/scripts/nviz2.2_script'.

devbr65:

  • 6.5: GRASS_GUI=wxpython
    G65> 'nviz' or 'nviz --ui'
    
    sh: nviz2.2_script: command not found
    Traceback (most recent call last):
      File "/usr/local/src/grass/svn/grass65/dist.x86_64-unknown-linux-gnu/etc/wxpython/gui_modules/menuform.py", line 1891, in <module>
        GrassGUIApp( grassTask( sys.argv[1] ) ).MainLoop()
      File "/usr/local/src/grass/svn/grass65/dist.x86_64-unknown-linux-gnu/etc/wxpython/gui_modules/menuform.py", line 313, in __init__
        processTask(tree = etree.fromstring(getInterfaceDescription(grassModule)),
      File "/usr/local/src/grass/svn/grass65/dist.x86_64-unknown-linux-gnu/etc/wxpython/gui_modules/menuform.py", line 1691, in getInterfaceDescription
        raise IOError, _("Unable to fetch interface description for command '%s'.") % cmd
    IOError: Unable to fetch interface description for command 'nviz2.2_script'.
    
  • 6.5: GRASS_GUI=tcltk
    G65> 'nviz' or 'nviz --ui'
    ...
    nviz2.2_script elevation=elevation.dem 
    

module options UI opens, but fails with red (X) in output tab but no other message when you hit [Run].

  • nviz --help:
    Usage:
     nviz2.2_script [-qkxv] [elevation=name[,name,...]]
       [color=string[,string,...]] [vector=string[,string,...]]
       [points=string[,string,...]] [volume=string[,string,...]] [path=string]
       [script=string] [state=string] [--verbose] [--quiet]
    

module name is wrong but options are right.

Hamish

in reply to:  11 comment:12 by glynn, 15 years ago

Replying to hamish:

Fixed (hopefully) in r40835.

nope.

trunk:

debian_stable@GRASS7> nviz
...
launches straight into the program, no module options UI.

Not a bug, but a difference in G_parser() behaviour between 6.x and 7.0. None of NVIZ' options are ->required=YES, so you aren't asked to provide any. All modules now behave this way. Previously, specific modules would use e.g.

    if (argc > 1 && G_parser(argc, argv))
       ...

to skip calling G_parser() altogether if no options were provided and none were required (so you could run e.g. "d.erase" without being prompted for the colour). But this has issues, e.g. module->overwrite not being set from $GRASS_OVERWRITE.

debian_stable@GRASS7> nviz --ui
sh: /usr/local/src/grass/svn/trunk/dist.x86_64-unknown-linux-gnu/etc/nviz2.2/scripts/nviz2.2_script: nviz: bad interpreter: No such file or directory

This appears to fix that:

--- visualization/nviz/src/nviz_init.c	(revision 40851)
+++ visualization/nviz/src/nviz_init.c	(working copy)
@@ -137,7 +137,7 @@
      * If left in it treats it as a elev arg and tries to open
      */
     argv2 = G_malloc((argc + 2) * sizeof(char *));
-    argv2[0] = (char *)argv0;
+    argv2[0] = (char *)cmd;
     for (ii = 0; ii < argc; ii++)
 	argv2[ii + 1] = (char *)argv[ii];
     argv2[argc + 1] = NULL;

devbr65:

  • 6.5: GRASS_GUI=wxpython
G65> 'nviz' or 'nviz --ui'

sh: nviz2.2_script: command not found

Odd; I can't see any significant differences between 6.5 and 7.0 in this regard. I'll get back to the 6.5 issues once the latest 6.5 has compiled.

  • nviz --help:
Usage:
 nviz2.2_script [-qkxv] [elevation=name[,name,...]]

module name is wrong but options are right.

This should be fixed by the argv0 -> cmd change.

in reply to:  11 comment:13 by glynn, 15 years ago

Replying to hamish:

devbr65:

  • 6.5: GRASS_GUI=wxpython
G65> 'nviz' or 'nviz --ui'

sh: nviz2.2_script: command not found
  • 6.5: GRASS_GUI=tcltk
G65> 'nviz' or 'nviz --ui'
...
nviz2.2_script elevation=elevation.dem 

module options UI opens, but fails with red (X) in output tab but no other message when you hit [Run].

Both of these are fixed by the argv0 -> cmd change. Committed as r40858 (6.5) and r40859 (7.0).

comment:14 by hamish, 15 years ago

Ok, now it seems to work ok from the 6.5 command line and GUIs. So backported to 6.4.

but still a weird problem in trunk:

  • G7> nviz --ui
  • (module option gui opens)
  • select raster elevation: elevation.dem@PERMANENT
  • [Run]
  • a window flashes open then closes again and this is written to the module GUI output tab:
    (Mon Feb  8 21:00:20 2010)                                                      
    /usr/local/src/grass/svn/trunk/dist.x86_64-unknown-linux-gnu/etc/nviz2.2/nviz elevation=elevation.dem@PERMANENT
    Error in startup script: couldn't read file
    "elevation=elevation.dem@PERMANENT": no such file or
    directory
    (Mon Feb  8 21:00:20 2010) Command finished (0 sec)  
    

If I try again, but with the --verbose flag turned on, the Please wait.. and NVIZ wish windows open (and stay open); the authors text is written to the output tab ($Id$ seems broken); then it locks up after:

The papers are available at
http://www2.gis.uiuc.edu:2280/modviz/
Loading raster map <elevation.dem@PERMANENT>...
Loading raster map <elevation.dem@PERMANENT>...
Translating colors from raster map <elevation.dem@PERMANENT>...

Pressing the [Abort command] button writes the inconsistent stage warning (which isn't really needed here [s/stage/state/?]) and stops it.

Hamish

comment:15 by hamish, 15 years ago

the authors text is written to the output tab ($Id$ seems broken)

Version: @(#) 7.0.svn (2010)

from nviz_init.c

    G_verbose_message("Version: %s", GRASS_VERSION_STRING);

include/version.h:

#define GRASS_VERSION_STRING   "@(#) 7.0.svn (2010)"

include/version.h.in:

#define GRASS_VERSION_STRING   "@(#) @GRASS_VERSION_NUMBER@ (@GRASS_VERSION_DATE@)"

same thing, all versions. what's with the leading @(#)?

Hamish

in reply to:  14 ; comment:16 by glynn, 15 years ago

Replying to hamish:

Ok, now it seems to work ok from the 6.5 command line and GUIs. So backported to 6.4.

but still a weird problem in trunk:

  • G7> nviz --ui
  • (module option gui opens)
  • select raster elevation: elevation.dem@PERMANENT
  • [Run]
  • a window flashes open then closes again and this is written to the module GUI output tab:

Ugh. Try this:

--- visualization/nviz/src/nviz_init.c	(revision 40859)
+++ visualization/nviz/src/nviz_init.c	(working copy)
@@ -137,7 +137,7 @@
      * If left in it treats it as a elev arg and tries to open
      */
     argv2 = G_malloc((argc + 2) * sizeof(char *));
-    argv2[0] = (char *) cmd;
+    argv2[0] = "nviz";
     for (ii = 0; ii < argc; ii++)
 	argv2[ii + 1] = (char *)argv[ii];
     argv2[argc + 1] = NULL;

No idea why it would work in 6.x without this.

I think that it might be better to change the startup, moving the top of parse_command() (everything up to and including the G_parser() call) into main(), so that it's a normal "GRASS module" main(). If G_parser() indicates normal operation (i.e. not --help, --ui, etc), we call Tk_Main() with "fabricated" argc and argv (i.e. insert the "-f nviz2.2_script"). For --help, --ui etc, Tcl/Tk never gets involved.

This doesn't allow the nviz binary to be used to run arbitrary scripts, but I'm not so sure that works anyhow.

in reply to:  16 comment:17 by glynn, 15 years ago

Replying to glynn:

I think that it might be better to change the startup, moving the top of parse_command() (everything up to and including the G_parser() call) into main(), so that it's a normal "GRASS module" main(). If G_parser() indicates normal operation (i.e. not --help, --ui, etc), we call Tk_Main() with "fabricated" argc and argv (i.e. insert the "-f nviz2.2_script"). For --help, --ui etc, Tcl/Tk never gets involved.

This doesn't allow the nviz binary to be used to run arbitrary scripts, but I'm not so sure that works anyhow.

I've done this for 7.0 in r40879. The nviz binary is installed into $GISBASE/bin; the script and batch file aren't used. If argv[1] is '-f', it behaves like "wish", otherwise it behaves like a GRASS module: G_gisinit(), G_parser(), then calls Tk_Main() with argv = {"nviz", "-f", ".../nviz2.2_script", NULL}. It appears to do the right thing for all cases (nviz, nviz -q, nviz --ui (then "Run"), nviz elevation.dem), at least on Linux (compiling on Windows takes a while).

comment:18 by hamish, 15 years ago

Latest from trunk tests out ok for me too on Linux.

This doesn't allow the nviz binary to be used to run arbitrary scripts, but I'm not so sure that works anyhow.

do you mean nvwish running arbitrary Tcl scripts (no loss) or the ability to use the script= option (which is used by d.nviz to set up the 'flight path' for animations).

Hamish

comment:19 by hamish, 15 years ago

With the latest nightly WinGrass 6.4.0svn build (r40876), I get this error message if 'nviz --ui' is called from the msys command line, elev=elevation.dem@PERM, and the '-v' verbose flag is ticked (one -, not two).

the command line in the module output tab is

nviz -v elevation=elevation.dem@PERMANENT

the popup window error is:

__Application initialization failed__

unknown or ambiguous visual name "elevation=elevation@PERMANENT": class must be best, directcolor, grayscale, greyscale, pseudocolor, staticcolor, staicgray, staticgrey, truecolor, or default
  [Ok]

then when you press [Ok]:

__Error in startup script__

can't read "src_boot": no such variable
  while executing
"source $src_boot/etc/nviz2.2/scripts/config.tcl"
  (file "c:/Program Files/GRASS-64-SVN\etc\nviz2.2\scripts\nviz2.2_script" line 42)
   [Ok]

same if you use -v from the msys prompt.

If you make "-v" the last arg on the command line you get this error:

__Application initialization failed__

"-v" option requires an additional arguement
  [Ok]

This is the same error message you get if you do:

wish -v

I'd be inclined to make that -v in nviz a no-op, but I don't think it would help in this case.

Hamish

in reply to:  18 comment:20 by glynn, 15 years ago

Replying to hamish:

This doesn't allow the nviz binary to be used to run arbitrary scripts, but I'm not so sure that works anyhow.

do you mean nvwish running arbitrary Tcl scripts (no loss) or the ability to use the script= option (which is used by d.nviz to set up the 'flight path' for animations).

I meant "nviz -f <script>", but I think I got that working with r40879. I discovered that nviz2.2_script uses "exec nviz -f ..." in several places (it's relying upon the "#!nviz" to which I don't expect to work).

If argv[1] is "-f", main() skips the G_parser() stuff and calls Tk_Main() with the unmodified argument list. IOW, nviz behaves like wish.

If argv[1] isn't "-f", main() calls G_parser() on the original command line. If G_parser() returns successfully (--help etc all cause G_parser() to call exit()), it then calls Tk_Main() with a fabricated command line: "nviz -f .../nviz2.2_script" with no further arguments. IOW, nviz behaves like a GRASS module; all command-line processing is done by G_parser() before Tcl/Tk gets involved.

in reply to:  19 comment:21 by glynn, 15 years ago

Replying to hamish:

With the latest nightly WinGrass 6.4.0svn build (r40876), I get this error message if 'nviz --ui' is called from the msys command line, elev=elevation.dem@PERM, and the '-v' verbose flag is ticked (one -, not two).

the popup window error is:

unknown or ambiguous visual name "elevation=elevation@PERMANENT":

Tk uses -v itself (it's an abbreviation for -visual). This specific issue can be worked around by using "--" in the nviz script, i.e.

-exec "$GISBASE/etc/nviz2.2/nviz" -f "$GISBASE/etc/nviz2.2/scripts/nviz2.2_script" ${1+"$@"}
+exec "$GISBASE/etc/nviz2.2/nviz" -f "$GISBASE/etc/nviz2.2/scripts/nviz2.2_script" -- ${1+"$@"}

But I'm more inclined to suggest back-porting r40879. I think that's bound to be the most robust solution.

comment:22 by hamish, 15 years ago

Following the conservative path of least change I've committed the "--" solution to the 6.4 branch. For wider testing I'd like to backported r40879 to the 6.5 branch, but I got stuck in the merge conflicts. I had to comment out Vars.make as it doesn't exist and getCat.c was failing because it couldn't find V2_area_att() and V2_line_att(). I'm not sure where those are supposed to come from.

Hamish

in reply to:  22 ; comment:23 by glynn, 15 years ago

Replying to hamish:

Following the conservative path of least change I've committed the "--" solution to the 6.4 branch. For wider testing I'd like to backported r40879 to the 6.5 branch, but I got stuck in the merge conflicts. I had to comment out Vars.make as it doesn't exist and getCat.c was failing because it couldn't find V2_area_att() and V2_line_att(). I'm not sure where those are supposed to come from.

r40879 doesn't touch those files.

I've found using "svn merge" between branches is more trouble than it's worth. It's easier to use e.g.:

cd /path/to/7.0.svn
svn diff -c 40879 > nviz.patch
cd ../6.5
patch -p0 < ../7.0.svn/nviz.patch

This still produces some failures, but it doesn't try to merge unrelated changes.

I'm test-compiling a manual back-port at the moment; I'll attach the patch one I've verified that it compiles.

by glynn, 15 years ago

Attachment: nviz.patch added

Patch to back-port r40879 to 6.5

in reply to:  23 ; comment:24 by glynn, 15 years ago

Replying to glynn:

I'm test-compiling a manual back-port at the moment; I'll attach the patch one I've verified that it compiles.

Verified, attached.

comment:25 by hamish, 15 years ago

patch applied to 6.5svn in r40930.

in reply to:  24 comment:26 by hellik, 15 years ago

Replying to glynn:

Replying to glynn:

I'm test-compiling a manual back-port at the moment; I'll attach the patch one I've verified that it compiles.

Verified, attached.

still valid this report? I've tested nviz by self-compiled latest grass64- and grass65-svn in the osgeo4w-stack on WinVista, nviz is starting and working.

Helmut

comment:27 by hamish, 15 years ago

Resolution: fixed
Status: newclosed

closing report as everything is pretty much working now. Purposefully ignoring any remaining single-dash -v flag issues, if they still exist, as corner cases.

Note: See TracTickets for help on using tickets.