[GRASS-dev] Re: [GRASS GIS] #520: r.terraflow/iostream does not respect STREAM_DIR option

GRASS GIS trac at osgeo.org
Thu Apr 9 10:34:58 EDT 2009


#520: r.terraflow/iostream does not respect STREAM_DIR option
---------------------+------------------------------------------------------
  Reporter:  mmetz   |       Owner:  grass-dev at lists.osgeo.org
      Type:  defect  |      Status:  new                      
  Priority:  major   |   Milestone:  6.4.0                    
 Component:  Raster  |     Version:  svn-develbranch6         
Resolution:          |    Keywords:                           
  Platform:  All     |         Cpu:  All                      
---------------------+------------------------------------------------------
Comment (by glynn):

 Replying to [comment:14 hamish]:

 > > /var/tmp does not exist on Windows, so this is not really a
 > > good choice for default temp directory.
 >
 > that is a problem. If it were decided to keep it out of $MAPSET/.tmp/ we
 could use a compiler macro for C:\Temp\Grass\, like we do for /dev/null
 and NUL:.

 A function, e.g. G_temp_dir() would be more useful.

 And we really ought to separate out the intended use of G_tempfile()
 (atomic updates) from its common use (arbitrary temporary files).

 > ISTR the output files are of some interest after the module has ended.
 is this the case? if so, putting them deep in a hidden .tmp/ dir isn't
 very nice.
 >
 > otherwise the lack of /var/tmp/ on MS-win makes a compelling case for
 moving it to $M/.tmp/ and short-circuiting this discussion.

 Note that the temporary directory also includes the hostname, in case the
 database is shared via NFS. PIDs are only unique per-host, so a PID alone
 doesn't guarantee uniqueness for networked filesystems.

 > > It is ok to call G_tempfile() in
 {{{
 streamdir->answer     = G_store(dirname(G_tempfile()));
 }}}
 > > because this happens in r.terraflow after G_gisinit() is called, not
 before.
 >
 > sorry, that should have read "before G_parser() has run", not
 G_gisinit().
 >
 > see:
 http://trac.osgeo.org/grass/browser/grass/trunk/lib/gis/parser.c#L724
 >
 > {{{"The only functions which can legitimately be called before
 G_parser() are: ..."}}}
 >
 > > AFAIKT, G_tempfile() only returns a filename, a file is not
 > > created (the description of G_tempfile() says so).

 Ideally, you shouldn't assume that the "GRASS environment" ($GISRC, VAR,
 WIND, etc) is valid until after G_parser() has returned. If you want
 context-dependent defaults, leave ->answer as NULL then assign the value
 after G_parser() has returned.

 Lots of code violates this rule (e.g. modules which use the DBMI typically
 fill in default values for the database options), but we should be
 eliminating this rather than adding to it.

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/520#comment:16>
GRASS GIS <http://grass.osgeo.org>


More information about the grass-dev mailing list