[GRASS-dev] [GRASS GIS] #3857: r.mapcalc unable to rename null and cell files

GRASS GIS trac at osgeo.org
Sun Jun 2 10:52:35 PDT 2019

#3857: r.mapcalc unable to rename null and cell files
  Reporter:  Hygsson  |      Owner:  grass-dev@…
      Type:  defect   |     Status:  closed
  Priority:  major    |  Milestone:  7.6.2
 Component:  Raster   |    Version:  unspecified
Resolution:  wontfix  |   Keywords:  r.mapcalc
       CPU:  x86-64   |   Platform:  MSWindows 7

Comment (by glynn):

 Replying to [comment:2 hellik]:

 > it is an operating system issue/feature/limitation of MS windows, that
 you are not able to read and write the same file at the same time.

 By itself, that wouldn't be an issue. GRASS raster output doesn't modify
 files in-place, but creates a temporary file which is renamed into place
 by Rast_close(). But r.mapcalc doesn't close the input maps, so their
 cell/fcell/null files are still open when the output maps are closed. A
 fix **might** be as simple as calling close_maps() from
 [source:grass/trunk/raster/r.mapcalc/evaluate.c#L396 execute()], before
 the output maps are closed.

 The temporary file is used for cell, fcell and null files. Other files are
 modified in-place, but these are normally either closed before raster I/O
 starts or opened after raster I/O has completed.

 Aside: this is why G_tempfile() creates files in the mapset, not /tmp or
 $TMPDIR; they have to be on the same filesystem as the mapset so that
 rename() works.

Ticket URL: <https://trac.osgeo.org/grass/ticket/3857#comment:4>
GRASS GIS <https://grass.osgeo.org>

More information about the grass-dev mailing list