[GRASS-dev] Return value from g.copy is one when --overwrite - bug or feature?
Glynn Clements
glynn at gclements.plus.com
Mon Nov 9 03:20:51 PST 2015
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>
More information about the grass-dev
mailing list