[GRASS-dev] Re: [bug #4524] (grass) v.clean, v.patch (else?):

Maciej Sieczka tutey at o2.pl
Mon Jul 10 03:08:13 EDT 2006


Mon, 10 Jul 2006 08:44:30 +0200 (CEST)
Hamish via RT <grass-bugs at intevation.de> wrote:

> Maciek Sieczka wrote:
> 
> > > still an issue? the fprintf's have been changed in v.patch.
> > 
> > Yes.
> > 
> > v.patch still prints to terminal instead of /dev/null. There is no
> > difference to before the change you mention, ie.:
> > 
> >  $ v.patch input=map1,map2 output=map3 >/dev/null
> >  Patching file map1
> >  Patching file map2
> >  Patch complete. 2 files patched.
> >  Intersections at borders will have to be snapped.
> >  Lines common between files will have to be edited.
> >  The header information also may have to be edited.
> > 
> > The above 6 lines should all go to /dev/null, too. v.clean is even
> > worse - *not a single line* is redirected to /dev/null, so each
> > v.clean run results in about 40 lines printed to the terminal.
> 
> 
> GRASS sends general messages to stderr and parsable output to stdout.
> 
> to redirect stderr to /dev/null do:
> 
> G61> v.patch input=map1,map2 output=map3 2> /dev/null

> note this will send errors and warnings to /dev/null too, which may
> not be what you want.

You are right, that is not a solution. We want errors and warnings be
let through.

> most modules should be quiet by default (I think ESR asks for "only
> display output if something surprising happens"), but include a -v
> verbose flag if verbose output could be interesting (e.g. long running
> modules). Really long running modules may want to send some heartbeat
> or status messages.
> 
> > G> v.patch input=map1,map2 output=map3 >/dev/null
> >  Patching file map1
> >  Patching file map2
> 
> These look like they might be put behind a -v verbose flag or
> G_debug(1,"");
> 
> >  Patch complete. 2 files patched.
> >  Intersections at borders will have to be snapped.
> >  Lines common between files will have to be edited.
> >  The header information also may have to be edited.
> 
> These look like they should remain with G_message().

What for? >/dev/null should result in filtering out all standard
information. Only information in case of unexpected module behaviour
should be let through. This will make user's scripts output cleaner.
The above info is usefull for a single v.patch run, to give guiding to
the user on how to proceed. But when v.patch is called from a script it
is script's author responsibility to be aware of such caveats and use
v.patch properly. IOW, when v.patch is called from a script the standard
message above is not improving anything but decreases the output 
clarity.

Same for v.clean or any other module.

Maciek




More information about the grass-dev mailing list