[GRASS-dev] Re: [GRASS GIS] #1276: r.null in winGRASS does not work properly

GRASS GIS trac at osgeo.org
Thu Jan 26 05:10:33 EST 2012

#1276: r.null in winGRASS does not work properly
 Reporter:  helena            |       Owner:  grass-dev@…              
     Type:  defect            |      Status:  new                      
 Priority:  critical          |   Milestone:  6.4.2                    
Component:  Raster            |     Version:  6.4.1 RCs                
 Keywords:  r.null, wingrass  |    Platform:  MSWindows 7              
      Cpu:  Unspecified       |  

Comment(by hamish):

 Replying to [comment:13 glynn]:
 > Any previous null, cell or fcell file is always removed prior
 > to renaming the temporary file into place (on Windows, rename()
 > fails if the destination exists). When writing a new map (rather
 > than replacing an existing map), these files won't exist.
 > When writing an integer map, any existing fcell, f_format or
 > f_quant file is removed. If it isn't replacing an existing map,
 > or the existing map was an integer map, these files won't exist.
 > These probably arise from trying to remove the temporary file
 > after renaming has succeeded. Those remove() calls should either
 > be removed, or moved to the other branch of the conditional (i.e.
 > if rename() fails, remove() the file instead).
 > However: the first one can also occur if the temporary null file
 > is empty (which indicates an error writing the raster data).

 rather than just adding a only-remove if it exists (using e.g. stat())
 which may hide an error, it will be better to use the branch conditionals.
 (more work, but worth it)

 ok, the annoyance of seeing those warnings all the time will be motivating
 for the task..

 > > maybe this part of the code isn't being entered:
 > {{{
 > if (ok && (fcb->temp_name != NULL)) {
 > }}}
 > Not sure how that could happen.

 the new debug message inside that conditional confirms that it is getting
 into there, so it's not that.

 trying 'v.to.rast --overwrite' to replace the cell/ file still gives me

 WARNING: Unable to delete the f_format file
 WARNING: Unable to delete prior 'cell' file   ## (!! but it exists)
 WARNING: closecell: can't move [C:/Documents and Settings/User/My
   Documents/.../.tmp/1612.0] to cell file [.../cell/streets_speed]
 WARNING: Unable to delete the f_quant file

 I wonder if the reason it can't remove the prior 'cell' file and r.null
 failing are the same. (but why no error message from r.null in that case?)

 ... next step will be to add 'errno' reporting to the failed remove()
 prior 'cell' file message while rerunning v.to.rast with --overwrite.


Ticket URL: <https://trac.osgeo.org/grass/ticket/1276#comment:14>
GRASS GIS <http://grass.osgeo.org>

More information about the grass-dev mailing list