[GRASS-dev] [GRASS GIS] #890: shell scripts: %TMP% namespace collision

#890: shell scripts: %TMP% namespace collision
-------------------------------------+--------------------------------------
Reporter: hamish | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: major | Milestone: 6.4.0
Component: default | Version: svn-releasebranch64
Keywords: wingrass, shell scripts | Platform: MSWindows XP
      Cpu: All |
-------------------------------------+--------------------------------------
Hi,

  - MS-Windows sets %TMP%
  - MSys translates existing DOS variables into shell variables
  - %TMP% becomes $TMP
  - many shell scripts use {{{ TMP=`g.tempfile -p $$` }}}
  - many shell scripts try to remove $TMP* files even if they don't exist.
  - potential ka-boom if g.tempfile never ran

I just triggered this with a typo: `m.proj hlep`

should we `unset TMP` at the start of any script which uses it?

{{{
d.polar
db.dropcol
i.fusion.brovey
m.proj
r.in.wms
r.mask
r.plane
r.regression.line
r.univar.sh
v.colors
v.db.dropcol
v.db.renamecol
v.db.univar
v.in.garmin
v.in.gpsbabel
v.in.lines
v.in.mapgen
v.in.wfs
v.out.gpsbabel
v.rast.stats
v.univar.sh
}}}

or should we do that as part of WinGrass's Init.sh?

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/890&gt;
GRASS GIS <http://grass.osgeo.org>

#890: shell scripts: %TMP% namespace collision
---------------------------+------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.4.0
Component: default | Version: svn-releasebranch64
Resolution: | Keywords: wingrass, shell scripts
  Platform: MSWindows XP | Cpu: All
---------------------------+------------------------------------------------
Comment (by glynn):

Replying to [ticket:890 hamish]:

> should we `unset TMP` at the start of any script which uses it?

Use a different variable.

> or should we do that as part of WinGrass's Init.sh?

No. That would cause problems for anything which expects it to be set. As
would changing its value.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/890#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#890: shell scripts: %TMP% namespace collision
---------------------------+------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.4.0
Component: default | Version: svn-releasebranch64
Resolution: | Keywords: wingrass, shell scripts
  Platform: MSWindows XP | Cpu: All
---------------------------+------------------------------------------------
Comment (by hamish):

d.polar, db.dropcol, i.fusion.brovey, and m.proj done in 6.5svn with
r40686.

r.in.wms, r.mask, r.plane, r.regression.line, r.univar.sh done in 6.5svn
with r40687.

v.* still needs it.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/890#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#890: shell scripts: %TMP% namespace collision
---------------------------+------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.4.0
Component: default | Version: svn-releasebranch64
Resolution: | Keywords: wingrass, shell scripts
  Platform: MSWindows XP | Cpu: All
---------------------------+------------------------------------------------
Comment (by hamish):

v.* done in 6.5svn with r40689 and r40690.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/890#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#890: shell scripts: %TMP% namespace collision
---------------------------+------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.4.0
Component: default | Version: svn-releasebranch64
Resolution: | Keywords: wingrass, shell scripts
  Platform: MSWindows XP | Cpu: All
---------------------------+------------------------------------------------
Comment (by hamish):

backport this to relbr6.4 before or after rc6?

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/890#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#890: shell scripts: %TMP% namespace collision
---------------------------+------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.4.0
Component: default | Version: svn-releasebranch64
Resolution: | Keywords: wingrass, shell scripts
  Platform: MSWindows XP | Cpu: All
---------------------------+------------------------------------------------
Comment (by neteler):

Replying to [comment:4 hamish]:
> backport this to relbr6.4 before or after rc6?

Please (let's) do it before RC6 to avoid a RC7...

Markus

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/890#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#890: shell scripts: %TMP% namespace collision
---------------------------+------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.4.0
Component: default | Version: svn-releasebranch64
Resolution: | Keywords: wingrass, shell scripts
  Platform: MSWindows XP | Cpu: All
---------------------------+------------------------------------------------
Comment (by glynn):

Replying to [ticket:890 hamish]:

v.dissolve and v.in.mapgen weren't listed but also use $TMP. I've fixed
these in 6.5 with r41338.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/890#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>

#890: shell scripts: %TMP% namespace collision
---------------------------+------------------------------------------------
  Reporter: hamish | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: major | Milestone: 6.4.0
Component: default | Version: svn-releasebranch64
Resolution: | Keywords: wingrass, shell scripts
  Platform: MSWindows XP | Cpu: All
---------------------------+------------------------------------------------
Comment (by neteler):

Bulk-backport of r40686, r40687, r40689, r40690, r41338 in GRASS 6.4 as
r41340.

Markus

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/890#comment:7&gt;
GRASS GIS <http://grass.osgeo.org>