Opened 15 years ago

Last modified 9 years ago

#1042 new defect

winGRASS: r.statistics complains if path to grassdb has spaces

Reported by: ege Owned by: grass-dev@…
Priority: normal Milestone: 6.4.6
Component: Raster Version: svn-releasebranch64
Keywords: wingrass Cc:
CPU: x86-32 Platform: MSWindows XP

Description

Running r.statistics using a path to GRASS DATABASE folder containing blank spaces (e.g. C:\Documents and Settings\OCU\Desktop\grassdata) produces the following error:

Sorry <and> is not a valid option
Sorry
<Settings/OCU/Desktop/grassdata/leics62/icharm/.tmp/4020.0>
is not a valid option

After moving "grassdata" to C:\ r.statistics works.

I was going through "GRASS Seeds Training Notes". All other modules I ran before "r.statistics" did not complain about the path with spaces.

Change History (9)

in reply to:  description ; comment:1 by glynn, 15 years ago

Replying to ege:

Running r.statistics using a path to GRASS DATABASE folder containing blank spaces (e.g. C:\Documents and Settings\OCU\Desktop\grassdata) produces the following error:

After moving "grassdata" to C:\ r.statistics works.

This should only affect the sum, average and distribution aggregates; the others use popen() rather than a temporary file.

Hopefully fixed in 6.5 by r41957. Suggest back-porting to 6.4 for RC7.

Not applicable to 7.0, which doesn't use temporary files.

It might be worthwhile someone doing an exhaustive analysis of calls to system() and popen() (and the G_* versions) in case any similar issues remain.

in reply to:  1 comment:2 by ege, 15 years ago

Replying to glynn:

This should only affect the sum, average and distribution aggregates; the others use popen() rather than a temporary file.

Yes, I was using average.

comment:3 by neteler, 15 years ago

ege: In 10-20 minutes from now the new GRASS 6.5.svn winGRASS is online at http://josef.fsv.cvut.cz/wingrass/grass65/

Could you please try the fixed module?

in reply to:  3 comment:4 by ege, 15 years ago

Replying to neteler:

ege: In 10-20 minutes from now the new GRASS 6.5.svn winGRASS is online at http://josef.fsv.cvut.cz/wingrass/grass65/

Could you please try the fixed module?

In winGRASS 6.5 svn the module works :)

comment:5 by neteler, 15 years ago

Backported to GRASS 6.4.svn in r41960.

Other candidates:

d.barscale/main.c:      sprintf(cmdbuf, "%s bcolor=%s", cmdbuf, opt1->answer);
d.barscale/main.c:      sprintf(cmdbuf, "%s tcolor=%s", cmdbuf, opt2->answer);
d.histogram/get_stats.c:        cmd = mk_command("r.stats -Cr%s%s \"%s\" > \"%s\"\n", 4,
d.histogram/get_stats.c:        cmd = mk_command("r.stats -r%s%s \"%s\" nsteps=%s > \"%s\"\n", 5,
d.profile/Range.c:    sprintf(stats_cmd, "r.stats -ci %s > %s\n", name, temp_fname);
d.text.new/main.c:    sprintf(buf, "%s < %s", G_recreate_command(), cmd_file);
r.average/main.c:    sprintf(command, "%s -anC input=%s,%s fs=space > \"%s\"",
r.average/main.c:    sprintf(command, "%s input=%s output=%s < \"%s\"",
r.out.mpeg/main.c:      sprintf(cmd, "%s %s 2> /dev/null > /dev/null", encoder, mpfilename);
r.out.mpeg/main.c:      sprintf(cmd, "%s %s 2> /dev/null > /dev/null", encoder, mpfilename);
r.out.mpeg/main.c:          sprintf(cmd, "cd %s; \\ls %s >> %s 2> /dev/null",
xganim/main.c:      sprintf(cmd, "cd %s; \\ls %s >> %s 2> /dev/null", path, wildarg,

?

Markus

in reply to:  5 comment:6 by glynn, 15 years ago

Replying to neteler:

Other candidates:

d.barscale/main.c:      sprintf(cmdbuf, "%s bcolor=%s", cmdbuf, opt1->answer);
d.barscale/main.c:      sprintf(cmdbuf, "%s tcolor=%s", cmdbuf, opt2->answer);

The one before that might require it, i.e.:

	sprintf(cmdbuf, "\"%s\" at=%f,%f", argv[0], east, north);
d.histogram/get_stats.c:        cmd = mk_command("r.stats -Cr%s%s \"%s\" > \"%s\"\n", 4,
d.histogram/get_stats.c:        cmd = mk_command("r.stats -r%s%s \"%s\" nsteps=%s > \"%s\"\n", 5,
...
r.average/main.c:    sprintf(command, "%s -anC input=%s,%s fs=space > \"%s\"",
r.average/main.c:    sprintf(command, "%s input=%s output=%s < \"%s\"",

These are already quoted sufficiently.

d.profile/Range.c:    sprintf(stats_cmd, "r.stats -ci %s > %s\n", name, temp_fname);

This needs quoting:

    sprintf(stats_cmd, "r.stats -ci %s > \"%s\"", name, temp_fname);
d.text.new/main.c:    sprintf(buf, "%s < %s", G_recreate_command(), cmd_file);

So does this:

    sprintf(buf, "%s < \"%s\"", G_recreate_command(), cmd_file);
r.out.mpeg/main.c:      sprintf(cmd, "%s %s 2> /dev/null > /dev/null", encoder, mpfilename);
r.out.mpeg/main.c:      sprintf(cmd, "%s %s 2> /dev/null > /dev/null", encoder, mpfilename);
r.out.mpeg/main.c:          sprintf(cmd, "cd %s; \\ls %s >> %s 2> /dev/null",
xganim/main.c:      sprintf(cmd, "cd %s; \\ls %s >> %s 2> /dev/null", path, wildarg,

And all of these; although, I don't think that gee_wildfiles() will work on Windows in any event, due to Unix-isms. 7.0 uses g.mlist via G_spawn_ex().

comment:7 by hellik, 14 years ago

Milestone: 6.4.06.4.2

comment:8 by hamish, 13 years ago

r.statistics seems working in 6.4svn native wingrass now.

status of other quoting candidates mentioned in previous comments is unknown, so not closing the bug yet.

I wouldn't worry too much about the G_recreate_command() stuff as it is just being ledgered the history file.

Hamish

comment:9 by neteler, 9 years ago

Milestone: 6.4.26.4.6
Note: See TracTickets for help on using tickets.