[GRASS-dev] "Incompatible library version" errors

Glynn Clements glynn at gclements.plus.com
Tue Sep 9 20:50:40 EDT 2008


Markus Neteler wrote:

> > E.g. if write() fails, then you know that write() failed. You don't
> > know that it was due to insufficient disk space unless errno is set to
> > ENOSPC. write() can also fail with EDQUOT (quota exceeded), EFBIG
> > (maximum size of a single file exceeded), EIO (low-level I/O error,
> > e.g. media fault, failed NFS server), and others.
> 
> Sure but in this case there are ENOSPC, EDQUOT etc. (so indications
> could be trapped).

That requires that either:

a) error messages are generated at the point that the error occurs,
which is problematic if you don't always want to report the error, or

b) errno is preserved until you get to the point that you do actually
want to report the error, which means saving and restoring it if you
need to perform any error recovery which involves calling functions
which might themselves set errno. This is particularly problematic if
the error occurs in a library function but the decision on whether to
report it is left to individual modules, as the effort required is
multiplied dramatically.

However, in cases where the library function reports the error via
G_fatal_error(), there are probably many cases where we could make use
of enhanced versions of G_fatal_error() (or even G_warning()) which
include strerror(errno) in the output.

Also, there are a lot of cases where the library functions leave it to
the caller to report the error, even though 99.9% of callers will just
call G_fatal_error() (e.g. G_open_*_{old,new}(), G_{get,put}_*_row()). 
These should probably be replaced with wrappers which just call
G_fatal_error(), with the original functions being renamed to e.g. 
G_open_cell_old_no_error() etc.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list