[GRASS-dev] Re: remove(dir) fails on Windows

Radim Blazek radim.blazek at gmail.com
Sat Sep 23 13:24:10 EDT 2006


On 9/22/06, Roger Bivand <Roger.Bivand at nhh.no> wrote:
> Radim Blazek <radim.blazek <at> gmail.com> writes:
>
> >
> > On 9/22/06, Radim Blazek <radim.blazek <at> gmail.com> wrote:
> > > On 9/22/06, Radim Blazek <radim.blazek <at> gmail.com> wrote:
> > > > Hi.
> > > > remove() directory fails on Windows so that vectors cannot be deleted
> > > > without error. Patch for lib/vector/Vlib/map.c is attached.
> > > > IMPORTANT!
> > >
> > > Much worse is that a vector open in QGIS cannot be deleted.
> > > Open file on Windows cannot be deleted nor moved.
> > > That is very bad because it is very common to run a module
> > > again and again and watch results on display.
> > > I don't have any idea what could be done.
> >
>
> http://www.mkssoftware.com/docs/man3/remove.3.asp
>
> says that:
>
> Windows NT/2000/XP/2003 does not let you delete a directory if a user has a lock
> on it. Any user that is in that directory has a lock on it. All locks to a
> directory must be resolved before remove() on a directory can be successful.
>
> There are also indications that the directory should also be empty, from rmdir():
>
> The rmdir() function removes an empty directory whose name is given by pathname.
> The directory must not have any entries other than dot (.) and dot-dot (..).
>
> If the directory's link count becomes zero and no process has the directory open
> or locked, the directory space is freed and the directory is no longer
> accessible. If one or more processes have the directory open or locked (for
> example, by having the directory as the current working directory), rmdir()
> fails and sets errno to EBUSY.
>
> Is this what is going on here?

No, dir is empty, no process has it as current and rmdir() works
but remove() does not.

Radim

> Roger
>
> > Output vector is now frozen when a module is started in GRASS tools
> > and thawn if finished with success. It is not perfect, does not
> > work from shell.
> >
> > Radim
> >
> > > Radim
> > >
> >
>
>
>
>
> _______________________________________________
> grass-dev mailing list
> grass-dev at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-dev
>




More information about the grass-dev mailing list