[GRASS-dev] [bug #4787] (grass) Path not found in Mac when Directory has spaces in the name

this bug's URL: http://intevation.de/rt/webrt?serial_num=4787
-------------------------------------------------------------------------

Subject: Path not found in Mac when Directory has spaces in the name

Platform: Mac OSX
grass obtained from: Trento Italy site
grass binary for platform: Downloaded precompiled Binaries

Agustin Diez-Castillo
When saving a display I got this message
rm: /Volumes/Home: No such file or directory
rm: Directory/neolitic/disco/AC_JACIMENTS/prospecciomay2006/mapa_04_07_2006.ppm: No such file or directory
# but it should be
/Volumes/Home\ Directory/neolitic/disco/AC_JACIMENTS/prospecciomay2006/mapa_04_07_2006.ppm
# or
'/Volumes/Home Directory/neolitic/disco/AC_JACIMENTS/prospecciomay2006/mapa_04_07_2006.ppm'
    while executing
"exec rm /Volumes/Home Directory/neolitic/disco/AC_JACIMENTS/prospecciomay2006/mapa_04_07_2006.ppm"
    ("eval" body line 1)
    invoked from within
"eval exec "rm $path.ppm""
    ("jpg" arm line 3)
    invoked from within
"switch $type {
      "ppm" {
        return
      }
      "tif" {
        eval exec {gdal_translate $path.ppm $path.tif -of GTIFF}
        eval exec "rm $path.ppm"
      }
  ..."
    (procedure "MapToolBar::savefile" line 22)
    invoked from within
"MapToolBar::savefile jpg 95"
    invoked from within
".mapcan(1).mf.topf.tb0.mapsave.sf.jpg invoke active"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 [list $w invoke active]"
    (procedure "tk::MenuInvoke" line 50)
    invoked from within
"tk::MenuInvoke .mapcan(1).mf.topf.tb0.mapsave.sf.jpg 1"
    (command bound to event)

-------------------------------------------- Managed by Request Tracker

Request Tracker wrote:

this bug's URL: http://intevation.de/rt/webrt?serial_num=4787
-------------------------------------------------------------------------

Subject: Path not found in Mac when Directory has spaces in the name

      "tif" {
        eval exec {gdal_translate $path.ppm $path.tif -of GTIFF}
        eval exec "rm $path.ppm"
      }

This is a good example of how /not/ to use "exec" in Tcl. A command is
a list of strings, not a string. This issue plagues Bourne-shell
scripts do the lack of support for lists. Tcl has lists, so there's no
reason for this type of issue to arise.

The above should be:

  exec gdal_translate $path.ppm $path.tif -of GTIFF
  exec rm $path.ppm

I strongly suspect that the same issue applies to most (if not all) of
the other occurrences of "eval exec ..." in gis.m (a quick "grep"
finds 50 of them).

--
Glynn Clements <glynn@gclements.plus.com>