Details Ticket 4450


Comment | Reply | Open


Serial Number 4450
Subject g.remove vect: empty dirs in the $MAPSET/.tmp/$HOSTNAME left
Area grass6
Queue grass
Requestors werchowyna@epf.pl
Owner mneteler
Status resolved
Last User Contact Sun Jun 18 10:25:45 2006 (2 yr ago)
Current Priority 30
Final Priority 70
Due No date assigned
Last Action Sun Jun 18 10:26:01 2006 (2 yr ago)
Created Thu May 11 12:34:26 2006 (2 yr ago)

Transaction History Ticket 4450


Thu, May 11 2006 12:34:26    Request created by guest  
Subject: g.remove vect: empty dirs in the $MAPSET/.tmp/$HOSTNAME left

Platform: GNU/Linux/x86
grass obtained from: CVS
grass binary for platform: Compiled from Sources
GRASS Version: 2006-05-08

For each vector file it removes, g.remove leaves 1 empty, redundant directory
in the $MAPSET/.tmp/$HOSTNAME. These directories are not removed after quiting
Grass either.

$ ls -R /home/grassdata/caves_utm33/melio2/.tmp/$HOSTNAME
/home/grassdata/caves_utm33/melio2/.tmp/quercus:
16491.0

/home/grassdata/caves_utm33/melio2/.tmp/quercus/16491.0:

Maciek
Thu, May 11 2006 22:48:03    Taken by mneteler  
Thu, May 11 2006 22:48:03    Mail sent by mneteler  
Hi,

we have an update "cleantemp" ready which needs further testing.
Are you willing to volunteer?

The current problem is that "cleantemp" doesn't work recursively.
It has been rewritten by Roberto Flor to do so. Only, it's not
yet in CVS.

Markus
Sun, May 14 2006 14:12:20    Mail sent by werchowyna@epf.pl  
Return-Path <werchowyna@epf.pl>
Delivered-To grass-bugs@lists.intevation.de
Date Sun, 14 May 2006 14:12:11 +0200
From Maciek Sieczka <werchowyna@epf.pl>
To Markus Neteler via RT <grass-bugs@intevation.de>
Cc grass-dev@grass.itc.it
Subject Re: [bug #4450] (grass) g.remove vect: empty dirs in the $MAPSET/.tmp/$HOSTNAME left
Message-Id <20060514141211.1c88bde7.werchowyna@epf.pl>
In-Reply-To <20060511204803.BC0481006A3@lists.intevation.de>
References <20060511204803.BC0481006A3@lists.intevation.de>
X-Mailer Sylpheed version 2.1.1 (GTK+ 2.8.6; i486-pc-linux-gnu)
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-Spam-Status No, hits=-4.9 tagged_above=-999.0 required=3.0 tests=BAYES_00
X-Spam-Level
On Thu, 11 May 2006 22:48:03 +0200 (CEST)
Markus Neteler via RT <grass-bugs@intevation.de> wrote:

> Hi,
> 
> we have an update "cleantemp" ready which needs further testing.
> Are you willing to volunteer?

What would it take?

Maciek

--------------------
W polskim Internecie s? setki milion?w stron. My przekazujemy Tobie tylko najlepsze
z nich!
http://katalog.panoramainternetu.pl/


Fri, Jun 16 2006 08:23:15    Mail sent by mneteler  
I can send the file to you, then you recompile it and test it.

Markus
Fri, Jun 16 2006 16:43:49    Status changed to resolved by mneteler  
Fri, Jun 16 2006 16:43:52    Status changed to open by mneteler  
Fri, Jun 16 2006 16:44:59    Mail sent by mneteler  
Hi,

the new version can be grabbed here:

http://mpa.itc.it/markus/tmp/clean_temp2.c

Then:

mv clean_temp2.c grass61/lib/init/clean_temp.c
cd grass61/lib/init/
make

etc.

thanks for testing,
 Markus
Sat, Jun 17 2006 13:32:24    Mail sent by msieczka  
I have built current Grass 6.1 CVS on Ubuntu Breezy with
http://mpa.itc.it/markus/tmp/clean_temp2.c apllied.

Built fine. Empty dirs are still left after 'g.remove vect', but they are
removed after quiting Grass session. Is this what it's expected to do? I'd
prefer each such empty dir be removed right after 'g.remove vect' is done, but
maybe this is not so critical.

Maciek
Sat, Jun 17 2006 15:04:52    Mail sent by neteler@itc.it  
Return-Path <neteler@itc.it>
Delivered-To grass-bugs@lists.intevation.de
Date Sat, 17 Jun 2006 15:04:50 +0200
From Markus Neteler <neteler@itc.it>
To Maciek Sieczka via RT <grass-bugs@intevation.de>
Cc grass-dev@grass.itc.it
Subject Re: [GRASS-dev] [bug #4450] (grass) g.remove vect: empty dirs in the $MAPSET/.tmp/$HOSTNAME left
Message-ID <20060617130450.GB22608@bartok.itc.it>
Mail-Followup-To Maciek Sieczka via RT <grass-bugs@intevation.de>, grass-dev@grass.itc.it
References <20060617113224.C41F31005A5@lists.intevation.de>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
In-Reply-To <20060617113224.C41F31005A5@lists.intevation.de>
X-PGP-Key http://www.gdf-hannover.de/neteler/markus_gpgkey.asc
X-PGP-Fingerprint D4D5 2F80 120E AD60 E2F6 2297 21B3 D02B E1E7 E789
User-Agent Mutt/1.5.11
X-Spam-Status No, hits=-4.9 tagged_above=-999.0 required=3.0 tests=BAYES_00
X-Spam-Level
Maciek,

On Sat, Jun 17, 2006 at 01:32:24PM +0200, Maciek Sieczka via RT wrote:
> I have built current Grass 6.1 CVS on Ubuntu Breezy with
> http://mpa.itc.it/markus/tmp/clean_temp2.c apllied.
> 
> Built fine. Empty dirs are still left after 'g.remove vect', but they are
> removed after quiting Grass session. Is this what it's expected to do?

Yes. Because the clean_temp is called upon start and stop of a GRASS
session using the standard launch procedure ("grass61").

> I'd
> prefer each such empty dir be removed right after 'g.remove vect' is done,
but
> maybe this is not so critical.

This is an issue of the program creating the vector map in
question. Which one did you use? A script, r.* or v.*?

Markus


Sat, Jun 17 2006 19:12:17    Mail sent by werchowyna@epf.pl  
Return-Path <werchowyna@epf.pl>
Delivered-To grass-bugs@lists.intevation.de
Date Sat, 17 Jun 2006 19:12:10 +0200
From Maciek Sieczka <werchowyna@epf.pl>
To grass-bugs@intevation.de
Cc grass-dev@grass.itc.it
Subject Re: [bug #4450] (grass) g.remove vect: empty dirs in the $MAPSET/.tmp/$HOSTNAME left
Message-Id <20060617191210.f8e101f0.werchowyna@epf.pl>
In-Reply-To <20060617130452.DA0111005AA@lists.intevation.de>
References <20060617130452.DA0111005AA@lists.intevation.de>
X-Mailer Sylpheed version 2.1.1 (GTK+ 2.8.6; i486-pc-linux-gnu)
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-Spam-Status No, hits=-3.0 tagged_above=-999.0 required=3.0 tests=BAYES_00, REMOVE_REMOVAL_2WORD
X-Spam-Level
On Sat, 17 Jun 2006 15:04:52 +0200 (CEST)
Markus Neteler via RT <grass-bugs@intevation.de> wrote:

> On Sat, Jun 17, 2006 at 01:32:24PM +0200, Maciek Sieczka via RT wrote:
> > I have built current Grass 6.1 CVS on Ubuntu Breezy with
> > http://mpa.itc.it/markus/tmp/clean_temp2.c apllied.

> > I'd prefer each such empty dir be removed right after 'g.remove
> > vect'is done, but maybe this is not so critical.

> This is an issue of the program creating the vector map in
> question. Which one did you use? A script, r.* or v.*?

It is 'g.remove vect' that leaves empty temp dirs in the .tmp. As my
bug report reads:

>For each vector file it removes, g.remove leaves 1 empty, redundant
>directory in the $MAPSET/.tmp/$HOSTNAME.

To reproduce:

1. Create a vector file
2. Empty your $MAPSET/.tmp/$HOSTNAME entirely.
3. g.remove that vector.
4. See an orphaned empty dir left over.

Maciek

------------------------------------------------------------------------
CIEP?E KRAJE - CIEP?E MORZA. Szukasz atrakcyjnego wypoczynku w przyst?pnej cenie,
zapoznaj si? z nasz? ofert?.
ZAPRASZAMY

www.skarpatravel.pl


Sat, Jun 17 2006 19:27:58    Mail sent by neteler@itc.it  
Return-Path <neteler@itc.it>
Delivered-To grass-bugs@lists.intevation.de
Date Sat, 17 Jun 2006 19:27:55 +0200
From Markus Neteler <neteler@itc.it>
To Maciek Sieczka <werchowyna@epf.pl>
Cc grass-bugs@intevation.de, grass-dev@grass.itc.it
Subject Re: [GRASS-dev] Re: [bug #4450] (grass) g.remove vect: empty dirs in the $MAPSET/.tmp/$HOSTNAME left
Message-ID <20060617172755.GA23778@bartok.itc.it>
Mail-Followup-To Maciek Sieczka <werchowyna@epf.pl>, grass-bugs@intevation.de, grass-dev@grass.itc.it
References <20060617130452.DA0111005AA@lists.intevation.de> <20060617191210.f8e101f0.werchowyna@epf.pl>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
In-Reply-To <20060617191210.f8e101f0.werchowyna@epf.pl>
X-PGP-Key http://www.gdf-hannover.de/neteler/markus_gpgkey.asc
X-PGP-Fingerprint D4D5 2F80 120E AD60 E2F6 2297 21B3 D02B E1E7 E789
User-Agent Mutt/1.5.11
X-Spam-Status No, hits=-3.0 tagged_above=-999.0 required=3.0 tests=BAYES_00, REMOVE_REMOVAL_2WORD
X-Spam-Level
On Sat, Jun 17, 2006 at 07:12:10PM +0200, Maciek Sieczka wrote:
> On Sat, 17 Jun 2006 15:04:52 +0200 (CEST)
> Markus Neteler via RT <grass-bugs@intevation.de> wrote:
> 
> > On Sat, Jun 17, 2006 at 01:32:24PM +0200, Maciek Sieczka via RT wrote:
> > > I have built current Grass 6.1 CVS on Ubuntu Breezy with
> > > http://mpa.itc.it/markus/tmp/clean_temp2.c apllied.
> 
> > > I'd prefer each such empty dir be removed right after 'g.remove
> > > vect'is done, but maybe this is not so critical.
> 
> > This is an issue of the program creating the vector map in
> > question. Which one did you use? A script, r.* or v.*?
> 
> It is 'g.remove vect' that leaves empty temp dirs in the .tmp.

In a sense yes: 'g.remove vect' doesn't remove the empty temp dirs 
in the LOCATION/MAPSET/.tmp/

But that's not even the idea of g.remove.

> As my bug report reads:
> 
> >For each vector file it removes, g.remove leaves 1 empty, redundant
> >directory in the $MAPSET/.tmp/$HOSTNAME.
> 
> To reproduce:
> 
> 1. Create a vector file

My question was: which command did you use to create a vector file?
That command should not leave files in .tmp/. There we have to
search for the problem IMHO.

> 2. Empty your $MAPSET/.tmp/$HOSTNAME entirely.
> 3. g.remove that vector.

No - g.remove removes a vector map and doesn't care for tmp files.

Markus

> 4. See an orphaned empty dir left over.
> 
> Maciek
> 


Sat, Jun 17 2006 19:53:23    Mail sent by werchowyna@epf.pl  
Return-Path <werchowyna@epf.pl>
Delivered-To grass-bugs@lists.intevation.de
Date Sat, 17 Jun 2006 19:53:29 +0200
From Maciek Sieczka <werchowyna@epf.pl>
To Markus Neteler <neteler@itc.it>
Cc grass-bugs@intevation.de, grass-dev@grass.itc.it
Subject Re: [GRASS-dev] Re: [bug #4450] (grass) g.remove vect: empty dirs in the $MAPSET/.tmp/$HOSTNAME left
Message-Id <20060617195329.1e875a0e.werchowyna@epf.pl>
In-Reply-To <20060617172755.GA23778@bartok.itc.it>
References <20060617130452.DA0111005AA@lists.intevation.de> <20060617191210.f8e101f0.werchowyna@epf.pl> <20060617172755.GA23778@bartok.itc.it>
X-Mailer Sylpheed version 2.1.1 (GTK+ 2.8.6; i486-pc-linux-gnu)
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-Spam-Status No, hits=-3.0 tagged_above=-999.0 required=3.0 tests=BAYES_00, REMOVE_REMOVAL_2WORD
X-Spam-Level
On Sat, 17 Jun 2006 19:27:55 +0200
Markus Neteler <neteler@itc.it> wrote:

> On Sat, Jun 17, 2006 at 07:12:10PM +0200, Maciek Sieczka wrote:
> > On Sat, 17 Jun 2006 15:04:52 +0200 (CEST)
> > Markus Neteler via RT <grass-bugs@intevation.de> wrote:
> > 
> > > On Sat, Jun 17, 2006 at 01:32:24PM +0200, Maciek Sieczka via RT
> > > wrote:
> > > > I have built current Grass 6.1 CVS on Ubuntu Breezy with
> > > > http://mpa.itc.it/markus/tmp/clean_temp2.c apllied.
> > 
> > > > I'd prefer each such empty dir be removed right after 'g.remove
> > > > vect'is done, but maybe this is not so critical.
> > 
> > > This is an issue of the program creating the vector map in
> > > question. Which one did you use? A script, r.* or v.*?
> > 
> > It is 'g.remove vect' that leaves empty temp dirs in the .tmp.
> 
> In a sense yes: 'g.remove vect' doesn't remove the empty temp dirs 
> in the LOCATION/MAPSET/.tmp/
> 
> But that's not even the idea of g.remove.
> 
> > As my bug report reads:
> > 
> > >For each vector file it removes, g.remove leaves 1 empty, redundant
> > >directory in the $MAPSET/.tmp/$HOSTNAME.
> > 
> > To reproduce:
> > 
> > 1. Create a vector file
> 
> My question was: which command did you use to create a vector file?
> That command should not leave files in .tmp/. There we have to
> search for the problem IMHO.

And I'm telling you that command that created the temp dir, is 'g.remove
vect'. And that it is 'g.remove vect' that is supposed to remove a 
temporary dir, which it created.

Or did I missunderstood?
 
> > 2. Empty your $MAPSET/.tmp/$HOSTNAME entirely.
> > 3. g.remove that vector.

> No - g.remove removes a vector map and doesn't care for tmp files.

But it should remove temp dirs which it created. Or not?

> > 4. See an orphaned empty dir left over.

Maciek

------------------------------------------------------------------------
CIEP?E KRAJE - CIEP?E MORZA. Szukasz atrakcyjnego wypoczynku w przyst?pnej cenie,
zapoznaj si? z nasz? ofert?.
ZAPRASZAMY

www.skarpatravel.pl


Sat, Jun 17 2006 21:18:59    Mail sent by neteler@itc.it  
Return-Path <neteler@itc.it>
Delivered-To grass-bugs@lists.intevation.de
Date Sat, 17 Jun 2006 21:18:56 +0200
From Markus Neteler <neteler@itc.it>
To grass-dev@grass.itc.it
Cc grass-bugs@intevation.de
Subject Re: [GRASS-dev] Re: [bug #4450] (grass) g.remove vect: empty dirs in the $MAPSET/.tmp/$HOSTNAME left
Message-ID <20060617191856.GC24122@bartok.itc.it>
Mail-Followup-To grass-dev@grass.itc.it, grass-bugs@intevation.de
References <20060617130452.DA0111005AA@lists.intevation.de> <20060617191210.f8e101f0.werchowyna@epf.pl> <20060617172755.GA23778@bartok.itc.it> <20060617195329.1e875a0e.werchowyna@epf.pl> <20060617190019.GB24122@bartok.itc.it>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
In-Reply-To <20060617190019.GB24122@bartok.itc.it>
X-PGP-Key http://www.gdf-hannover.de/neteler/markus_gpgkey.asc
X-PGP-Fingerprint D4D5 2F80 120E AD60 E2F6 2297 21B3 D02B E1E7 E789
User-Agent Mutt/1.5.11
X-Spam-Status No, hits=-4.9 tagged_above=-999.0 required=3.0 tests=BAYES_00
X-Spam-Level
On Sat, Jun 17, 2006 at 09:00:19PM +0200, Markus Neteler wrote:
> On Sat, Jun 17, 2006 at 07:53:29PM +0200, Maciek Sieczka wrote:
...
> > > > It is 'g.remove vect' that leaves empty temp dirs in the .tmp.

Now I understand and have the bug reproduced.

In fact g.remove vect=map somewhere creates a
directory in .tmp/ when removing an existing vector map.
It happens in G_find_vector2() which is called in
line 24 of 
general/manage/lib/do_remove.c

but I am getting list in the G_find_vector2() and subsequent stuff.

Markus


Sun, Jun 18 2006 07:34:04    Mail sent by glynn@gclements.plus.com  
Return-Path <glynn@gclements.plus.com>
Delivered-To grass-bugs@lists.intevation.de
From Glynn Clements <glynn@gclements.plus.com>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
Message-ID <17556.58814.38702.209188@cerise.gclements.plus.com>
Date Sun, 18 Jun 2006 06:33:50 +0100
To Markus Neteler <neteler@itc.it>
Cc grass-dev@grass.itc.it, grass-bugs@intevation.de
Subject Re: [GRASS-dev] Re: [bug #4450] (grass) g.remove vect: empty dirs in the $MAPSET/.tmp/$HOSTNAME left
In-Reply-To <20060617191856.GC24122@bartok.itc.it>
References <20060617130452.DA0111005AA@lists.intevation.de> <20060617191210.f8e101f0.werchowyna@epf.pl> <20060617172755.GA23778@bartok.itc.it> <20060617195329.1e875a0e.werchowyna@epf.pl> <20060617190019.GB24122@bartok.itc.it> <20060617191856.GC24122@bartok.itc.it>
X-Mailer VM 7.07 under 21.4 (patch 15) "Security Through Obscurity" XEmacs Lucid
X-Spam-Status No, hits=-4.9 tagged_above=-999.0 required=3.0 tests=BAYES_00
X-Spam-Level
Markus Neteler wrote:

> On Sat, Jun 17, 2006 at 09:00:19PM +0200, Markus Neteler wrote:
> > On Sat, Jun 17, 2006 at 07:53:29PM +0200, Maciek Sieczka wrote:
> ...
> > > > > It is 'g.remove vect' that leaves empty temp dirs in the .tmp.
> 
> Now I understand and have the bug reproduced.
> 
> In fact g.remove vect=map somewhere creates a
> directory in .tmp/ when removing an existing vector map.
> It happens in G_find_vector2() which is called in
> line 24 of 
> general/manage/lib/do_remove.c

That's incorrect; it happens in Vect_delete() at line 26 of that file.

It appears that it moves the vector directory to the .tmp directory
before trying to delete it, but doesn't delete it correctly. From
Vect_delete(), in vector/Vlib/map.c:

    tmp = G_tempfile();

    G_debug (3, "rename '%s' to '%s'", buf, tmp );
    ret = rename ( buf, tmp );

    if ( ret == -1 ) {
	G_warning ( "Cannot rename directory '%s' to '%s'", buf, tmp );
	return -1;
    }

    G_debug (3, "unlink directory '%s'", tmp );
    ret = unlink ( tmp );

unlink() doesn't work on directories, you have to use rmdir() instead.

Or, better still, remove(), which calls either unlink() or rmdir()
depending upon whether the target is a directory; remove() is ANSI,
whereas unlink() and rmdir() are POSIX.

-- 
Glynn Clements <glynn@gclements.plus.com>


Sun, Jun 18 2006 10:25:45    Mail sent by guest  
Bug fixed in CVS.
Thanks for insisting, Maciek!

Markus
Sun, Jun 18 2006 10:26:01    Status changed to resolved by mneteler  
Comment | Reply | Open

You are currently authenticated as guest.
[Show Configuration] [Login as another user]

Users Guide - Mail Commands - Homepage of RequestTracker 1.0.7 - list any request