Details Ticket 5197


Comment | Reply | Take | Resolve


Serial Number 5197
Subject G_parser() didn't catch 'old,vector,vector'
Area grass6
Queue grass
Requestors tutey@o2.pl
Owner none
Status open
Last User Contact Tue Oct 2 18:27:57 2007 (1 yr ago)
Current Priority 30
Final Priority 70
Due No date assigned
Last Action Tue Oct 2 18:27:57 2007 (1 yr ago)
Created Tue Oct 10 00:24:20 2006 (2 yr ago)

Transaction History Ticket 5197


Tue, Oct 10 2006 00:24:20    Request created by msieczka  
Subject: v.distance: segfault when 'from' vector doesn't exist

Current 6.3 CVS, Ubuntu Dapper.

As the title reads. Eg.:

$ v.distance from=dummy1 to=dummy2 upload=cat col=nic
Segmentation fault

Interestingly, with '-p' it will behave as supposed to:

$ v.distance -p from=dummy1 to=dummy2 upload=cat col=nic
ERROR: Cannot find vector dummy1@



BTW: why 'dummy1@' instead of 'dummy1@mapset_name'? I noticed the many (all?)
modules have been recently doing that. Related to recent --v/--q flags
development?

Maciek
Tue, Oct 10 2006 05:58:48    Mail sent by hamish_nospam@yahoo.com  
Return-Path <hamish_nospam@yahoo.com>
Delivered-To grass-bugs@lists.intevation.de
Date Tue, 10 Oct 2006 16:58:34 +1300
From Hamish <hamish_nospam@yahoo.com>
To Request Tracker <grass-bugs@intevation.de>
Cc grass-dev@grass.itc.it
Subject Re: [GRASS-dev] [bug #5197] (grass) v.distance: segfault when 'from' vector doesn't exist
Message-Id <20061010165834.34811b69.hamish_nospam@yahoo.com>
In-Reply-To <20061009222420.E9C6D1006A0@lists.intevation.de>
References <20061009222420.E9C6D1006A0@lists.intevation.de>
X-Mailer Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
X-Face M<EoB)"*Z~u!,vFhXmw}R_KbdBta*P_=T|rbBL'e1/CQ9;/1g\BU3&!=y8ria$2Uk!HT&BB 8i?|X_+7~1jsy}F~g$2va%3fV`*=L(*cem[@3\yg,G,@rg6/QMJ
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-Virus-Scanned by amavisd-new at intevation.de
X-Spam-Status No, hits=-2.3 tagged_above=-999 required=3 tests=[BAYES_00=-5, FORGED_YAHOO_RCVD=2.7]
X-Spam-Level
Request Tracker wrote:
> this bug's URL: http://intevation.de/rt/webrt?serial_num=5197
> ---------------------------------------------------------------------
..
> Subject: v.distance: segfault when 'from' vector doesn't exist
..
> $ v.distance from=dummy1 to=dummy2 upload=cat col=nic
> Segmentation fault

fixed in CVS HEAD & 6.2.

it was checking the vector map, but then didn't check to see what the
result of that test was. The test returns the mapset name on success.


> Interestingly, with '-p' it will behave as supposed to:
>
> $ v.distance -p from=dummy1 to=dummy2 upload=cat col=nic
> ERROR: Cannot find vector dummy1@

that's because it broke on this strcmp() when "mapset" was NULL:

if ( !print_flag->answer && strcmp(mapset,G_mapset()) != 0 )
   G_fatal_error(_("Vector 'from' is not in user mapset and cannot be updated"));
> BTW: why 'dummy1@' instead of 'dummy1@mapset_name'?

map wasn't found so mapset was NULL, and NULL at the end of a string
is just the end of the string.


> I noticed the many (all?) modules have been recently doing that.

if you can still find them, please provide specifics.



my question, and maybe the bigger bug, is why G_parser() didn't catch
this?
        /*vector maps*/    
        case G_OPT_V_INPUT:
            Opt->key          = "input";
            Opt->type         = TYPE_STRING;
            Opt->key_desc     = "name";
            Opt->required     = YES;
            Opt->gisprompt    = "old,vector,vector";
            Opt->description  = _("Name of input vector map");
            break;


I thought the "old" in gisprompt meant that it was tested. Or is that
just true for "new"?


Hamish


Wed, Oct 11 2006 09:49:06    Subject changed to G_parser() didn't catch "old,vector,vector" by msieczka  
Wed, Oct 11 2006 09:49:26    Subject changed to G_parser() didn't catch 'old,vector,vector' by msieczka  
Wed, May 9 2007 21:25:10    Mail sent by mneteler  
Does the problem persist? Looks functional to me.

Markus
Wed, May 9 2007 21:55:19    Mail sent by msieczka  
mneteler wrote (Wed, May 9 2007 21:25:10):

> Does the problem persist? Looks functional to me.

The bug in v.distance was fixed by Hamish, but he discovered another possible
issue which he did not know what to do with. Please look at the bottom lines
of his message on http://intevation.de/rt/webrt?serial_num=5197.

Maciek
Thu, May 10 2007 13:08:41    Mail sent by hbowman  
GRAS63> v.distance from=dummy1 to=dummy2 upload=cat col=nic
ERROR: Could not find input map <dummy1>

for 'old,vector,vector' the parser doesn't test if the map exists, only that
the string exists. that's left to the module when it tries to open the map:
v.distance/main.c:
 G_fatal_error(_("Could not find input map <%s>"), from_opt->answer);


but 'new,vector,vector' checks and gives an error if it exists (without --o).
Maybe the "map already exists" part of that test could ported to old,map,map?
Hamish
Tue, Oct 2 2007 18:25:56    Mail sent by tutey@o2.pl  
Return-Path <tutey@o2.pl>
Delivered-To grass-bugs@lists.intevation.de
Message-ID <4702710C.3010306@o2.pl>
Date Tue, 02 Oct 2007 18:25:48 +0200
From Maciej Sieczka <tutey@o2.pl>
User-Agent Thunderbird 1.5.0.13 (X11/20070824)
MIME-Version 1.0
To grass-bugs@intevation.de
Subject Re: [bug #5197] (grass) G_parser() didn't catch 'old,vector,vector'
References <20070509192510.1D6C51006D0@lists.intevation.de>
In-Reply-To <20070509192510.1D6C51006D0@lists.intevation.de>
Content-Type text/plain; charset=ISO-8859-2
Content-Transfer-Encoding 7bit
X-Virus-Scanned by amavisd-new at intevation.de
X-Spam-Status No, score=-4.865 tagged_above=-999 required=3.5 tests=[BAYES_00=-5, FORGED_RCVD_HELO=0.135]
X-Spam-Score -4.865
X-Spam-Level
test


Tue, Oct 2 2007 18:27:57    Mail sent by sieczka@biol.uni.wroc.pl  
Return-Path <sieczka@biol.uni.wroc.pl>
Delivered-To grass-bugs@lists.intevation.de
Message-ID <4702717D.803@biol.uni.wroc.pl>
Date Tue, 02 Oct 2007 18:27:41 +0200
From Maciej Sieczka <sieczka@biol.uni.wroc.pl>
User-Agent Thunderbird 1.5.0.13 (X11/20070824)
MIME-Version 1.0
To Markus Neteler via RT <grass-bugs@intevation.de>
Subject Re: [bug #5197] (grass) G_parser() didn't catch 'old,vector,vector'
References <20070509192510.1D6C51006D0@lists.intevation.de>
In-Reply-To <20070509192510.1D6C51006D0@lists.intevation.de>
Content-Type text/plain; charset=ISO-8859-2
Content-Transfer-Encoding 7bit
X-Virus-Scanned by amavisd-new at intevation.de
X-Spam-Status No, score=-5 tagged_above=-999 required=3.5 tests=[BAYES_00=-5]
X-Spam-Score -5
X-Spam-Level
test2


Comment | Reply | Take | Resolve

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