[GRASS-dev] [bug #5184] (grass) r.null -n: always creates a null bitmap - no matter if it already exists

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

Subject: r.null -n: always creates a null bitmap - no matter if it already exists

(filling a bug report for Benjamin Ducke)

Platform: GNU/Linux/x86_64
grass obtained from: CVS
grass binary for platform: Compiled from Sources
GRASS Version: GRASS 6.1.cvs (2006)

the -n option is supposed to only do work (ie create a null bitmap) if
the null bitmap doesn't already exist. Currently it always does it.

only_null is the flag option and is only referred to in null.c in the
following if statement:

if(only_null && !G_find_file(element, "null", mapset))
{
    sprintf (buf, "%s doesn't have null bitmap file! Exiting", name);
    G_warning(buf);
    exit(0);
}

It should probably be:

if(!only_null && !G_find_file(element, "null", mapset))
{
    sprintf (buf, "%s doesn't have null bitmap file! Exiting", name);
    G_warning(buf);
    exit(0);
}

and have another test for checking whether the file does exist and -n
is set. i.e.

if(only_null && G_find_file(element, "null", mapset))
{
    exit(0);
}

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

Request Tracker wrote:

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

Subject: r.null -n: always creates a null bitmap - no matter if it already exists

(filling a bug report for Benjamin Ducke)

Platform: GNU/Linux/x86_64
grass obtained from: CVS
grass binary for platform: Compiled from Sources
GRASS Version: GRASS 6.1.cvs (2006)

the -n option is supposed to only do work (ie create a null bitmap) if
the null bitmap doesn't already exist. Currently it always does it.

only_null is the flag option and is only referred to in null.c in the
following if statement:

if(only_null && !G_find_file(element, "null", mapset))
{
    sprintf (buf, "%s doesn't have null bitmap file! Exiting", name);
    G_warning(buf);
    exit(0);
}

It should probably be:

if(!only_null && !G_find_file(element, "null", mapset))
{
    sprintf (buf, "%s doesn't have null bitmap file! Exiting", name);
    G_warning(buf);
    exit(0);
}

No; according to the flag's description, it should be:

if(only_null && G_find_file(element, "null", mapset))
{
     sprintf (buf, "%s already has a null bitmap file! Exiting", name);
     G_warning(buf);
     exit(0);
}

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