Details Ticket 4331


Comment | Reply | Take | Open


Serial Number 4331
Subject delete if file exist - flag
Area wish6
Queue grass
Requestors wegmann@biozentrum.uni-wuerzburg.de
Owner none
Status resolved
Last User Contact Tue May 9 22:55:21 2006 (2 yr ago)
Current Priority 30
Final Priority 70
Due No date assigned
Last Action Tue May 9 22:55:21 2006 (2 yr ago)
Created Mon Apr 24 18:37:29 2006 (2 yr ago)

Transaction History Ticket 4331


Mon, Apr 24 2006 18:37:29    Request created by guest  
Subject: delete if file exist - flag

Platform: GNU/Linux/x86
grass obtained from: Trento Italy site
grass binary for platform: Compiled from Sources
GRASS Version: cvs 24.04.2006

Hello, 

a flag for each module to delete a raster/vector if the file already exists 
would be good.
A hidden g.remove with the respective name would do the job. That would make
it easier for users to play with certain settings and not substituting each 
time the old name or run g.remove. 

BTW the delete file handling is not consistent (but I think that has been 
discussed earlier) r.mapcalc is just overwriting the file but e.g. r.rescale
does prompt an error message that the file exist.

regards, Martin

Tue, Apr 25 2006 15:26:55    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 <17486.9109.391712.937443@cerise.gclements.plus.com>
Date Tue, 25 Apr 2006 14:26:45 +0100
To Request Tracker <grass-bugs@intevation.de>
Cc grass5@grass.itc.it
Subject Re: [GRASS5] [bug #4331] (grass) delete if file exist - flag
In-Reply-To <20060424163729.C3CC81005D9@lists.intevation.de>
References <20060424163729.C3CC81005D9@lists.intevation.de>
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
Request Tracker wrote:

> BTW the delete file handling is not consistent (but I think that has been 
> discussed earlier) r.mapcalc is just overwriting the file but e.g. r.rescale
> does prompt an error message that the file exist.

The libgis functions G_open_cell_new() etc will overwrite an existing
map without complaining. However, G_parser() will generate an error if
an option's gisprompt setting indicates a new map and the map already
exists.

In general, modules which use G_parser() won't allow overwriting
existing maps, while those which don't use it will allow it. Changing
r.mapcalc to use G_parser() isn't really an option, as that would
break all of the existing scripts which use it.

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


Tue, Apr 25 2006 16:10:54    Mail sent by wegmann@biozentrum.uni-wuerzburg.de  
Return-Path <wegmann@biozentrum.uni-wuerzburg.de>
Delivered-To grass-bugs@lists.intevation.de
From Martin Wegmann <wegmann@biozentrum.uni-wuerzburg.de>
Reply-To wegmann@biozentrum.uni-wuerzburg.de
To Glynn Clements via RT <grass-bugs@intevation.de>
Subject Re: [bug #4331] (grass) delete if file exist - flag
Date Tue, 25 Apr 2006 16:10:28 +0200
User-Agent KMail/1.9.1
References <20060425132655.6FD7D1006AB@lists.intevation.de>
In-Reply-To <20060425132655.6FD7D1006AB@lists.intevation.de>
MIME-Version 1.0
Content-Type text/plain; charset="iso-8859-1"
Content-Transfer-Encoding 7bit
Content-Disposition inline
Message-Id <200604251610.50643.wegmann@biozentrum.uni-wuerzburg.de>
X-Virus-Scanned by amavisd-new at uni-wuerzburg.de
X-Spam-Status No, hits=-4.9 tagged_above=-999.0 required=3.0 tests=BAYES_00
X-Spam-Level
On Tuesday 25 April 2006 15:26, Glynn Clements via RT wrote:
> Request Tracker wrote:
> > BTW the delete file handling is not consistent (but I think that has been
> > discussed earlier) r.mapcalc is just overwriting the file but e.g.
> > r.rescale does prompt an error message that the file exist.
>
> The libgis functions G_open_cell_new() etc will overwrite an existing
> map without complaining. However, G_parser() will generate an error if
> an option's gisprompt setting indicates a new map and the map already
> exists.
>
> In general, modules which use G_parser() won't allow overwriting
> existing maps, while those which don't use it will allow it. Changing
> r.mapcalc to use G_parser() isn't really an option, as that would
> break all of the existing scripts which use it.

Wouldn't it be possible to let r.mapcalc check for existing maps and prompt 
a "file will be overwritten - do you want to proceed" message? If "no", the 
user can change the name. 
It is not necessary to use G_parser() for r.mapcalc but to warn the user.

As far as I understood, adding a function in G_parser()  to overwrite maps is
not possible. Is it possible to add a faked "overwrite file" via a hidden 
g.remove rast="input_name"? 

regards, Martin


Tue, Apr 25 2006 17:44:42    Mail sent by michael.barton@asu.edu  
Return-Path <Michael.Barton@asu.edu>
Delivered-To grass-bugs@lists.intevation.de
Date Tue, 25 Apr 2006 08:43:19 -0700
From Michael Barton <michael.barton@asu.edu>
Subject Re: [GRASS5] [bug #4331] (grass) delete if file exist - flag
In-reply-to <20060424163729.C3CC81005D9@lists.intevation.de>
To Paolo Cavallini via RT <grass-bugs@intevation.de>, grass5@grass.itc.it
Message-id <C07391A7.20EA4%michael.barton@asu.edu>
MIME-version 1.0
Content-type text/plain; charset=US-ASCII
Content-transfer-encoding 7bit
User-Agent Microsoft-Entourage/11.2.3.060209
Thread-Topic [GRASS5] [bug #4331] (grass) delete if file exist - flag
Thread-Index AcZofvmiOAF1sNRyEdqI7AAUUSYxwg==
X-Spam-Status No, hits=-4.9 tagged_above=-999.0 required=3.0 tests=BAYES_00
X-Spam-Level
You're in luck. This DOES exist.

Just add --o to the end of a command and it will force an overwrite of any
existing file.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton


> From: Request Tracker <grass-bugs@intevation.de>
> Reply-To: Request Tracker <grass-bugs@intevation.de>
> Date: Mon, 24 Apr 2006 18:37:29 +0200 (CEST)
> To: <grass5@grass.itc.it>
> Subject: [GRASS5] [bug #4331] (grass) delete if file exist - flag
> 
> this bug's URL: http://intevation.de/rt/webrt?serial_num=4331
> -------------------------------------------------------------------------
> 
> Subject: delete if file exist - flag
> 
> Platform: GNU/Linux/x86
> grass obtained from: Trento Italy site
> grass binary for platform: Compiled from Sources
> GRASS Version: cvs 24.04.2006
> 
> Hello, 
> 
> a flag for each module to delete a raster/vector if the file already exists
> would be good.
> A hidden g.remove with the respective name would do the job. That would make
> it easier for users to play with certain settings and not substituting each
> time the old name or run g.remove.
> 
> BTW the delete file handling is not consistent (but I think that has been
> discussed earlier) r.mapcalc is just overwriting the file but e.g. r.rescale
> does prompt an error message that the file exist.
> 
> regards, Martin
> 
> 
> 
> -------------------------------------------- Managed by Request Tracker
> 


Tue, Apr 25 2006 20:10:59    Mail sent by neteler@itc.it  
Return-Path <neteler@itc.it>
Delivered-To grass-bugs@lists.intevation.de
Resent-From neteler@itc.it
Resent-Date Tue, 25 Apr 2006 20:10:53 +0200
Resent-Message-ID <20060425181053.GB1390@bartok.itc.it>
Resent-To grass-bugs@intevation.de
Date Tue, 25 Apr 2006 20:09:40 +0200
From Markus Neteler <neteler@itc.it>
To grass5@grass.itc.it
Subject Re: [GRASS5] [bug #4331] (grass) delete if file exist - flag
Message-ID <20060425180940.GA1390@bartok.itc.it>
Mail-Followup-To grass5@grass.itc.it
References <200604251814.50330.wegmann@biozentrum.uni-wuerzburg.de> <C073A531.20EC9%michael.barton@asu.edu>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
In-Reply-To <C073A531.20EC9%michael.barton@asu.edu>
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 Tue, Apr 25, 2006 at 10:06:41AM -0700, Michael Barton wrote:
> Martin,
> 
> I don't know why --o instead of -o.
> 
> I just say discussion of it on the list some time back and filed it away
> until I needed it. 
> 
> It should be documented if it is not.

This (documentation) should be implemented into the parser.
A way could be to check if a module used

cd ~/grass61/lib/gis > grep OUTPUT parser.c
        case G_OPT_R_OUTPUT:
        case G_OPT_V_OUTPUT:

If so, a first flag should be predefined with --o and explanation,
the rest follows as usual. This will give us motivation to then
update to G_OPT_R_OUTPUT and G_OPT_V_OUTPUT everywhere, such as

        parm.output = G_define_standard_option(G_OPT_R_OUTPUT);

or
        parm.output = G_define_standard_option(G_OPT_V_OUTPUT);

Second advantage of using these definitions is that the description
is identical and already translated to all supported languages.

Only, I don't know how to make this suggestion possible...

Markus


Tue, May 9 2006 22:55:21    Status changed to resolved by cshock  
Tue, May 9 2006 22:55:21    Mail sent by cshock  
Fixed in CVS: parser.c now includes help output (both --help and html) for the
--o option when a module uses "new,*" gisprompts.
Comment | Reply | Take | 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