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

GRASS GIS trac at osgeo.org
Thu Jan 26 04:02:12 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 glynn):

 Replying to [comment:12 hamish]:

 > hmmm, now r.to.vect (and r.circle, and probably many others) reports a
 bunch of problems, even on linux:
 >
 {{{
 WARNING: Unable to delete prior null-cells file
 WARNING: Unable to delete prior 'fcell' file
 WARNING: Unable to delete the prior 'cell' file
 WARNING: Unable to delete the f_format file
 WARNING: Unable to delete the f_quant file
 }}}

 These are likely a consequence of the original files not existing.

 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.

 >
 {{{
 WARNING: Unable to delete the temporary null-cells file
 WARNING: Unable to delete the temporary 'cell' file
 }}}

 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).

 > maybe this part of the code isn't being entered:
 {{{
 if (ok && (fcb->temp_name != NULL)) {
 }}}

 Not sure how that could happen. "ok" is true for G_close_cell() and false
 for G_unopen_cell(). r.null only calls G_unopen_cell() if the loop is
 terminated prematurely, in which case it prints a warning. fcb->tempname
 is set to the result of G_tempfile(), which is never null. The assignment
 is unconditional, and G!__open_raster_new() never returns prematurely
 without generating a warning.

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



More information about the grass-dev mailing list