[GRASS-dev] Re: [GRASS GIS] #1158: Removing vector map in Windows
fails with "Unable to delete vector map"
GRASS GIS
trac at osgeo.org
Wed Apr 20 10:38:05 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 mmetz):
Replying to [comment:27 glynn]:
> Replying to [comment:25 mmetz]:
>
> > Hopefully fixed for devbr in r46041.
> >
> > Vect_delete() uses unlink(), whereas raster and all other files are
removed by remove(): the file will remain in existence until the last file
descriptor referring to it is closed (at least on Linux). In
Vect_delete(), I have replaced unlink() with remove(), working on Linux,
awaits testing on Windows.
>
> I'm fairly sure that r46041 has no effect. On Unix, the difference
between remove() and unlink() is that remove() handles both files and
directories; it calls unlink() for files and rmdir() for directories.
unlink() only works on files.
>
> The "garbage-collecting" behaviour (a file is removed when it has no
links and no process has it open) always applies. There is no way to force
deletion of a file which is open, or to remove all links to a file (there
may exist links in directories on which the process lacks write
permission, in directories which are inaccessible due to having another
filesystem mounted over them, etc).
>
> On Windows, I can't discern any difference between unlink() and
remove(). Unlike Unix, remove() only works for files. And unlike Unix, you
can't "unlink" a file which is open; the unlink/remove call fails with
EACCESS.
None of the files making up a native GRASS vector should be still open
when they are to be deleted. Some of them may have been opened and closed
recently (a few lines of code further up in Vect_delete()), but I am
pretty sure that they are all closed, otherwise g.remove should never
work. Maybe fclose() does not close a file stream now, but sometime soon
(e.g. busy flushing buffers), and 'soon' is sometimes too late?
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1158#comment:28>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list