[GRASS-dev] Re: [GRASS-SVN] r46717 - grass/branches/releasebranch_6_4/scripts/v.build.all

>> > CMD="v.build map=${VECT}@${MAPSET}"

Hamish:

> ps- those curly brackets do nothing..

Markus M:

also no harm

yes and no-
sure it's a minor issue, but they help propagate
the myth that curly brackets can be used to safely
quote shell variables, which is harmful & also has
the consequence of folks looking right past them
when they try to debug a script with e.g. spaces in
the filename variable. Mostly I bring this up
because I have grown tired of fixing them, and hope
that illuminating the problem can make it go away.

fwiw, all module shell scripts have been audited
and to my knowledge are now all quoted safely- so
these thoughts are directed at newly committed code.

thanks,
Hamish

On Tue, Jun 28, 2011 at 10:32 AM, Hamish <hamish_b@yahoo.com> wrote:

>> > CMD="v.build map=${VECT}@${MAPSET}"

Hamish:

> ps- those curly brackets do nothing..

Markus M:

also no harm

yes and no-
sure it's a minor issue, but they help propagate
the myth that curly brackets can be used to safely
quote shell variables, which is harmful & also has
the consequence of folks looking right past them
when they try to debug a script with e.g. spaces in
the filename variable. Mostly I bring this up
because I have grown tired of fixing them, and hope
that illuminating the problem can make it go away.

fwiw, all module shell scripts have been audited
and to my knowledge are now all quoted safely- so
these thoughts are directed at newly committed code.

So you suggest to replace

CMD="v.build map=${VECT}@${MAPSET}"

with e.g.

CMD="v.build map='$VECT@$MAPSET'"

?

Markus M

Markus wrote:

So you suggest to replace

CMD="v.build map=${VECT}@${MAPSET}"

with e.g.

CMD="v.build map='$VECT@$MAPSET'"

?

that won't work as we need the variables expanded for later.

perhaps just leave them out (no change from current situation)

- CMD="v.build map=${VECT}@${MAPSET}"
+ CMD="v.build map=$VECT@$MAPSET"

as vector names and mapset(?) names should be shell-safe.

if it became

+ CMD="v.build map=\"$VECT@$MAPSET\""

then it would also need to replace

- $CMD
+ eval $CMD

Actually, I'm not really sure why that $CMD + g.message is needed
at all. Maybe as a g.message -d debug or verbose message, or is
it there for instructive purposes..?

shrug,
Hamish