[GRASS-dev] Return value from g.copy is one when --overwrite - bug or feature?
Huidae Cho
grass4u at gmail.com
Mon Nov 9 06:14:15 PST 2015
r66775 adds a warning for non-vector elements as well.
On Mon, Nov 9, 2015 at 6:20 AM, Glynn Clements <glynn at gclements.plus.com>
wrote:
>
> Markus Neteler wrote:
>
> > It should probably not silently fail.
> >
> > The code in question is in
> > lib/manage/do_copy.c
>
> M_do_copy() returns a status. g.copy's main() checks that and uses it
> to set the exit status, but it doesn't generate an error or warning if
> the status is non-zero.
>
> If G_recursive_copy() or M_do_copy() raised an error, that would
> result in the program aborting on the first error; at present, it
> copies as much as it can.
>
> Realistically, g.copy() should be generating the error at the bottom
> of main() if result is non-zero. E.g.
>
> - exit(result);
> + if (result)
> + G_fatal_error(...);
> + return 0;
>
> > and potentially there to be added strerror(errno) as for example in
> > lib/gis/mapset_msc.c
>
> That would require G_recursive_copy() to call G_warning() (with the
> appropriate strerror(errno)) for each failed system call. Either that,
> or G_recursive_copy() would have to generate a "log" of failures so
> that the caller can report them.
>
> --
> Glynn Clements <glynn at gclements.plus.com>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20151109/4d237749/attachment.html>
More information about the grass-dev
mailing list