[GRASS5] [bug #837] (grass) g.remove

this bug's URL: http://intevation.de/rt/webrt?serial_num=837
-------------------------------------------------------------------------

it keeps telling me to remove a file that doesn't exist....

$ g.list type=rast mapset=jidanni
----------------------------------------------
raster files available in mapset jidanni:
pipeline

----------------------------------------------
0grass$ g.list type=rast mapset=jidanni |egrep -v :\|-|xargs -n 1 g.remove
[pipeline@jidanni] is base map. Remove reclassed map first:
pipeline3@jidanni
0grass$ g.remove pipeline3
REMOVE [pipeline3]
raster MISSING
header MISSING
category MISSING
color MISSING
history MISSING
misc MISSING
fcell MISSING
g3dcell MISSING
0grass$ g.remove pipeline
[pipeline@jidanni] is base map. Remove reclassed map first:
pipeline3@jidanni
0grass$ g.remove pipeline3@jidanni
REMOVE [pipeline3@jidanni]
raster MISSING
header MISSING
category MISSING
color MISSING
history MISSING
misc MISSING
fcell MISSING
g3dcell MISSING
0grass$ find $LOCATION|grep pipe
/home/jidanni/tmp/grass/../grassdata/leics/jidanni/cell/pipeline
/home/jidanni/tmp/grass/../grassdata/leics/jidanni/cell_misc/pipeline
/home/jidanni/tmp/grass/../grassdata/leics/jidanni/cell_misc/pipeline/null
/home/jidanni/tmp/grass/../grassdata/leics/jidanni/cell_misc/pipeline/range
/home/jidanni/tmp/grass/../grassdata/leics/jidanni/cell_misc/pipeline/reclassed_to
/home/jidanni/tmp/grass/../grassdata/leics/jidanni/hist/pipeline
/home/jidanni/tmp/grass/../grassdata/leics/jidanni/cellhd/pipeline
/home/jidanni/tmp/grass/../grassdata/leics/jidanni/cats/pipeline

oh, I can remove it manually from g.remove:
enter raster file to be removed
Enter 'list' for a list of existing raster files
Hit RETURN to cancel request

pipeline

<pipeline>
Ok to remove [pipeline]? (y/n) y
REMOVE [pipeline]
raster
header
category
color MISSING
history
misc
fcell MISSING
g3dcell MISSING

by the way, too bad there is no g.list "all" to see everything at once.

--- Headers Follow ---

From neteler@itc.it Fri Nov 16 16:32:26 2001

Return-Path: <neteler@itc.it>
Delivered-To: grass-bugs@lists.intevation.de
Received: from omecihuatl.rz.uni-osnabrueck.de (omecihuatl.rz.Uni-Osnabrueck.DE [131.173.17.35])
  by lists.intevation.de (Postfix) with ESMTP id D7D90139CC
  for <grass-bugs@intevation.de>; Fri, 16 Nov 2001 16:32:24 +0100 (CET)
Received: from camelot.itc.it (camelot.itc.it [195.223.171.5])
  by omecihuatl.rz.uni-osnabrueck.de (8.11.1/8.11.1) with ESMTP id fAGFWOf23380
  for <grass-bugs@intevation.de>; Fri, 16 Nov 2001 16:32:24 +0100
Received: from artemide.itc.it (artemide [10.0.10.10])
  by camelot.itc.it (8.11.3/8.11.3) with ESMTP id fAGFWNd19160
  for <grass-bugs@intevation.de>; Fri, 16 Nov 2001 16:32:23 +0100 (MET)
Received: from thuille.itc.it. (thuille [10.40.0.110])
  by artemide.itc.it (8.11.3/8.11.3) with ESMTP id fAGFWME18142
  for <grass-bugs@intevation.de>; Fri, 16 Nov 2001 16:32:22 +0100 (MET)
Received: (from neteler@localhost)
  by thuille.itc.it. (8.11.6/8.11.2) id fAGFWLd29540
  for grass-bugs@intevation.de; Fri, 16 Nov 2001 16:32:21 +0100
Resent-Message-Id: <200111161532.fAGFWLd29540@thuille.itc.it.>
Received: from camelot.itc.it (camelot [195.223.171.5])
  by artemide.itc.it (8.11.3/8.11.3) with ESMTP id fAGFMLE16724
  for <neteler@itc.it>; Fri, 16 Nov 2001 16:22:21 +0100 (MET)
Received: from localhost.localdomain (h137.s30.ts32.hinet.net [163.32.30.137])
  by camelot.itc.it (8.11.3/8.11.3) with ESMTP id fAGFMHd18875
  for <neteler@itc.it>; Fri, 16 Nov 2001 16:22:19 +0100 (MET)
Received: by localhost.localdomain (Postfix, from userid 501)
  id 714A016E1; Fri, 16 Nov 2001 23:02:29 +0800 (CST)
To: Markus Neteler <neteler@itc.it>
Subject: g.remove
From: Dan Jacobson <jidanni@yam.com.tw>
Reply-To: jidanni@yahoo.com.tw
User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7
Date: Fri, 16 Nov 2001 23:02:28 +0800 01:00:00 +0000 (GMT)
Message-ID: <m2wv0qzrln.fsf@Mdan.jacobson.tw>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Resent-From: neteler@itc.it
Resent-Date: Fri, 16 Nov 2001 16:32:21 +0100
Resent-To: grass-bugs@intevation.de

-------------------------------------------- Managed by Request Tracker

Request Tracker wrote:

it keeps telling me to remove a file that doesn't exist....

$ g.list type=rast mapset=jidanni
----------------------------------------------
raster files available in mapset jidanni:
pipeline

----------------------------------------------
0grass$ g.list type=rast mapset=jidanni |egrep -v :\|-|xargs -n 1 g.remove
[pipeline@jidanni] is base map. Remove reclassed map first:
pipeline3@jidanni
0grass$ g.remove pipeline3
REMOVE [pipeline3]
raster MISSING
header MISSING
category MISSING
color MISSING
history MISSING
misc MISSING
fcell MISSING
g3dcell MISSING

OK, pipeline3 doesn't exist now ...

0grass$ g.remove pipeline
[pipeline@jidanni] is base map. Remove reclassed map first:
pipeline3@jidanni

... but it did once, and was presumably removed by means other than
g.remove.

Conclusion: if you remove a reclass map by means other than g.remove
(e.g. "rm"), you can't remove the base map with g.remove.

If this is a problem, the half-baked attempt at tracking reclass maps
will need to go altogether.

Note: g.remove cannot reasonably be made to remove "reclassed_to"
entries for reclass maps which no longer exists.

Under normal circumstances g.remove:

1. calls G_is_reclass() to determine the base map from the reclass
map's "cellhd" file.
2. calls G_is_reclassed_to() for the base map to verify the reclass.
3. removes the reclass map from the base map's "reclassed_to" file.
4. deletes the reclass map's files.

Once the reclass map's files have been deleted, G_is_reclass() won't
work, and can't work (at least, not without checking every
"reclassed_to" file which it can find).

This is just user error, so I'm changing this to "resolved".

--
Glynn Clements <glynn.clements@virgin.net>