[GRASS-dev] [GRASS GIS] #2157: m.measure segfaults for unknown units

GRASS GIS trac at osgeo.org
Sun Jan 5 12:57:39 PST 2014


#2157: m.measure segfaults for unknown units
------------------------------+---------------------------------------------
 Reporter:  annakrat          |       Owner:  grass-dev@…              
     Type:  defect            |      Status:  new                      
 Priority:  normal            |   Milestone:  7.0.0                    
Component:  LibGIS            |     Version:  svn-trunk                
 Keywords:  units, m.measure  |    Platform:  All                      
      Cpu:  All               |  
------------------------------+---------------------------------------------
 Module m.measure segfaults in case of unknown units. In this
 [http://lists.osgeo.org/pipermail/grass-dev/2014-January/066780.html
 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.

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/2157>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list