#2762: more informative error messages in lib/rast/get_row.c
---------------------------+-------------------------
Reporter: dylan | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: minor | Milestone: 7.1.0
Component: Raster | Version: svn-trunk
Keywords: error message | CPU: All
Platform: All |
---------------------------+-------------------------
In the file lib/rast/get_row.c there are several places in which the
"Error reading raster data..." error message can be generated (grass_trunk
r66508):
{{{
95: G_fatal_error(_("Error reading raster data for row %d of <%s>"),
101: G_fatal_error(_("Error reading raster data for row %d of <%s>"),
135: G_fatal_error(_("Error reading raster data for row %d of <%s>"),
142: G_fatal_error(_("Error reading raster data for row %d of <%s>"),
177: G_fatal_error(_("Error reading raster data for row %d of <%s>"),
181: G_fatal_error(_("Error reading raster data for row %d of <%s>"),
217: G_fatal_error(_("Error reading raster data via GDAL for row %d of
<%s>"),
}}}
It might be nice to know what exactly triggered these kind of messages,
especially afer encountering these errors [http://osgeo-
org.1560.x6.nabble.com/Error-reading-raster-data-for-row-xxx-only-when-
using-r-series-and-t-rast-series-td5229569.html on a couple] of
[http://lists.osgeo.org/pipermail/grass-dev/2015-July/075627.html
occasions].
I would offer some text, but I don't really understand what is going on in
code like this:
{{{
if (lseek(fcb->data_fd, t1, SEEK_SET) < 0)
G_fatal_error(_("Error reading raster data for row %d of <%s>"),
row, fcb->name);
}}}
Something as simple as "Error reading raster data for row %d of <%s>\n
file offset less than 0, ... blah blah blah" would IMHO help with
debugging those modules that may have created such a file.
I would be happy to make the changes if someone is willing to comments on
the meaning and implications of each case, outlined below:
{{{
if (lseek(fcb->data_fd, t1, SEEK_SET) < 0)
G_fatal_error(_("Error reading raster data for row %d of <%s>"),
row, fcb->name);
}}}
{{{
if ((size_t) G_zlib_read(fcb->data_fd, readamount, data_buf, bufsize) !=
bufsize)
G_fatal_error(_("Error reading raster data for row %d of <%s>"),
row, fcb->name);
}}}
{{{
if (read(fcb->data_fd, cmp, readamount) != readamount) {
G_freea(cmp);
G_fatal_error(_("Error reading raster data for row %d of <%s>"),
row, fcb->name);
}
}}}
{{{
if (lseek(fcb->data_fd, (off_t) row * bufsize, SEEK_SET) == -1)
G_fatal_error(_("Error reading raster data for row %d of <%s>"),
row, fcb->name);
}}}
{{{
if (read(fcb->data_fd, data_buf, bufsize) != bufsize)
G_fatal_error(_("Error reading raster data for row %d of <%s>"),
row, fcb->name);
}}}
{{{
if (err != CE_None)
G_fatal_error(_("Error reading raster data via GDAL for row %d of
<%s>"),
row, fcb->name);
}}}
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2762>
GRASS GIS <https://grass.osgeo.org>