Opened 11 years ago
Closed 11 years ago
#2157 closed defect (fixed)
m.measure segfaults for unknown units
| Reported by: | annakrat | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.0.0 |
| Component: | LibGIS | Version: | svn-trunk |
| Keywords: | units, m.measure | Cc: | |
| CPU: | All | Platform: | All |
Description
Module m.measure segfaults in case of unknown units. In this discussion the units in PROJ_UNITS file are defined as metre and metres and library function G_units gets stuck in a loop. So it's actually the problem of G_units and not m.measure. This patch seems to fix the problem but I am not sure if there are any side effects:
Index: lib/gis/proj3.c
===================================================================
--- lib/gis/proj3.c (revision 58561)
+++ lib/gis/proj3.c (working copy)
@@ -72,7 +72,7 @@
else if (strcasecmp(name, "degree") == 0 || strcasecmp(name, "degrees") == 0)
units = U_DEGREES;
else
- units = U_UNDEFINED;
+ units = U_UNKNOWN;
}
return G_get_units_name(units, plural, FALSE);
With this fix, the output of m.measure is:
Length: 1.882393 units Area: 0.055245 square units
Of course, fixing the metres to meters helps, too.
Attachments (1)
Change History (4)
follow-up: 2 comment:1 by , 11 years ago
by , 11 years ago
| Attachment: | proj3.diff added |
|---|
check for metre, metres, kilometre, kilometres spelling, too
comment:2 by , 11 years ago
comment:3 by , 11 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.

Replying to annakrat:
Wouldn't it be better to then also catch these two words? Untested patch attached.