[GRASS5] $GIS_OPT = "(null)" to "" in scripts

The grass51/scripts/i.spectral/i.spectral script needs someone who
knows more about sed than I do to change the "(null)" test to "".

[translation: i.spectral is currently buggy if not totally broken]

all other scripts are now updated WRT (null).

thanks,
Hamish

On Fri, Jan 14, 2005 at 07:05:06PM +1300, Hamish wrote:

The grass51/scripts/i.spectral/i.spectral script needs someone who
knows more about sed than I do to change the "(null)" test to "".

I have fixed that.

[translation: i.spectral is currently buggy if not totally broken]

Neither buggy nor broken... :slight_smile:
Works well (for me).

Please have a look again.

all other scripts are now updated WRT (null).

Does it also cover the recently reported security issues?
http://intevation.de/rt/webrt?serial_num=2877&display=History

These seem to be the candidates:
grep -r '/tmp/' scripts/* | cut -f1 -d: | uniq
scripts/i.oif/i.oif
scripts/i.oif/i.oifcalc
scripts/i.spectral/i.spectral
scripts/r.plane/r.plane
scripts/r.regression.line/r.regression.line

Not sure how to fix them (there was the rumor of a patch available,
though).

Markus

On Fri, 14 Jan 2005, Markus Neteler wrote:

Does it also cover the recently reported security issues?
http://intevation.de/rt/webrt?serial_num=2877&display=History

These seem to be the candidates:
grep -r '/tmp/' scripts/* | cut -f1 -d: | uniq
scripts/i.oif/i.oif
scripts/i.oif/i.oifcalc
scripts/i.spectral/i.spectral
scripts/r.plane/r.plane
scripts/r.regression.line/r.regression.line

Not sure how to fix them (there was the rumor of a patch available,
though).

I updated i.oif to use g.tempfile. Don't have a lot of time to do any more right now but it should hopefully give an idea of how it might be done for the others.

Paul

> The grass51/scripts/i.spectral/i.spectral script needs someone who
> knows more about sed than I do to change the "(null)" test to "".

I have fixed that.

> [translation: i.spectral is currently buggy if not totally broken]

Neither buggy nor broken... :slight_smile:
Works well (for me).

Please have a look again.

That was to say that it wouldn't work correctly until it was updated.
Now it should be fine.

> all other scripts are now updated WRT (null).

Does it also cover the recently reported security issues?
http://intevation.de/rt/webrt?serial_num=2877&display=History

No, I'm working on them next.

These seem to be the candidates:
grep -r '/tmp/' scripts/* | cut -f1 -d: | uniq
scripts/i.oif/i.oif

[Paul's taken care of that; I've already done r.univar.sh]

scripts/i.oif/i.oifcalc
scripts/i.spectral/i.spectral
scripts/r.plane/r.plane
scripts/r.regression.line/r.regression.line

note there are also a number of C modules which need updating as well:
imagery/i.ask/popup.c
lib/db/stubs/BUILD.PROTO
lib/db/dbmi_driver/mk_dbstubs_h.sh
lib/gis/unix_socks.c
lib/gis/gislib.dox
lib/gis/win32_pipes.c
lib/init/init.sh
lib/init/make_location_epsg_g57.sh
raster/r.digit/main.c
raster/r.median/main.c
raster/r.terraflow/description.html
raster/r.terraflow/main.cc
vector/v.out.ogr/description.html

see also
http://grass.itc.it/pipermail/grass5/2005-January/016898.html

(there was the rumor of a patch available, though).

against the Debian 5.0.3 source, here:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=287651

Hamish

> Does it also cover the recently reported security issues?
> http://intevation.de/rt/webrt?serial_num=2877&display=History

No, I'm working on them next.

[scripts are pretty much done now, please test]

scripts/i.oif/i.oifcalc

could someone test that one? There is this sort of thing:

awk '{print sum > "$temp_file"}'

which I am pretty sure will break but don't know enough awk to fix.

thanks,
Hamish

Hamish wrote:

> scripts/i.oif/i.oifcalc

could someone test that one? There is this sort of thing:

awk '{print sum > "$temp_file"}'

which I am pretty sure will break but don't know enough awk to fix.

If you want to use shell variables in awk commands, the easiest way is
probably to define a corresponding awk variable, e.g.

  awk -v temp_file="$temp_file" ...

then use:

  print sum > temp_file

within awk.

The alternative is to wrap the awk commands in double quotes, so that
shell variables are substituted.

That's fine for trivial commands, but for more complex commands you
typically end up with undesired substitions (e.g. $1 will be replaced
with the script's first argument, which probably isn't what you want).

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

> > scripts/i.oif/i.oifcalc
>
> could someone test that one? There is this sort of thing:
>
> awk '{print sum > "$temp_file"}'
>
> which I am pretty sure will break but don't know enough awk to fix.

If you want to use shell variables in awk commands, the easiest way is
probably to define a corresponding awk variable, e.g.

  awk -v temp_file="$temp_file" ...

then use:

  print sum > temp_file

within awk.

That did the trick, thanks.

i.oif is working again.

I also updated it to use r.univar (the C module) which should make it
a bit faster but gives slightly different answers too. The change is
on the order of 0.0005 though, shouldn't be important to the sort order.
Someone in the know might test to see if r.univar needs to report more
significant digits, etc?

I don't have any tests from before the updates -- all I know is that it
outputs some numbers. Could someone who knows LANDSAT test & see that
they still mean something? (I do know that d.rgb of my highest scoring
results produced a *really* nice false color satellite image)

Hamish