[GRASS-dev] Re: [GRASS GIS] #1158: Removing vector map in Windows fails with "Unable to delete vector map"

GRASS GIS trac at osgeo.org
Thu Apr 21 08:14:47 EDT 2011


#1158: Removing vector map in Windows fails with "Unable to delete vector map"
--------------------------------------------------------------------------+-
 Reporter:  lponti                                                        |       Owner:  grass-dev@…              
     Type:  defect                                                        |      Status:  new                      
 Priority:  blocker                                                       |   Milestone:  6.4.2                    
Component:  Vector                                                        |     Version:  6.4.0                    
 Keywords:  wingrass, g.mremove, wildcards, v.in.ogr, v.select, g.remove  |    Platform:  MSWindows 7              
      Cpu:  Unspecified                                                   |  
--------------------------------------------------------------------------+-

Comment(by glynn):

 Replying to [comment:28 mmetz]:

 > None of the files making up a native GRASS vector should be still open
 when they are to be deleted.

 I know that they '''shouldn't''' be open, but are they? See comment:3.

 > I am pretty sure that they are all closed, otherwise g.remove should
 never work.

 But g.remove '''doesn't''' work.

 Well, it works on Unix, as it's perfectly valid to remove a file which is
 open (remove() and unlink() just remove the filename; the file itself will
 be removed once there are no more links and no process has it open).

 And it works on Windows if you use it to remove a half-deleted map. In
 this case, the history file never gets opened in the first place.

 But it doesn't work on Windows if you try to remove a valid map.

 > Maybe fclose() does not close a file stream now, but sometime soon (e.g.
 busy flushing buffers), and 'soon' is sometimes too late?

 No; fclose() doesn't return until the underlying file is actually closed.
 Lots of code would break if this wasn't the case, as it's quite common to
 delete or rename a file immediately after fclose() (on Windows, you can't
 rename an open file).

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



More information about the grass-dev mailing list