#2357: r3.info segfaults or reports incorrect values on Windows
-------------------------+--------------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.1.0
Component: Raster3D | Version: svn-releasebranch70
Keywords: r3.info | Platform: MSWindows 8
Cpu: Unspecified |
-------------------------+--------------------------------------------------
When I run r3.info on Windows on a map computed with v.vol.rst, it's
segfaults and stops writing output after:
{{{
| Projection: Lambert Conformal Conic (zone 0)
| N: 100 S: 0 Res: 1
| E: 100 W: 0 Res: 1
}}}
When I create a random map:
it doesn't segfault but I get nonsense (I guess it's the same problem):
{{{
| Projection: Lambert Conformal Conic (zone 0)
| N: 100 S: 0 Res: 1
| E: 100 W: 0 Res: 1
| T: 0 B: 0 Res: 0
| Range of data: min = 0 max = 0
}}}
The same map copied to linux has no problems. Perhaps the function
`format_double` could cause it since it is used for reporting top, bottom
and range values.
Further investigation shows that r.info reports wrong number of categories
(0) on a map which has categories. This would again point at
`format_double` function which looks completely the same as in r3.info.
However, v.info seems to work although it uses again `format_double`
function, but slightly modified:
#2357: r3.info segfaults or reports incorrect values on Windows
-------------------------+--------------------------------------------------
Reporter: annakrat | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.1.0
Component: Raster3D | Version: svn-releasebranch70
Keywords: r3.info | Platform: MSWindows 8
Cpu: Unspecified |
-------------------------+--------------------------------------------------
Comment(by wenzeslaus):
I seems that some C standards allow `l` to precede `f` but they also say
that `lf` is the same as `f`. From this it seems that on MS Windows,
because of MinGW or whatever, `lf` have unpredictable behavior. So, since
it is not different form `f` (both mean `double`), I suggest to replace
all occurrences of `lf` by `f`.
Also, the fact that there is more than `format_double()` function tells me
that it should be moved to the library. It might also avoid possibility of
bugs like this. The function looks pretty general, or at least, it is
used generally. Or do you think that these small functions should not go
to the library?